- 論壇徽章:
- 0
|
本帖最后由 冷風 于 2010-05-11 09:33 編輯
環(huán)境 RHEL54 x64
自帶的mysql
配置了主從
我發(fā)現(xiàn)如果從服務器不當機,數(shù)據(jù)都沒有問題
如果從服務器關機,然后主服務器上插入多條記錄,啟動從服務器的時候就會報Duplicate entry錯誤,必須重新Change MASTER,slave的狀態(tài)才能恢復正常,而且即使狀態(tài)對了,數(shù)據(jù)庫里還是少了主的幾條記錄,這是什么原因造成的
master狀態(tài)
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)
看狀態(tài)都對,但是就是數(shù)據(jù)庫里數(shù)據(jù)少了好幾條。順便說一下,我的數(shù)據(jù)庫是phpwind(一個論壇)的數(shù)據(jù)庫,在關閉了從服務器以后我在一個版塊發(fā)了六個帖子,但是從服務器啟動起來強制同步數(shù)據(jù)后我只看見2個帖子 |
|