1. 程式人生 > >mysql主從同步出錯解決辦法

mysql主從同步出錯解決辦法

mysql主從同步錯誤解決和Slave_IO_Running: NO  一: Slave I/O: error connecting to master '[email protected]:3306' - retry-time: 60  retries: 86400, Error_code: 1045 解決方法 從伺服器上刪除掉所有的二進位制日誌檔案,包括一個數據目錄下的master.info檔案和hostname-relay-bin開頭的檔案。 master.info::記錄了Mysql主伺服器上的日誌檔案和記錄位置、連線的密碼。 二:出現錯誤提示 Error reading packet from server: File '/home/mysql/mysqlLog/log.000001' not found (Errcode: 2) ( server_errno=29) 解決方法: 由於主伺服器運行了一段時間,產生了二進位制檔案,而slave是從log.000001開始讀取的,刪除主機二進位制檔案,包括log.index檔案。 三:錯誤提示如下 Slave SQL: Error 'Table 'xxxx' doesn't exist' on query. Default database: 't591'. Query: 'INSERT INTO `xxxx`(type,post_id,browsenum)  SELECT type,post_id,browsenum FROM xxxx WHERE hitdate='20090209'', Error_code: 1146 解決方法: 由於slave沒有此table表,新增這個表,使用slave start 就可以繼續同步。 四:錯誤提示如下 Error 'Dupli
cat
e entry '1' for key 1' on query. Default database: 'movivi1'. Query: 'INSERT INTO `v1vid0_user_samename`  VALUES(null,1,'123','11','4545','123')' Error 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax  to use near '' at line 1' on query. Default database: 'club'. Query: 'INSERT INTO club.point_process ( GIVEID, GETID, POINT, CREATETIME, DEMO )  VALUES ( 0, 4971112, 5, '2010-12-19 16:29:28',' 1 row in set (0.00 sec) Mysql > Slave status\G; 顯示:Slave_SQL_Running 為 NO 解決方法: Mysql > stop slave;
Mysql > set global sql_slave_skip_counter =1 ; Mysql > start slave;  當您使用SET全域性sql_slave_skip_counter來跳過事件,結果是在一個組的中間,這個奴隸繼續跳過事件,直到它到達組的末尾。然後執行從下一個事件組開始。 五:錯誤提示如下 show slave status\G; Master_Log_File: mysql-bin.000029 Read_Master_Log_Pos: 3154083 Relay_Log_File: c7-relay-bin.000178 Relay_Log_Pos: 633 Relay_Master_Log_File: mysql-bin.000025 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: club Replicate_Ignore_DB:  Replicate_Do_Table:  Replicate_Ignore_Table:  Replicate_Wild_Do_Table:  Replicate_Wild_Ignore_Table:  Last_Errno: 1594 Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are:  the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log),  the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log),  a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's  binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. Skip_Counter: 0 Exec_Master_Log_Pos: 1010663436 這個問題原因是,主
資料庫
突然停止或問題終止,更改了mysql-bin.xxx日誌,slave伺服器找不到這個檔案,需要找到同步的點和日誌檔案,然後chage master即可。 解決方法: change master to  master_host='IP', master_user='同步帳號',  master_password='同步密碼',  master_port=3306,  master_log_file='mysql-bin.000025',  master_log_pos=1010663436; 六:錯誤提示如下 Error 'Unknown column 'qdir' in 'field list'' on query. Default database: 'club'. Query: 'insert into club.question_del (id, pid,  ques_name, givepoint, title, subject, subject_pid, createtime, approve, did, status, intime, order_d, endtime,banzhu_uid, banzhu_uname,del_cause,qdir) select id, pid, ques_name, givepoint, title, subject, subject_pid, createtime, approve, did,  status, intime, order_d, endtime,'1521859','admin0523','無意義回覆',qdir from club.question where id=7330212' 1 row in set (0.00 sec) 這個錯誤就說club.question_del 表裡面沒有qdir這個欄位 造成的加上就可以了~! 在主的mysql : 裡面查詢 Desc club.question_del;  在 錯誤的從伺服器上執行 : alter table question_del add qdir varchar(30) not null; 七:錯誤提示如下 Slave_IO_Running: NO  這個錯誤就是IO 程序沒連線上  ,想辦法連線上把 把與主的POS 號和檔案一定要對,然後重新載入下資料。具體步驟: slave stop; change master to master_host='IP地址',master_user='club',master_password='mima ',master_log_file='mysqld-bin.000048',MASTER_LOG_POS=396549485; 注:master_log_file='mysqld-bin.000048',MASTER_LOG_POS=396549485;是從主的上面查出 來的 :show master status\G; LOAD DATA FROM MASTER;  load data from master; slave start; mysql報錯如下: mysql> show slave status\G; *************************** 1. row ***************************              Slave_IO_State: Waiting for master to send event                 Master_Host: 192.168.0.198                 Master_User: rootclub                 Master_Port: 3306               Connect_Retry: 60             Master_Log_File: mysql-bin.000061         Read_Master_Log_Pos: 494107148              Relay_Log_File: xyxyclub-relay-bin.006609               Relay_Log_Pos: 1073365       Relay_Master_Log_File: mysql-bin.000061            Slave_IO_Running: Yes           Slave_SQL_Running: Yes             Replicate_Do_DB: club         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: 494107148             Relay_Log_Space: 1073365             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) ERROR:  No query specified  #這裡提示有錯誤,剛開始我以為資料庫的問題呢,經過查詢驗證,發現並不是資料庫的問題,而是我們操作的問題, 看下面操作。就沒有報錯誤吧。 mysql> mysql> show slave status\G *************************** 1. row ***************************              Slave_IO_State:                  Master_Host: 192.168.0.198                 Master_User: rootclub                 Master_Port: 3306               Connect_Retry: 60             Master_Log_File: mysql-bin.000061         Read_Master_Log_Pos: 494248077              Relay_Log_File: xyxyclub-relay-bin.006609               Relay_Log_Pos: 1213077       Relay_Master_Log_File: mysql-bin.000061            Slave_IO_Running: No           Slave_SQL_Running: No             Replicate_Do_DB: club         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: 494246860             Relay_Log_Space: 1214294             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: NULL 1 row in set (0.00 sec) mysql>  解釋: show slave status\G \G就是結束  再加一個";" 就多餘了,所以才報錯,這2個結束符號別重複使用就是...

