想在 win7 系统也试试读写分离,然后就一个笔记本电脑,我的做法是复制出第二个 mysql,加到服务里,修改 my.ini 如下: 主:
server-id = 1
binlog-do-db=community_ms
log-bin=mysql-bin
从:
server-id = 10
replicate-do-db= community_ms
log-bin=mysql-bin
然后配了用户:
create user 'forslave'@'127.0.0.1' identified by '123456';
GRANT REPLICATION SLAVE ON . TO 'forslave'@'127.0.0.1';
添加用户:
change master to master_host='127.0.0.1',
master_port=3306,
master_user='forslave',
master_password='123456',
master_log_file='mysql-bin.xxx',
master_log_pos=xxx;
启动 slave start;
然后查看: show slave status;
结果 slave_io_running 一直是 NO
查日志报错如下:
[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 but this does not always make sense; please check the manual before using it).
就是说 id 重复了,可配置文件里明明不一样,然后用:
show variables like 'server_id';
看了下也是一个 1,一个 10.
然后,各种百度,折腾半天没弄出问题在哪儿,求教啊!
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.