Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the mutual backup mode of mysql

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report