当前位置:网站首页>MySQL master-slave synchronization pit avoidance version tutorial
MySQL master-slave synchronization pit avoidance version tutorial
2022-04-23 16:35:00 【Autumnal equinox fishing fire】
Due to the data synchronization requirements on the project , I've seen a lot recently mysql Master slave synchronized posts , Also followed many posts to build it again , Finally, I found many places that are easy to step on the pit . Let's talk about it from beginning to end
- The master-slave synchronization has strict requirements on the version , Master and slave mysql The version must be consistent
- Please make sure the modified my.ini/my.cnf The file you installed mysql The program uses
Make sure that after two points above , So let's start building master-slave synchronization .
The first is the main end configuration
This part must pay attention to server-id It cannot be the same as the slave configured below .
meanwhile show master status after ,file And position If the parameter is empty , There are two possible situations
1. Modified my.ini file error , Not used by the current service
2. After modifying the file , No service restart
After the primary end is configured successfully , Now let's configure the slave
There are also places where it is easy to step on pits
If the port number of the primary end is not the default 3306, Additional port settings are required . Other settings that need to be changed , You can use commands show slave status\G To view the parameter list
master_log_file and master_log_pos The values of are before running on the host show master status Recorded when File and Position If the result is wrong , say slave The thread is running , Cannot set , In this case , perform mysql>stop slave; stop it slave Threads , Then set the parameters of the connection ; After setting up , perform mysql> start slave; Turn on slave Threads ; perform mysql> show slave status\G ( There's no semicolon ). If appear
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Represents successful configuration
After the master-slave setting is successful , Under normal circumstances , Synchronization ok , But when the slave network is interrupted or the network fluctuates , because mysql Its own setting problem , After returning to normal from the end network , need 30 Minutes to 60 Minutes to synchronize ( This is also a pit ) If you need to speed up synchronization , Need modification mysql Related parameters
For the specific principle, please refer to https://blog.51cto.com/wwdhks/2103885 This elder brother's post .
To add Individuals found in the tests The slave end is set -slave-net-timeout after , Need to put slave close It won't take effect until you open it again
At the same time, the master-slave mode can also be master-slave to each other , Avoid operating the same table when they are master-slave .
版权声明
本文为[Autumnal equinox fishing fire]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231402334722.html
边栏推荐
- Flask如何在内存中缓存数据?
- 人脸识别框架之dlib
- Install redis and deploy redis high availability cluster
- Es common query, sorting and aggregation statements
- 04 Lua 运算符
- On the value, breaking and harvest of NFT project
- Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed
- 05 Lua 控制结构
- Questions about disaster recovery? Click here
- Database dbvisualizer Pro reported file error, resulting in data connection failure
猜你喜欢
JMeter installation tutorial and solutions to the problems I encountered
Grbl learning (I)
Day (7) of picking up matlab
第十天 异常机制
New project of OMNeT learning
文件操作详解(2)
NVIDIA显卡驱动报错
Gartner publie une étude sur les nouvelles technologies: un aperçu du métacosme
安装Redis并部署Redis高可用集群
Matplotlib tutorial 05 --- operating images
随机推荐
Day 10 abnormal mechanism
Win11 / 10 home edition disables the edge's private browsing function
Matplotlib tutorial 05 --- operating images
Homewbrew installation, common commands and installation path
Install redis and deploy redis high availability cluster
linux上启动oracle服务
Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100
Postman batch production body information (realize batch modification of data)
You need to know about cloud disaster recovery
File system read and write performance test practice
面试题 17.10. 主要元素
计组 | 【七 输入/输出系统】知识点与例题
第九天 static 抽象类 接口
【Pygame小游戏】10年前风靡全球的手游《愤怒的小鸟》,是如何霸榜的?经典回归......
Sail soft implements a radio button, which can uniformly set the selection status of other radio buttons
Jour (9) de ramassage de MATLAB
ESP32_ Arduino
Redis "8" implements distributed current limiting and delay queues
OAK-D树莓派点云项目【附详细代码】
UWA Pipeline 功能详解|可视化配置自动测试