- 论坛徽章:
- 0
|
本帖最后由 冷风 于 2010-05-11 09:33 编辑
环境 RHEL54 x64
自带的mysql
配置了主从
我发现如果从服务器不当机,数据都没有问题
如果从服务器关机,然后主服务器上插入多条记录,启动从服务器的时候就会报Duplicate entry错误,必须重新Change MASTER,slave的状态才能恢复正常,而且即使状态对了,数据库里还是少了主的几条记录,这是什么原因造成的
master状态
mysql> show master status\G
*************************** 1. row ***************************
File: master-bin.000006
Position: 54138
Binlog_Do_DB:
Binlog_Ignore_DB: mysql
1 row in set (0.01 sec)
slave:
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> CHANGE MASTER to MASTER_LOG_FILE='master-bin.000006',MASTER_LOG_POS=54138;
Query OK, 0 rows affected (0.03 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.147.128
Master_User: rep
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000006
Read_Master_Log_Pos: 54138
Relay_Log_File: slave-relay-bin.000002
Relay_Log_Pos: 236
Relay_Master_Log_File: master-bin.000006
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: redcap
Replicate_Ignore_DB: mysql
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: 54138
Relay_Log_Space: 236
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)
看状态都对,但是就是数据库里数据少了好几条。顺便说一下,我的数据库是phpwind(一个论坛)的数据库,在关闭了从服务器以后我在一个版块发了六个帖子,但是从服务器启动起来强制同步数据后我只看见2个帖子 |
|