In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The answer is: Mysql master-slave synchronization, clustering, read-write separation, will involve data synchronization of data, so what do you want to play, we still have to learn the basis of this data synchronization before we can play other, today it is dream PHP to bring you this small case, pro-test, no problem!
The following examples are test cases, of course, your online server is the same! First of all, you have to ensure the unity of your operating system, the unity of the version of the database before you can open the door to data synchronization! Here are the steps!
1: First you need a virtual machine, then configure two systems on it, and of course your mysql version should be consistent.
2: You create a mysql database in your master's mysql that you want to synchronize
3: etc/in Linux directory
There's a file for my.cnf.
Configuration of the primary server
4:vi /etc/my.cnf
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
binlog_do_db = test #Specify the database to be synchronized (specified according to actual situation in actual application)
binlog_ignore_db = mysql #Database without synchronization
binlog_ignore_db = information_schema #Database without synchronization
% After setting up synchronization, note that if you create a database on the master server, the slave server will also be created, and then they will also synchronize, so you have to create other databases to prevent them from synchronizing.
The red line is the configuration you want to add.
5: Log in to mysql, and then check the status of master, the file and position values of Ji County, which will be used later from service
Configuration from Server:
1: Also find that my.cnf file
log-bin=mysql-bin
binlog_format=mixed
server-id = 2 #here is 2 the master server is 1, the following database needs to be synchronized what configuration is the same as the master server
binlog_do_db = test #Specify the database to be synchronized (specified according to actual situation in practical application)
binlog_ignore_db = mysql #Database without synchronization
binlog_ignore_db = information_schema #Database without synchronization
2: Enter mysql, execute slave stop
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.