mysql集群结构
主库(云服务器centos7)配置
[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
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
重启服务
GRANT REPLICATION SLAVE ON *.* to 'xiaoming'@'%' identified by 'Root@123456';
show master status;
从库1(本地主机win10)配置
change master to master_host='ip',master_user='xiaoming',master_password='Root@123456',master_log_file='mysql-bin.eo0001',master_log_pos=主机的position
start slave;
show slave status;
测试
主节点新建一个db
从节点刷新,可以看到主节点上的新db立刻同步过来了
主节点新建表
从节点刷新,可以看到主节点的新表也立刻复制过来了
出问题了,表没自动复制过来
查看一下从节点状态,发现SQL=no了,主节点的position也变了(这个应该正常吧,刚才在主节点上建库建表有新操作了)
确定一下主节点的二进制日志文件位置position是否变化了,是否为1250
ok
尝试重启salve,先stop slave;
再start slave;
无效,重启后查看还是no
https://blog.csdn.net/weixin_44297303/article/details/101382890
执行手动同步,无效
http://www.pcxitongcheng.com/shujuku/Mysql/2020-08-09/13162.html
无效
解决:
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;
总结
重新测试结果也是只能偶尔同步一下库,而同步不了表和数据
发现:每次主节点数据库修改(建库建表删库删表以及数据操作)后,这时主节点数据库的二进制日志文件position会变化,
从节点数据库服务会自动关闭,需要手动重启,重启后就。。。