当前位置:网站首页>MySQL master-slave replication
MySQL master-slave replication
2022-06-22 07:56:00 【yolo2016】
Mysql Master slave copy
principle
Simply speaking ,master Write database changes to binary log ,slave Synchronize these binary logs , And according to the binary log data replay operation , Realize data asynchronous synchronization

- Change the data on the main library (DDL DML DCL) Log to binary log (Binary Log) in .
- For the library I/O The thread copies the logs on the main database to its own relay logs (Relay Log) in .
- For the library SQL Thread reads events in relay log , Put it back on the standby database .

Mysql Software installation
yum clean all
yum makecache
cd /sysadmin/manager/LNMP
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld.service
Master slave configuration
##Mastar To configure
[mysqld]
port = 3306 ###
lower_case_table_names=1 # Don't separate case
log-bin=/var/lib/mysql/mysql-bin # Binary log must be enabled
server_id = 1 ###
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
service mysqld restart
grant replication slave on *.* to 'slave'@'%' identified by '123456';
show master status;
## Error reporting reference https://www.cnblogs.com/mke2fs/p/12386050.html
## Slave To configure
[mysqld]
port=3306 ##
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
lower_case_table_names=1 ##
server_id = 2 ##
relay_log = /var/lib/mysql/relay.log ##
service mysqld restart
# slave Set the copy information on the client
change master to
master_host='192.168.3.200',master_user='slave',master_password='123456',master_port=3306,master_log_file='mysql-bin.000001',master_log_pos=438;
start slave;
show slave status \G;
Reference resources
边栏推荐
- Docker install mysql, hello world
- Download addresses of Xcode versions
- Technology blog collection
- Excellent cases of data visualization
- Win openfeign from simple to deep
- Windchill - how to start workflow through API
- [songhongkang MySQL database] [advanced chapter] [06] logical architecture of MySQL
- Unity AssetBundle load
- Remote Desktop Manager
- Target detection series -- detailed explanation of RCNN principle
猜你喜欢

Expérience électrique en mode - - expérience 2 circuit d'amplification de source commune JFET

What is distributed transaction

Model electricity experiment -- Experiment 2 JFET common source amplifier circuit

Problems caused by canvas palette width and height and canvas width and height

Applet /vant UI to upload files
![[songhongkang MySQL database] [advanced chapter] [07] MySQL storage engine](/img/47/62ad1e661e015438c40574f533d8f1.png)
[songhongkang MySQL database] [advanced chapter] [07] MySQL storage engine

A training summary of Intranet penetration test

Xlua environment configuration

The applet uses the step bar vant steps in vant

(7) Bidirectional linked list
随机推荐
AutoCAD 2020.3 Chinese Version (old version)
Do you want to modify the title of the website
Excellent cases of data visualization
Symbolic processing of crash log
Xlua environment configuration
Impact of dead chain on websites
Common array operations in JS
Node red sends wechat official account message (template message)
Remote Desktop Manager
【Oracle 数据库】奶妈式教程 day14 转换函数
Wechat applets will directly open the parent element when the child element of flex:1 is too long (the text is too long)
《百度搜索引擎网页质量白皮书》指导网站建设及优化
7、 Picker component
Orientdb batch execute SQL
Remote Desktop Manager
Device tree failed to add SPI device node
User defined pop-up use
Asyncstorage quick start
[songhongkang MySQL database] [advanced chapter] [07] MySQL storage engine
[普通物理]波的能量与干涉