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 build Mysql5.7 M-S-S

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

Share

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

This article mainly explains "how to build Mysql5.7 M-S-S". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to build Mysql5.7 M-S-S.

Deploy the M-S-S model

Environment introduction:

XUEGOD63 master mysql5.7.20 192.168.1.63

XUEGOD64 slave relay mysql5. 7.20 192.168.1.64

XUEGOD65 slave mysql5. 7.20 192.168.1.65

Deploy master---- > XUEGOD63:

Create a user on the main service and grant replication slave permissions:

Mysql > grant replication slave on *. * to repl@'192.168.1.64' identified by '123456'

Mysql > flush privileges

[root@xuegod63 ~] # vim / etc/my.cnf # modify the configuration by adding the following selections

Server-id=1

Binlog-do-db=HA

Log-bin=mysql-bin-master

Binlog-ignore-db=mysql

Sync-binlog=1

Binlog-format=row

Restart the service

[root@xuegod63 ~] # systemctl restart mysqld

Export a full backup of the primary server HA library and copy it to the relay server and slave server

[root@xuegod63] # mysqldump-uroot-p123456-B HA > ha.sql

[root@xuegod63 ~] # scp ha.sql 192.168.1.64:/root

[root@xuegod63 ~] # scp ha.sql 192.168.1.65:/root

Deploy slave Relay-> XUEGOD64

Import database ha.sql

[root@xuegod64] # mysql-uroot-p123456 stop slave

Mysql > change master to master_host='192.168.1.63',master_user='repl',master_password='123456'

Mysql > start slave

View the status of the relay service

Mysql > show slave status\ G

Create a user on the relay slave and grant replication slave permission

Mysql > grant replication slave on *. * to 'repl'@'192.168.1.65' identified by' 123456'

Mysql > flush privileges

Deploy slave- > xuegod65

Import database ha.sql

[root@xuegod65] # mysql-uroot-p123456 stop slave

Mysql > change master to master_host='192.168.1.64',master_user='repl',master_password='123456'

Mysql > start slave

View the status of the slave service

Mysql > show slave status\ G

Insert a data test from master:

Mysql > insert into test values (1)

Query OK, 1 row affected (0.09 sec)

Then view it on slave Relay and slave respectively

Why did the relay server also find the data? Because it's the storage engine.

Modify the engine of the table:

Mysql > alter table T1 ENGINE=blackhole; (close logging before modifying set sql_log_bin=off)

At this point, I believe you have a deeper understanding of "how to build Mysql5.7 M-S-S", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue 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