MariaDB Replikation (Ubuntu): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 73: | Zeile 73: | ||
GRANT REPLICATION SLAVE ON *.* TO 'master'@'%'; | GRANT REPLICATION SLAVE ON *.* TO 'master'@'%'; | ||
FLUSH PRIVILEGES; | FLUSH PRIVILEGES; | ||
</pre> | |||
<pre> | |||
SLAVE STOP; | |||
</pre> | |||
<pre> | |||
CHANGE MASTER TO MASTER_HOST = '10.0.0.157', MASTER_USER = 'master', MASTER_PASSWORD = '<password>', MASTER_LOG_FILE = 'mariadb-bin.000001', MASTER_LOG_POS = 626; | |||
</pre> | |||
<pre> | |||
SLAVE START; | |||
</pre> | </pre> | ||
Version vom 5. Februar 2020, 23:40 Uhr
Noch in Bearbeitung
Server A
Die Datei /etc/mysql/mariadb.conf.d/50-server.cnf editieren
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
und folgende Zeilen hinzufügen/anpassen:
log-bin /var/log/mysql/mysql-bin.log server_id=1 replicate-do-db=replicate bind-address=10.0.0.157
Danach den Server neu starten:
sudo systemctl restart mariadb
CREATE USER 'master'@'%' IDENTIFIED BY '<password>'; GRANT REPLICATION SLAVE ON *.* TO 'master'@'%'; FLUSH PRIVILEGES;
SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000001 | 774 | | | +------------------+----------+--------------+------------------+ 1 row in set (0.000 sec)
Server B (10.0.0.167)
Die Datei /etc/mysql/mariadb.conf.d/50-server.cnf editieren
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
und folgende Zeilen hinzufügen/anpassen:
log-bin /var/log/mysql/mysql-bin.log server_id=2 replicate-do-db=replicate bind-address=10.0.0.167
Danach den Server neu starten:
sudo systemctl restart mariadb
CREATE USER 'master'@'%' IDENTIFIED BY '<password>'; GRANT REPLICATION SLAVE ON *.* TO 'master'@'%'; FLUSH PRIVILEGES;
SLAVE STOP;
CHANGE MASTER TO MASTER_HOST = '10.0.0.157', MASTER_USER = 'master', MASTER_PASSWORD = '<password>', MASTER_LOG_FILE = 'mariadb-bin.000001', MASTER_LOG_POS = 626;
SLAVE START;
Links
Zurück zu MariaDB