This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-17. For the latest, interactive version please visit https://mariadb.com/kb/.

breaking replication then resetting it

mariadb 5.5.60-MariaDB

I have a LIVE DB in a database "bugtracker". that mariadb instance also has these databases

information_schema mysql performance_schema test

I have a DR DB in a database "bugtracker". that mariadb instance also has these databases

information_schema mysql performance_schema

Replication is set up for bugtracker.

I am sorting a failover procedure.

Failover: stop replication on DR mysql> stop slave; mysql> reset master; mysql> change master to master_host='';

Stop MySQL database on DR

Edit /etc/my.cnf on DR to change server-id to 1 (from 2) Start MySQL database on DR

then use DR as the "live" site.

FAILBACK: mysqldump bugtracker on DR import bugtracker on live

Stop the MySQL database on LIVE Stop the MySQL database on DR

Edit /etc/my.cnf on DR to change server-id to 2 (back from 1)

Start the MySQL database on DR Start the MySQL database on LIVE

re-enable replication from LIVE to DR Initial setups/configurations are already done obviously so these steps are all that is needed to restart replication.

ON LIVE: use bugtracker; FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS;

record the information displayed e.g. +----------------------+----------+-------------------+------------------------+

FilePositionBinlog_Do_DBBinlog_Ignore_DB

+----------------------+----------+-------------------+------------------------+

mysql-bin.000001107bugtracker

+----------------------+----------+--------------------+------------------------+

reset the grant GRANT REPLICATION SLAVE ON *.* TO replication_user@DR_IP IDENTIFIED BY 'PASSWORD';

ON DR use bugtracker; CHANGE MASTER TO MASTER_HOST='LIVE_IP',MASTER_USER='replication_user',MASTER_PASSWORD='PASSWORD',MASTER_LOG_FILE='<see above>', MASTER_LOG_POS=<see above>;START SLAVE;

check slave status SHOW SLAVE STATUS\G Check for lines Slave_IO_Running: Yes Slave_SQL_Running: Yes

That seems sufficient to me.

But a colleague is suggesting that having dumped DR and imported to LIVE I now have to recreate the entire SLAVE DB stuff all from scratch - which seems overkill to me. ie delete the DR Dbs nd recreate them then dump the entire LIVE to import to DB?

??

cheers

didds

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.