chinaunix网友2008-01-19 15:13
请教下mysql同步的几个问题!
我有两台LINUX服务器,A:192.168.0.1和B:192.168.0.2,两服务器的mysql存放路径不一样(A库:/database/mysql/var/)和(B库:/usr/local/mysql/var/),我想把A服务器/database/mysql/var/homekoo库里的几个表同步到B服务器/usr/local/mysql/var/下的kocsys库里,下面是我的操作,重启mysql后发现数据没有同步B服务器的库里,请你指教下我的同步是不是问题,请你纠正下。
机器A:master
llog-bin=localhost-bin
server-id=1
binlog-do-db=homekoo //要同步的数据库
机器B:slave
relay-log=localhost-relay-bin
master-host=192.168.0.1
master-user=backup
master-password=***
master-port=3306
server-id=2
master-connect-retry=60
replicate-do-db=kocsys //本地需要更新的库和表
replicate-do-table=kocsys.loupan
replicate-do-table=kocsys.loupan_huxing
replicate-do-table=kocsys.jiamen_city
replicate-do-table=kocsys.sale_house
----------------------------------------------------------------------
重启A服务器mysql后,运行如下命令的显示
mysql> show master status;
+----------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+----------------------+----------+--------------+------------------+
| localhost-bin.000001 | 242192 | homekoo | |
+----------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
B服务器
mysql> SHOW SLAVE STATUS\G
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 8
Current database: *** NONE ***
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 11.111.111.111
Master_User: backup
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: localhost-bin.000001
Read_Master_Log_Pos: 439419
Relay_Log_File: localhost-relay-bin.000003
Relay_Log_Pos: 439560
Relay_Master_Log_File: localhost-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: kocsys
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: 439419
Relay_Log_Space: 439560
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
1 row in set (0.00 sec)
按理说已经同步成功,最新数据却没有同步到B服务器的kocsys库里