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 realize two-way replication memo in MySQL

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces the MySQL how to achieve two-way copy memo, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

The so-called two-way replication actually configures master-slave replication separately.

Assuming that two MySQL instances are installed in the same environment and version, two-way replication can be configured by doing the following.

1. Server configuration (/ etc/my.cnf)

Server-id=2

Log-bin=mysql-bin

# relay-log=bs_db-relay-bin

Log-slave-updates

Auto_increment_increment=2

Auto_increment_offset=2

After modifying the configuration file, / etc/init.d/mysqld restart

2. Authorized copy account: GRANT REPLICATION SLAVE,RELOAD,SUPER ON *. * TO lijiabeibei@10.9.178.253 IDENTIFIED BY 'lijiabeibei.com'

3. Set up the master server

CHANGE MASTER TO MASTER_HOST='10.9.178.252',MASTER_USER='lijiabeibei',MASTER_PASSWORD='lijiabeibei.com', MASTER_LOG_FILE='mysql-bin.000001',MASTER_LOG_POS=106

4. Start / stop replication

Slave start

View replication status: show slave status\ G

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Slave stop

By configuring the MySQL master-slave server, the load of the database server can be greatly increased.

Thank you for reading this article carefully. I hope the article "how to achieve two-way replication of MySQL" shared by the editor will be helpful to everyone. At the same time, I also hope that 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