我是MySQL新手并尝试创建复制 这是主人的my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
log-bin = /var/lib/mysql/logs/mysql-bin.log
binlog-do-db=fedorareptest1
server-id=1
----
Slave上的My.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
server-id=2
master-host=130.14.165.25
master-connect-retry=60
master-user=reptest
master-password=nopass!123
replicate-do-db=fedorareptest1
relay-log = /var/lib/mysql/logs/slave-relay.log
relay-log-index = /var/lib/mysql/logs/slave-relay-log.index
--------
注意:" replicate-do-db = fedorareptest1"中提到的数据库是master上的数据库。从属服务器上的这个数据库名称是fedoratest2。我应该使用上面这个吗?它应该是主人的
当我做奴隶状态时:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 130.14.165.25
Master_User: reptest
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 107
Relay_Log_File: slave-relay.000005
Relay_Log_Pos: 252
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: fedorareptest1
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 107
Relay_Log_Space: 549
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
--------------------------------------
当我对表格进行更新时,该行不会出现在奴隶上!
请帮助,我是MYSQL的新手。
答案 0 :(得分:0)
您应该避免使用* do-db选项,因为它们可以cause problems
检查查询是否发送给您的奴隶:
mysqlbinlog --short-form /path/to/relaylogfile | less
..或..
tcpdump -vv -A -i lo0 tcp port 3306 | tee dump.log
更新重新阅读您的帖子我发现了一个问题:您更改了数据库名称而没有使用replicate-rewrite-db