相關推薦

mysql主從同步出錯解決辦法(工作筆記)

to use near '' at line 1' on query. Default database: 'club'. Query: 'INSERT INTO club.point_process ( GIVEID, GETID, POINT, CREATETIME, DEMO ) 

mysql主從同步出錯解決辦法

mysql主從同步錯誤解決和Slave_IO_Running: NO  一: Slave I/O: error connecting to master '[email protected]:3306' - retry-time: 60  retries:

關於mysql 主從同步錯誤解決方法

  在主庫上執行  show slave status\G;  Slave_IO_Running: No Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: '

MySQL 主從同步錯誤解決

1、出現錯誤提示、   Slave I/O: error connecting to master '[email protected]:3306' - retry-time: 60  retries: 86400, Error_code: 1045

MySQL主從同步常見報錯的解決辦法2

MySQL ERROR 1872 報錯截圖如下:該報錯屬於SQL線程報錯,原因是relay -index.index 和relay-log裏面的文件路徑對應不上。解決辦法: mysql> stop slave;mysql> reset slave;重新指定主庫信息mysql> ch

MySQL 主從同步延遲的原因及解決辦法

https://blog.csdn.net/soar_away/article/details/72615012    mysql 用主從同步的方法進行讀寫分離,減輕主伺服器的壓力的做法現在在業內做的非常普遍。 主從同步基本上能做到實時同步。我從別的網站借用了主從同

mysql主從同步延遲原因及解決方法

解決方案 數據庫 master 朋友 mysql MySQL主從延遲原因以及解決方案:談到MySQL數據庫主從同步延遲原理,得從mysql的數據庫主從復制原理說起,mysql的主從復制都是單線程的操作(mysql5.6版本之前),主庫對所有DDL和DML產生binlog,binlog是順序

