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

Mysl is based on GTID master-slave replication

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

Share

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

Note: if the master mysql has been running for some time, you need to use backup software to restore the data backup to the slave server to ensure that the data from the master and slave servers are consistent, otherwise an error may be reported, and mysql only supports gtid after 5.6. make sure your software supports gpid during installation.

1. Install mysql

Wget-I-c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm # download yum source for mysql

Yum install mysql57-community-release-el7-10.noarch.rpm-y # install yum source

Yum-y install mysql-community-server-y # yum install mysql

two。 Edit the main profile

[mysqld] I always use the default path of rpm for datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockbasedir=/usr/local/mysqluser=mysqlport=3306server-id=1gtid-mode=ONenforce-gtid-consistency=ONbinlog_format=rowlog-bin=log-binsymbolic-links=0log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid, which is required for actual installation.

3. Edit from Fil

[mysqld] datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockbasedir=/usr/local/mysqluser=mysqlport=3306server-id=2gtid-mode=ONenforce-gtid-consistency=ONbinlog_format=ROWlog-bin=log-binlog_slave_updates=ONskip-slave-start=1symbolic-links=0log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid

4. Create an account with copy permission and create it on top of the main

Grant replication slave on *. * to 'rep'@'192.168.%.%' identified by' 123456'

5. Configure the connection from the server

Enter mysql configuration

Change master to master_host='192.168.1.32', master_user='rep',master_password='123456',master_port=3306,master_auto_position=1

6. Start synchronization, view

Start slave;# start

Show slave status

Here two yes show that the synchronization is successful.

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

Servers

Wechat

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

12
Report