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

[basic] mysqldump creates a slave library based on GTID

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

Share

Shulou(Shulou.com)06/01 Report--

For small databases, we can directly use the mysqldump full library export import to create a slave library.

Test environment:

CentOS6.8 x86_64

MySQL5.6.34 Community rpm Edition

Main library: node0 192.168.2.10

Slave library: node1 192.168.2.11

5.6.The parameters required for GTID replication (these three lines of parameters should be added for both master and slave libraries):

Gtid-mode=ON

Enforce_gtid_consistency = ON

Log_slave_updates=ON

Step1, export in the main library and scp transfer to node1:

Mysqldump-uroot-pwww.Mwbyd91@-A-Q-- single-transaction-- master-data=2 > / root/all.sql

Scp / root/all.sql node1:/root/

Step2, restore on node1:

Node1 newly installed does not have a password, execute mysql to log in

Source / root/all.sql

"step3, start replication on node1:"

CHANGE MASTER TO MASTER_HOST='192.168.2.10'

MASTER_USER='rpl'

MASTER_PASSWORD='rpl'

MASTER_PORT=3306

MASTER_AUTO_POSITION=1

Start slave

Show slave status\ G

# description:

Importing mysqldump in this way does not require operations like set global gtid_purged='xxxxx'; to be performed by innobackup. Because there are automatic settings in the sql exported by mysqldump. For example, the following figure is a partial screenshot of the exported all.sql:

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