A description of the application scenario
Currently, the server and Web side of the Zabbix monitoring system and MySQL are running on the same virtual machine, the virtual machine is not running very stable recently, and MySQL is frequently killed by Oom. It is necessary to migrate the Zabbix database to another physical machine with large memory in time.
Two migration steps
The idea is to build MySQL master-slave replication, the existing MySQL instance as master, the new MySQL instance as slave, now dump a copy of the existing data to the new MySQL instance, and then set the master-slave synchronization, and finally shut down the master-slave synchronization.
Here we use Xtrabackup to back up the master data without using mysqldump to back up the data, because the table is locked when the mysqldump is backed up and the backup time is longer.
1. Change the my.cnf of master
Log-bin=mysql-binlog-bin-index=mysql-bin.indexserver-id=1binlog_format=mixed
2. Change the my.cnf of slave
Server-id = 2relay-log-index = Slave-relay-bin.indexrelay-log = Slave-relay-binreplicate-ignore-db=mysql
3.
This article is from the Linux SA John blog, so be sure to keep this source http://john88wang.blog.51cto.com/2165294/1786970
Transfer Zabbix database using Xtrabackup and MySQL master-slave replication