Set MySQL data synchronization (one-way & bidirectional) as a result of the company's business needs, Netcom and telecom data synchronization, to do a two-way synchronization of MySQL, write down the process, later used to turn it out, also posted for your reference.
First, prepare the server
Because the Binlog format of the (binary log) between different versions of MySQL may vary, the best combination is the same or lower version of Master's MySQL version and Slave, and master's version must not be higher than the slave version.
More.. | Less.. | In this article, we assume that the primary server (hereafter, master) and the version from the server (hereinafter referred to as slave) are 5.0.27, and the operating system is Redhat Linux 9.
Suppose the host name for Sync Master is: A (ip:192.168.0.1), slave host name is: B (ip:192.168.0.2), and all 2 MySQL basedir directories are/usr/local/mysql,datadir:/ Var/lib/mysql.
Second, set up synchronization server
1. Set Sync Master
Modify the My.cnf file to
# Replication Master Server (default)
# binary logging is required for replication
Add the following:
log-bin=/var/log/mysql/updatelog
server-id = 1
binlog-do-db=test
binlog-ignore-db=mysql