当前位置:网站首页>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
边栏推荐
- Countdown 1 day ~ 2022 online conference of cloud disaster tolerance products is about to begin
- Nacos 详解,有点东西
- Solution of garbled code on idea console
- Gartner announces emerging technology research: insight into the meta universe
- OMNeT学习之新建工程
- Hyperbdr cloud disaster recovery v3 Release of version 3.0 | upgrade of disaster recovery function and optimization of resource group management function
- Install redis and deploy redis high availability cluster
- VIM uses vundle to install the code completion plug-in (youcompleteme)
- How to upgrade openstack across versions
- Cloud migration practice in the financial industry Ping An financial cloud integrates hypermotion cloud migration solution to provide migration services for customers in the financial industry
猜你喜欢
Six scenarios of cloud migration
Sail soft implements a radio button, which can uniformly set the selection status of other radio buttons
力扣-198.打家劫舍
漫画:什么是IaaS、PaaS、SaaS?
The solution of not displaying a whole line when the total value needs to be set to 0 in sail software
Homewbrew installation, common commands and installation path
Best practice of cloud migration in education industry: Haiyun Jiexun uses hypermotion cloud migration products to implement progressive migration for a university in Beijing, with a success rate of 1
Sort by character occurrence frequency 451
RAID磁盘阵列与RAID5的创建
What is the experience of using prophet, an open source research tool?
随机推荐
Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed
下载并安装MongoDB
Query the data from 2013 to 2021, and only query the data from 2020. The solution to this problem is carried out
[pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return
Grbl learning (I)
Day (5) of picking up matlab
JSP learning 1
Introduction notes to PHP zero Foundation (13): array related functions
Download and install mongodb
What is the experience of using prophet, an open source research tool?
Day (10) of picking up matlab
New project of OMNeT learning
299. 猜数字游戏
Nanny Anaconda installation tutorial
Server log analysis tool (identify, extract, merge, and count exception information)
OMNeT学习之新建工程
Nacos 详解,有点东西
LVM与磁盘配额
Day (2) of picking up matlab
JMeter setting environment variable supports direct startup by entering JMeter in any terminal directory