欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

mysql主從服務(wù)器同步心得體會第1/2頁

 更新時間:2008年06月15日 18:57:19   作者:  
原來看過MYSQL同步數(shù)據(jù)的實現(xiàn),可是自己還沒有動過手,今天沒什么事就玩一玩,正好在旁邊有另一臺空電腦,都在同一個路由器下。哈哈,正好。

原來看過MYSQL同步數(shù)據(jù)的實現(xiàn),可是自己還沒有動過手,今天沒什么事就玩一玩,正好在旁邊有另一臺空電腦,都在同一個路由器下。哈哈,正好。

不過首先在找配置文件上就把我卡了好久,由于我用的是xampp安裝包,在xampp/mysql/bin目錄下看始終沒有找到my.cnf,在c:windows目錄下也沒有發(fā)現(xiàn),



如上圖,看到的只有一個”my”的快速撥號的東西,又不是文件,怎么都打不開。后來找了好久才在網(wǎng)上看到說遇到這種情況需要先打開editplus,然后再從editplus里面打開這個文件,果然。。。

配置就不詳說了,網(wǎng)上有很多,我原來也轉(zhuǎn)過一篇。

今天主要是講一下配置主從服務(wù)器需要注意的地方:

首先需要做主從的數(shù)據(jù)庫必須一模一樣,如果你的數(shù)據(jù)庫已經(jīng)運行過一段時間,建議你先刪除所有的二進制日志文件,包括索引xxx.index這個文件,否則重啟mysql會出錯。

從服務(wù)器上已經(jīng)刪除掉所有的二進制日志文件,當(dāng)然包括一個master.info這個文件。這個文件是用來記錄主服務(wù)器上過來的日志文件和記錄位置的。如果你不刪除它,它還會按照之前的記錄來做,所以會出問題,我在這里浪費了很多時間了。

主服務(wù)器診斷:

show processlist;顯示所有的進程。

show master status;顯示主服務(wù)器的日志文件和指針位置。

mysql> show master status;
+——————+———-+—————-+——————+
File Position Binlog_Do_DB Binlog_Ignore_DB
+——————+———-+—————-+——————+
mysql-bin.000001 603 videoCommunity
+——————+———-+—————-+——————+
1 row in set (0.00 sec)

mysql> show master status\G
*************************** 1. row ***************************
File: mysql-bin.000001
Position: 603
Binlog_Do_DB: videoCommunity
Binlog_Ignore_DB:
1 row in set (0.00 sec)

如上圖,mysql-bin.000001是日志記錄文件,603是指針位置。

從服務(wù)器(slave)上診斷:

mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: master1
Master_User: root
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 603
Relay_Log_File: master2-relay-bin.000053
Relay_Log_Pos: 740
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: videoCommunity
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: 603
Relay_Log_Space: 740
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)

確認(rèn)以上信息和主服務(wù)器是否一致。

相關(guān)文章

最新評論