In my testing environment, data is basically synchronized in an instant and I hope it will be helpful to you.
Redhat 9.0
Mysql3.23.57
Mysql Data Synchronization backup
Server A: master server 192.168.1.2
Server B: 192.168.1.3 slave server slave
Server A settings
# Mysql-u root-p
Mysql> grant file on *. * TO backup@192.168.1.3 identified by '20140901 ';
Mysql> exit
In the above example, the Master opens an account backup password 1234 to the IP Address: 192.168.1.3 and has the permission to process the file.
Mysqladmin-u root-p shutdown
Back up all the databases on the Master. tar commands are usually used.
# Tar-cvf/tmp/mysql.tar/var/lib/mysql
Note: When tar is used, MySQL must be stopped.
Modify/etc/my. cnf on machine
Add parameters in the [mysqld] Section
Log-bin
Server-id = 1
SQL-bin-update-same
Binlog-do-db = vbb
Restart server A mysql
In this case, the index is generated because the log-bin parameter is added. The/var/lib/mysql directory contains the. index file to record the change log of the database.
Server B settings
Set/etc/my. cnf
Add in the [mysqld] Section
Master-host = 192.168.1.2
Master-user = backup
Masters-password = 1234
Master-port = 3306
Server-id = 2
Master-connect-retry = 60 default retry Interval 60 seconds
Replicate-do-db = vbb tell slave to only update the vbb Database
Log-slave-updates
Copy mysql.tar On A to B
Use ftp to transfer B's/tmp
9. Extract
# Cd/var/lib/
Condition test
1. When both A and B networks and services are normal, the data changes from A side to B side to view data and check whether replication is performed ?!
2. simulate B as A machine, or B may not always need to be connected to.
After the data changed on the side is viewed on the B side, point B should have no data changes.
# Tar xvf/tmp/mysql-snapshot.tar
# Chown-R mysql: mysql
1. Restart mysql of server B.
Master.info appears in the/var/lib/mysql Directory, which records the information of the Master MySQL server.
Condition test
1. When both A and B networks and services are normal, the data changes from A side to B side to view data and check whether replication is performed ?!
2. simulate B as A machine, or B may not always need to be connected to.
After the data changed on the side is viewed on the B side, point B should have no data changes.