mysql主從同步常見錯誤以及解決方法總結

前言 在發生故障切換後,經常遇到的問題就是同步報錯,資料庫很小的時候,dump完再匯入很簡單就處理好了,但線上的資料庫都150G-200G,如果用單純的這種方法,成本太高,故經過一段時間的摸索,總結了幾種處理方法。 生產環境架構圖 目前現網的架構,儲存著兩份資料,通過非同步複製做的高可用叢集,

解析Mysql 主從同步延遲原理及解決方案

  MySQL的主從同步是一個很成熟的架構,優點為:①在從伺服器可以執行查詢工作(即我們常說的讀功能),降低主伺服器壓力;②在從主伺服器進行備份,避免備份期間影響主伺服器服務;③當主伺服器出現問題時,可以切換到從伺服器。 相信大家對於這些好處已經非常瞭解了,在專案的部署中也採用

談談Mysql主從同步延遲分析及解決方案

一、MySQL的資料庫主從複製原理 MySQL主從複製實際上基於二進位制日誌,原理可以用一張圖來表示: 分為四步走: 1. 主庫對所有DDL和DML產生的日誌寫進binlog; 2. 主庫生成一個 log dump 執行緒,用來給從庫I/O執行緒讀取binlog;

[MySQL] MySQL主從同步報錯1236解決

記一次MySQL主從同步1236報錯檔案解決。 報錯: Slave同步失敗報錯1236,日誌 mysql> show slave status \G *************************** 1. row **********************

mysql主從同步不一致後的解決方法

檢視master的執行情況:[[email protected]] mysql -uroot -p************ [[email protected]] mysql> show master status \G; *********

MySQL主從同步配置容易出現的問題以及解決方法

 1.問題一: 如果從庫的Slave_IO_Running為NO。 The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be di

mysql匯入csv檔案出錯解決辦法

將*.csv檔案匯入mysql可使用LOAD DATA INFILE, 概要寫法: Load data in file  對於本地檔案,使用 load data local infile 'D:\\filename.csv' 語法 具體語法使用可參照:http://dev.mysql.com/doc/refm

mysql主從同步配置

這就是 sla star 失敗 有效 bin roo orm 相同 文件同步 rsync同步http://www.cnblogs.com/itech/archive/2009/08/10/1542945.html 在當前的生產工作中,大多數應用的mysql主從同步都是異步的

MySQL主從同步是怎樣實現的?

基本原理從庫生成兩個線程,一個I/O線程,一個SQL線程; i/o線程去請求主庫 的binlog,並將得到的binlog日誌寫到relay log(中繼日誌) 文件中; 主庫會生成一個 log dump 線程,用來給從庫 i/o線程傳binlog; SQL 線程,會讀取relay log文件中的日誌,

【分享】Brackets安裝emmet插件出錯解決辦法

racket img 復制 end 查看 解決辦法 目錄 nal get 1.復制下方鏈接,迅雷下載文件得到:brackets-emmet-1.2.1.zip文件 https://s3.amazonaws.com/extend.brackets/brackets-em

MySQL主從同步報錯故障處理記錄

記錄 error start record master 前言在發生故障切換後,經常遇到的問題就是同步報錯,下面是最近收集的報錯信息。記錄刪除失敗在master上刪除一條記錄,而slave上找不到Last_SQL_Error: Could not execute Delete_rows e

mysql too many connection 解決辦法

lec variable lob nbsp sql set time any wait SHOW VARIABLES LIKE "max_connections"; SHOW VARIABLES LIKE "wait_timeout"; SET GLOBAL m

監控mysql主從同步狀態是否異常,如果異常,則發生短信或郵寄給管理員

監控mysql主從同步狀態是否異常階段1:開發一個守護進程腳本每30秒實現檢測一次。階段2:如果同步出現如下錯誤號(1158,1159,1008,1007,1062),請跳過錯誤階段3:請使用數組技術實現上述腳本(獲取主從判斷及錯誤號部分)[[email protected]/* */ ~]# m