当前位置:网站首页>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
边栏推荐
- KVO summary
- Simplicity is the best method of network promotion
- MTK platform execution disable_ Interrupt signals masked during IRQ will be enabled when I execute enable_ Continue triggering after IRQ
- XMIND 2022 mind map active resources?
- 8、 Slider assembly
- User defined pop-up use
- Vue page caching problem solving (keep alive + page level routing guard + lifecycle activated)
- Symbolic processing of crash log
- Query where uiwebview is used in the project
- 9、 Textinput component
猜你喜欢

Relative positioning, absolute positioning, fixed positioning

Mystery of power bank

AutoCAD 2020.3 Chinese Version (old version)

Remote Desktop Manager

How Navicat queries the password information of the connected database

【宋红康 MySQL数据库 】【高级篇】【07】MySQL的存储引擎

A training summary of Intranet penetration test

MySQL query group by 1055 is the simplest and most convenient way to solve the problem perfectly

mysql查询group by 1055 问题完美解决,最简单最便捷的方法

Wechat games (4)
随机推荐
模电实验——实验二 JFET共源极放大电路
Xmind 2022思维导图激活版资源?
(8) Sequence stack and chain stack
Xlua environment configuration
The applet uses the step bar vant steps in vant
8、 Slider assembly
Scrollrect rewrite recycle
navicat如何查询已连接的数据库密码信息
Remote Desktop Manager
A training summary of Intranet penetration test
Realization of readable and writable files in library management system with C language bidirectional linked list
对于mysql中数据为NULL引发的一些问题和思考
代码覆盖率测试对编程小白的意义及其使用方法
itertools 排列组合
Canvastotempfilepath of wechat
The significance of code coverage testing to programming white and its application
MySQL query group by 1055 is the simplest and most convenient way to solve the problem perfectly
Windchill API drops
Cocoapods problem record
phpcms手机门户网站配置