Mysql's MASTERSLAVE data synchronization configuration

xiaoxiao2021-03-20  216

Mysql's MASTER / SLAVE data synchronization configuration

My test environment. Basic data is instant synchronization, I hope to help Redhat 9.0 mysql3.23.57 mysql data synchronization backup A server: 192.168.1.2 Main Server Master B Server: 192.168.1.3 Sub-server SLAVE A Server Set # mysql - u root -p mysql> grant file on *. * to backup@192.168.1.3 Identified by '1234'; mysql> / exit is the master open an account backup password 1234 Give IP: 192.168.1.3 Permissions with files with files Mysqladmin - u root -p shutdown backup master all databases .. Usually use TAR instructions. #tar -cvf /tmp/mysql.tar / var / limited: Tar time, mysql is to be on the A machine in the A machine in STOP Modify /etc/my.cnf to join the parameter log-bin server-id = 1 SQL-BIN-UPDATE-SAME BINLOG-DO-BIN-UPDATE-SAME BINLOG-DO-DB = VBB Restart A Server Mysql This time because there is access to Log-bin The parameters, therefore started with index, there is a .INDEX archive record database in / var / lib / mysql directory. B server setting setting /etc/my.cnf Add Master-Host = 192.168.1.2 master-user = backup master-password = 1234 master-port = 3306 server-id = 2 master-connection-retrY = 60 preset retry interval 60 second replicate-do-db = VBB tells slave only VBB database Update Log-slave-Updates uses FTP bi / TMP 9 on MySQL.TAR COPY to B. Decompression #CD ​​/ VAR / LIB / Status Test 1.A with B network and services are normal After the data is changed by the A-terminal, the data is browsed to the B-terminal, see if there is replication ?! 2. Analog B is a machine, or b is not necessarily connected to A. The data will be changed by the A-terminal, to the B Browsing data, the B point should be no data change #TAR XVF /TMP/Mysql-snapshot.tar #CH OWN -R mysql: mysql mysql 1 Restart the bster's mysql at this time in the / var / lib / mysql directory, this file records the information of Master MySQL Server. Status Test 1.a with B Networks and services Under normal circumstances, after the data is changed, the data is changed to the B-terminal, see if there is replication ?! 2. Analog B is a machine, or b is not necessarily connected to a connection. After the A-end variant, Browsing data from B-terminal, the B point should be no data change

转载请注明原文地址:https://www.9cbs.com/read-130355.html

New Post(0)