实验环境:
两台centos7服务器做MysqL主服务器:master01/master02;
两台centos7服务器做MysqL从服务器:slave01/slave02;
一台centos7服务器做监控服务器:monitor
问题一:master01 创建新的数据库abc,slave01上查看,未进行未进行数据同步。
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | abc | | MysqL | | performance_schema | | test |
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | MysqL | | performance_schema | | test | +--------------------+ //新建的数据表未进行同步
解决过程:
1、查看slave01的配置情况:
MariaDB [(none)]> show slave status\G Last_IO_Error: error connecting to master 'replication@192.168.109.129:3306' - retry-0 message: Access denied for user 'replication'@'192.168.109.159' (using password: YES) //看不懂... //重新启动服务,出现新的报错 MariaDB [(none)]> stop slave; Query OK, 0 rows affected (0.01 sec) MariaDB [(none)]> start slave -> ; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> show slave status\G; Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MysqL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave s does not always make sense; please check the manual before using it). //大概意思为使用了相同的server-id
2、配置文件中进行查看
vim /etc/my.cnf //发现与master01的server-id都设置成了1 进行修改为不同的server-id
3、重新启动服务
[root@localhost ~]# systemctl stop mariadb.service [root@localhost ~]# systemctl start mariadb.service [root@localhost ~]# systemctl start MysqL-mmm-agent.service [root@localhost ~]# systemctl enable MysqL-mmm-agent.service
4、使用moniror查看同步情况
[root@localhost MysqL-mmm]# mmm_control show ERROR: Can't connect to monitor daemon! //还是不行!!
问题二:moniror服务器无法获取节点情况,报错如下:
MariaDB [(none)]> show slave status\G Last_Error: Error 'Can't drop database 'school'; database doesn't exist' on query. Default databasool'. Query: 'drop database school'
解决过程:
1、看报错信息,可以得知是我在之前进行主主服务器同步情况测试时,创建删除的school数据库,由于slave从服务器还未进行同步,进程卡住,无法进行下一步操作,所以,部署才未能成功。
2、在从服务器上手动创建一个新的school数据库,让系统识别到后,自动删除一次次数据库就可以了
MariaDB [(none)]> create database school; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | MysqL | | performance_schema | | school | | test | +--------------------+
MariaDB [(none)]> quit Bye [root@slave02 ~]# [root@slave02 ~]# systemctl restart mariadb.service
4、再次进入数据库查看,school数据库已自动删除,且与master01数据库相同。
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | abc | | MysqL | | performance_schema | | test | +--------------------+
5、使用监控服务器monitor查看节点成功
[root@localhost MysqL-mmm]# mmm_control show db1(192.168.109.129) master/ONLINE. Roles: writer(192.168.109.188) db2(192.168.109.160) master/ONLINE. Roles: db3(192.168.109.162) slave/ONLINE. Roles: reader(192.168.109.189) db4(192.168.109.159) slave/ONLINE. Roles: reader(192.168.109.190)
试验成功。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。