The content used today is used to synchronize data between servers, prepare two servers, one as Master and the other as slave. Server Environment: Ubuntu10.0464-bit Server; ensure that the MYSQL versions of the two servers are consistent with those of the databases to be synchronized; 1. Set Master Server: 1. Edit the Mysql configuration file vietcmysql
The content used today is used to synchronize data between servers, prepare two servers, one as Master and the other as slave. Server Environment: Ubuntu 10.04 64-bit Server; ensure that the MYSQL versions of the two servers are consistent, and the databases to be synchronized are consistent; 1. Set Master Server: 1, edit Mysql configuration file vi/etc/mysql/
The content used today is used to synchronize data between servers, prepare two servers, one as Master and the other as slave.
Server Environment: Ubuntu 10.04 64-bit Server;
Ensure that the MYSQL versions of the two servers are consistent, and the databases to be synchronized are consistent;
1. Set the Master server:
1. Edit the Mysql configuration file
vi /etc/mysql/my.cnf
2. After opening, add the following information to [mysqld:
[Mysqld] log-bin = mysql-bin // enable the binary log server-id = 71 // unique server ID
3. Restart Mysql:
/etc/init.d/mysql restart
4. log on to Mysql and create an slave synchronization account:
GRANT REPLICATION SLAVE ON *.* to 'backuser'@'192.168.1.190' identified by 'backuserpwd'; flush privileges;
@ The following IP address is the specified Backup Server IP address. For security reasons, only this IP address can be connected.
5. View Master Status of the Master server
show master status;
Remember the queried value:
Ii. Configure the slave server
The configuration in the first three steps is the same as that in the Master:
1. Edit the Mysql configuration file
vi /etc/mysql/my.cnf
2. After opening, add the following information to [mysqld:
[Mysqld] log-bin = mysql-bin // enable the binary log server-id = 72 // unique server ID. The ID here cannot be the same as that of the Master,
3. Restart Mysql:
/etc/init.d/mysql restart
4. Modify the slave information:
change master to master_host='192.168.1.193',master_user='backuser',master_password='backuserpwd',master_log_file='mysql-bin.000006',master_log_pos=20555,Master_Port=3301;
In the preceding statement, master_log_file = 'mysql-bin.000006' and master_log_pos = 20555 are the values remembered in the previous step. The default value of Master_Port is 3306. Generally, you do not need to keep up with them. Write the modified values ~
5. Start slave:
Slave start; // stop indicates stop;
6. view the slave status:
show slave status\G;
If the following two values are Yes, the operation is successful:
Slave_IO_Running: YesSlave_SQL_Running: Yes
Next, add data to the master server database for testing ~
It is quite simple. I wrote it in detail and listed it step by step.
If you cannot connect to the database, check whether the following content in the configuration file is commented out #:
bind-address = 127.0.0.1
Original article address: [memo] mysql Master Slave Master-Slave synchronization (replication) configuration and FAQs. Thank you for sharing it with me.