mysql主(云服务器centos7)从(本地win10)搭建失败记录【reggie_take_out】

mysql集群结构

image

主库(云服务器centos7)配置

image

image

image

image
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
https://blog.csdn.net/miachen520/article/details/122390084
image
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
修改/etc/my.ini后,systemctl restart mysqld重启服务

image
GRANT REPLICATION SLAVE ON *.* to 'xiaoming'@'%' identified by 'Root@123456';
show master status;
image

从库1(本地主机win10)配置

image
image
image
change master to master_host='ip',master_user='xiaoming',master_password='Root@123456',master_log_file='mysql-bin.eo0001',master_log_pos=主机的position
image
start slave;
image

show slave status;
image

测试

主节点新建一个db
image
从节点刷新,可以看到主节点上的新db立刻同步过来了
image
主节点新建表
image
从节点刷新,可以看到主节点的新表也立刻复制过来了
出问题了,表没自动复制过来
image
查看一下从节点状态,发现SQL=no了,主节点的position也变了(这个应该正常吧,刚才在主节点上建库建表有新操作了)
image


https://blog.csdn.net/qq_45001002/article/details/128343697

确定一下主节点的二进制日志文件位置position是否变化了,是否为1250
image
ok

尝试重启salve,先stop slave;start slave;
无效,重启后查看还是no

https://blog.csdn.net/weixin_44297303/article/details/101382890
执行手动同步,无效
image

http://www.pcxitongcheng.com/shujuku/Mysql/2020-08-09/13162.html
image
无效


解决:
image

stop slave;

change master to 
master_host='123.249.83.224',
master_user='xiaoming',
master_password='Root@123456',
master_port=3306,
master_log_file='mysql-bin.000002',
master_log_pos=2174;
start slave;


show slave status;

image

image

总结

重新测试结果也是只能偶尔同步一下库,而同步不了表和数据


发现:每次主节点数据库修改(建库建表删库删表以及数据操作)后,这时主节点数据库的二进制日志文件position会变化,
从节点数据库服务会自动关闭,需要手动重启,重启后就。。。
image

posted @ 2023-01-19 14:29  yub4by  阅读(12)  评论(0编辑  收藏  举报