- 论坛徽章:
- 0
|
不知道法在这里合适不合适(因为我看到精华区里也有mysql的内容)。不合适的话,先说声对不起,请版主删了
问题是关于mysql双机互备,参考了网上一些帖子,比如http://www.cnfug.org/journal/9/01.html,http://www.5ilinux.com/mysql01.html,可惜没有成功,成功的能否帮忙给点提示?
A机(p):16.10.25.14 端口8888
B机(a):16.10.25.16 端口8888
设置A:
在A的mysql中设置了用户:
grant file on *.* to backup@\'16.10.25.14\' identified by \'1234\';
并且建立了待备份的库b
修改A机的my.cnf:
log-bin
server-id = 1
sql-bin-update-same
binlog-do-db=b
设置B:
修改B的my.cnf,在[mysqld]下:
log-bin
server-id=2
master-host=16.10.25.14
master-user=backup
master-password=1234
master-port=8888
master-connect-retry=60
replicate-do-db=b
log-slave-updates
然后将A的数据库目录下的b目录,拷贝到B机的数据库目录中。
重启两个mysql服务器。B的var目录下出现master.info,在B中可以看到库b,但是B不随A而更新。
检查B的mysql\\var目录,发现.err文件中报错:
041207 23:13:59 While trying to obtain the list of slaves from the master \'16.10.25.14:8888\', user \'backup\' got the following error: \'Access denied. You need the REPLICATION SLAVE privilege for this operation\'
按照提示,在A的mysql中,将REPLICATION SLAVE赋给用户backup
还是不能更新。err文件内容:
041208 2:29:15 Slave SQL thread initialized, starting replication in log \'p-bin.016\' at position 287, relay log \'./a-relay-bin.011\' position: 4
/home/magicj/mysql/libexec/mysqld: ready for connections.
Version: \'4.0.22-log\' socket: \'/home/magicj/tmp/mysql.sock\' port: 8888 Source distribution
041208 2:29:15 Slave I/O thread: connected to master \'backup@16.10.25.14:8888\', replication started in log \'FIRST\' at position 4
我发现:B似乎试图根据A机var目录下的pro-bin.016文件进行复制。而最新的文件应该是p-bin.018,其中记录了我的更新。我怀疑这是问题所在。请大家指点。 |
|