本文共 2015 字,大约阅读时间需要 6 分钟。
mysql> grant replication slave on *.* to 'water'@'192.168.1.115' identified by 'cdio2010';
mysql> grant replication slave on *.* to 'water'@'192.168.1.116' identified by 'cdio2010';
mysql> flush privileges;
[mysqld]binlog-do-db=db_rockybinlog-ignore-db=mysqlreplicate-do-db=db_rockyreplicate-ignore-db=mysql,information_schemalog-slave-updates=1sync_binlog=1auto_increment_offset=1auto_increment_increment=2slave-skip-errors=all
[mysqld]server-id=2binlog-do-db=db_rockybinlog-ignore-db=mysqlreplicate-do-db=db_rockyreplicate-ignore-db=mysql,information_schemalog-slave-updates=1sync_binlog=1auto_increment_offset=2auto_increment_increment=2slave-skip-errors=all
sudo systemctl restart mysql
mysql> flush tables with read lock;mysql> show master status\G;
mysql> flush tables with read lock;mysql> show master status\G;
mysql> change master to master_host='192.168.1.115', master_user='water', master_password='cdio2010', \master_log_file='mysql-bin.000008', master_log_pos=107;
mysql> change master to master_host='192.168.1.116', master_user='water', master_password='cdio2010', \master_log_file='mysql-bin.000007', master_log_pos=438;
sudo systemctl restart mysql
mysql> show slave status\G;
mysql> show databases;
+--------------------+| Database | +--------------------+| information_schema | | db_rocky | | mysql | | performance_schema | | test | +--------------------+
mysql> use db_rocky;mysql> create table water (id int);mysql> insert into water values(1);mysql> commit;
mysql> show tables;mysql> select * from water;
mysql> show slave status\G;
转载地址:http://mpkfk.baihongyu.com/