当前位置:网站首页>MySQL one master multi slave configuration centos7 pro test

MySQL one master multi slave configuration centos7 pro test

2022-06-09 05:24:00 Anonymous s

Direct delivery of dry goods , Personal test !!
1: Configuration file in /etc/my.cnf. Cancel log-bin=mysql-bin Previous comments .

2: stay master On board slave Add a sync account ( Sync account yes replication,slave Permissions can be )

 MariaDB[(none)]>grant replication slave on *.* to 'slave'@'192.168.0.53' identified by 'aaaaaaaa';
				 grant replication slave on *.* to 'slave'@'192.168.0.54' identified by 'aaaaaaaa';
MariaDB[(none)]>flush  privileges;

3 : Refresh log, Record File,Position

MariaDB[(none)]>FLUSH LOGS;
MariaDB[(none)]>SHOW MASTER STATUS;

4: Keep the database consistent
export :mysqldump -uroot -p --all-datebases > /mnt/stroage_vdb/all.sql
Sync :scp ./all.sql 192.168.0.53:/mnt
Import :mysql:source /mnt/all.sql
5: stay B On the main engine master The node points to A host

MariaDB[(none)]>CHANGE MASTER TO MASTER_HOST = '192.168.0.52', MASTER_USER = 'slave', MASTER_PASSWORD = 'lAMIikej7QXlQ1th', MASTER_PORT = 3306, MASTER_LOG_FILE = ' mysql-bin.000011',  MASTER_LOG_POS = 154 ;

6: Start master-slave synchronization

MariaDB[(none)]>START SLAVE;

7: Check if there are two states yes

MariaDB[(none)]>SHOW SLAVE STATUS;

other :

Abnormal situation :

problem 1:Got fatal error 1236 from master when reading data from binary log: ‘Could not find first log file name in binary log index file’

1. Stop from the library binglog Sync

 MariaDB[(none)]> stop slave;

2. Refresh at the primary node log, Re recording File,Position

 MariaDB[(none)]>flush logs;

3. Changing from node binlog Location :

 MariaDB[(none)]> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000114',MASTER_LOG_POS=120

4. Start synchronization from the library , And check the status

 MariaDB[(none)]> start slave
 MariaDB[(none)]>SHOW MASTER STATUS;
原网站

版权声明
本文为[Anonymous s]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203021428224314.html