Sv translation | |||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||
IntroductionThis page describes the process of rebuilding a Master-Master DB & Replication. Since the MySQL Dump command locks the tables, there is no need to create it when there is no traffic on the machine. It can be done during operational hours. With --master-data the command mysqldump stores the correct position for inserting the replication on the slave server. ProcedureDetermine Good MasterIn a system with Master-Master replication, one of the masters is active and processing queries from the other jtel cluster members. This is the server from which the MySQL Dump is taken, since this master has the latest data and is up to date.
Haproxy configurationIf there is a HAPROXY, then remove the servers on the BROKEN MASTER side from the distribution (also the BROKEN SLAVE on this side). STOP SLAVELogin to MySQL on both the GOOD MASTER and the BROKEN MASTER to stop the slave SQL. Leave MySQL again afterwards. Use the following commands for this:
Phase 1 - MySQL DumpA MySQL Dump of the GOOD MASTER is now created. Perform the following steps to create a MySQL Dump and save it to the STORE:
jtel Portal software releaseLog in to the Load Balancer of the cluster and execute the following commands as the jtel user
Create Backup Directory
Create MySQL Dump
MySQL Dump - Until jtel Portal release 3.12
Guter Server ermitteln Zuerst muss entschieden werden, welcher der "guter" Server ist. Wenn HAPROXY im Betrieb ist, dann ist der guter Master der auf den die Daten derzeit geschrieben werden.
HAPROXY umstellen Falls es ein HAPROXY gibt, dann die Server auf der Kaputten Master Seite aus der Verteilung herausnehmen (auch den Slave auf dieser Seite).
Auf BEIDE Master Server STOP SLAVE;
Auf den KAPUTTEN Master Server eine Sicherung der guten Master DB anfertigen Vor Release 3.12: mysqldump -h<GOOD_MASTER> -uroot -p<PASSWORD> --single-transaction --master-data=2 --databases JTELWeb JTELStats JTELLog --add-drop-database --add-drop-table --events --routines --triggers > master.sql Ab Release 3.12 bitte folgenden Befehl nutzen: mysqldump -h<GOOD_MASTER> -uroot -p<PASSWORD>
Auf den KAPUTTEN Master Server, den Slave resetten, und Sicherung einspielen RESET SLAVE; SOURCE master.sql;
Auf den KAPUTTEN Master Server aus den master.sql die Master Position ermitteln, und dann den Slave reinitialisieren CHANGE MASTER TO MASTER_HOST = '<GOOD_MASTER>', MASTER_USER = 'repl', MASTER_PASSWORD = '<PASSWORD>', MASTER_LOG_FILE='<NAME_LOGFILE>', MASTER_LOG_POS=<POSITION_LOGFILE>; START SLAVE;
Auf den KAPUTTEN Master Server den Slave Prüfen SHOW SLAVE STATUS\G Erst wenn alles OK, und die Replikation aktuell ist, dann weitermachen. Den Status kann man mit folgenden Befehl beobachten: watch 'mysql -u root -p<PASSWORD> -e "SHOW SLAVE STATUS\G" 2>/dev/null' Auf den KAPUTTEN Master Server alle Tabellen locken und Master Position notieren FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS; Die Positionen von SHOW MASTER STATUS werden im folgenden Kommando benötigt. Auf den GUTEN Master Server die Replikation neu positionieren und starten CHANGE MASTER TO MASTER_HOST = '<SECOND_MASTER>', MASTER_USER = 'repl', MASTER_PASSWORD = '<PASSWORD>', MASTER_LOG_FILE='<NAME_LOGFILE>', MASTER_LOG_POS=<POSITION_LOGFILE>; START SLAVE;
Auf den KAPUTTEN Master Server die Tabellen Locks aufheben UNLOCK TABLES;
Master und Slaves Prüfen Auf allen Servern nun SHOW SLAVE STATUS\G und prüfen dass alles richtig läuft Es ist normalerweise nicht nötig, die Slaves die an beide Master hängen ebenfalls zu wiederherstellen. Wenn doch, können diese mit der normalen Prozedur für das Wiederherstellen des Slaves neu initialisiert werden. | |||||||||||||||||||||||||||||||||||||||||||||||
Sv translation | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
MySQL Dump - From jtel Portal release 3.12 until latest release
MySQL Dump - From Release 3.32
Guter Server ermitteln Zuerst muss entschieden werden, welcher der "guter" Server ist. Wenn HAPROXY im Betrieb ist, dann ist der guter Master der auf den die Daten derzeit geschrieben werden. HAPROXY umstellen Falls es ein HAPROXY gibt, dann die Server auf der Kaputten Master Seite aus der Verteilung herausnehmen (auch den Slave auf dieser Seite). Auf BEIDE Master Server STOP SLAVE; Auf den KAPUTTEN Master Server eine Sicherung der guten Master DB anfertigen Vor Release 3.12: mysqldump -h<GOOD_MASTER> -uroot -p<PASSWORD>
Ab Release 3.12 bitte folgenden Befehl nutzen:
MySQL Dump - From MySQL 8.0.27To Check for MySQL Version, log in to the master database server and execute the following command
Auf den KAPUTTEN Master Server, den Slave resetten, und Sicherung einspielen RESET SLAVE; SOURCE master.sql;
Brief Explanation of the mysqldump command
Phase 2 - Import Dump on BROKEN MASTER
Import Dump - tmux
Import Dump - No tmux
Update Replication Parameterson BROKEN MASTER
Determine the replication parameters from the GOOD MASTER and reinitialize the BROKEN MASTER
Check the slave on the BROKEN MASTER
Den Status kann man mit folgenden Befehl beobachten: Only if everything is OK, and the replication is up to date, then continue. The status can be monitored with the following command:
Lock Tables on BROKEN MASTER
Die Positionen von SHOW MASTER STATUS werden im folgenden Kommando benötigt. Auf den GUTEN Master Server die Replikation neu positionieren und starten On the GOOD MASTER, reposition and start the replication.
Unlock the tables on the BROKEN master server
Master und Slaves Prüfen Final Checks - All ServersCheck the GOOD MASTER, THE GOOD SLAVE, THE BROKEN MASTER AND THE BROKEN SLAVE
und prüfen dass alles richtig läuft Es ist normalerweise nicht nötig, die Slaves die an beide Master hängen ebenfalls zu wiederherstellen. Wenn doch, können diese mit der normalen Prozedur für das Wiederherstellen des Slaves neu initialisiert werden.Final Checks - Haproxy configurationIf there is a HAPROXY, then add the servers on the BROKEN MASTER side from the distribution (also the BROKEN SLAVE on this side). |
Sv translation | ||
---|---|---|
| ||
Sv translation | ||
---|---|---|
| ||