How to configure the mutual backup mode of mysql
This article mainly introduces how to configure the mysql dual standby mode, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.
Library A: 192.168.190.130
Library B: 192.168.190.131
A library construction users
Grant FILE,SELECT, replication slave on *. * to 'gaok_bak'@'192.168.190.131' identified by' gaok'
Flush privileges
Show grants for 'gaok_bak'@'192.168.190.131'
B library construction users
Grant FILE,SELECT, replication slave on *. * to 'gaok_bak'@'192.168.190.130' identified by' gaok'
Flush privileges
Show grants for 'gaok_bak'@'192.168.190.130'
A Library my.cnf configuration (add the following):
[mysqld]
Server-id = 1
Log_bin = / usr/local/mysql/data/mysql-bin.log
Relay_log = / usr/local/mysql/data/mysql-relay.log
Log-slave-updates = ON
Sync_binlog=1
Auto-increment-increment=10
Auto-increment-offset=1
B Library my.cnf configuration (add the following):
[mysqld]
Server-id = 2
Log_bin = / usr/local/mysql/data/mysql-bin.log
Relay_log = / usr/local/mysql/data/mysql-relay.log
Log-slave-updates = ON
Auto-increment-increment=10
Auto-increment-offset=1
Sync_binlog=1
# two mysql reboots
Library An and Library B view master status
Library A:
Change master to
Master_host='192.168.190.131'
Master_user='gaok_bak'
Master_password='gaok'
Master_log_file='mysql-bin.000002'
Master_log_pos=154
Start slave
Show slave status\ G
Library B:
Change master to
Master_host='192.168.190.130'
Master_user='gaok_bak'
Master_password='gaok'
Master_log_file='mysql-bin.000002'
Master_log_pos=154
Start slave
Show slave status\ G
-the test is correct.
Thank you for reading this article carefully. I hope the article "how to configure mysql dual standby mode" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!