mysql Slave_IO_Running:NO(解決方法)

 

Master slave 複製錯誤
Description:
Slave_IO_Running:NO
Slave_SQL_Running:Yes
Seconds_Behind_Master: NULL
本人遇到的Slave_IO_Running:NO的狀況有下面兩種:
1. 在配置slave同步時由於slave訪問master沒有權限致使;
2. master上的mysql-bin.xxxxxx文件全被我誤刪除了;
對於第一種狀況,仔細檢查數據庫訪問權限便可解決
對於第二種狀況,下面稍微詳細介紹一下:
mysql> show slave status\G
*************************** 1. row ***************************
             Slave_IO_State: 
                Master_Host: 192.168.3.21
                Master_User: slave
                Master_Port: 3307
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000016
        Read_Master_Log_Pos: 173
             Relay_Log_File: mysqld-relay-bin.000008
              Relay_Log_Pos: 98
      Relay_Master_Log_File: mysql-bin.000016
           Slave_IO_Running: No
          Slave_SQL_Running: Yes
            Replicate_Do_DB: 
        Replicate_Ignore_DB: 
         Replicate_Do_Table: 
     Replicate_Ignore_Table: br>                 Last_Errno: 0
                 Last_Error: 
               Skip_Counter: 0
        Exec_Master_Log_Pos: 173
            Relay_Log_Space: 98
            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)
[root@slave mysql]# tail /var/log/mysqld.log
081223 15:51:50  InnoDB: Started; log sequence number 0 43655
081223 15:51:51 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when 
this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-
log=/var/run/mysqld/mysqld-relay-bin' to avoid this problem.
081223 15:51:51 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.45-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3307  Source distribution
081223 15:51:51 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000016' at 
position 173, relay log '/var/run/mysqld/mysqld-relay-bin.000007' position: 98
081223 15:51:51 [Note] Slave I/O thread: connected to master 
[email='slave@192.168.3.21:3307']'slave@192.168.3.21:3307'[/email] ,  replication started  in log 'mysql-bin.000016' at position 173 081223 15:51:51 [ERROR] Error reading packet from server: Could not find first log file name in binary log  index file ( server_errno=1236) 081223 15:51:51 [ERROR] Got fatal error 1236: 'Could not find first log file name in binary log index file'  from master when reading data from binary log 081223 15:51:51 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000016', position 173 081223 15:51:58 [Note] Error reading relay log event: slave SQL thread was killed 解決步驟: 重啓master庫:service mysqld restart mysql> show master status; +------------------+----------+--------------+------------------+ | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000001 |       98 |              |                  |  +------------------+----------+--------------+------------------+ mysql> slave stop; mysql> change master to Master_Log_File='mysql-bin.000001',Master_Log_Pos=98; mysql> slave start; mysql> show slave status\G *************************** 1. row ***************************              Slave_IO_State: Waiting for master to send event                 Master_Host: 192.168.3.21                 Master_User: slave                 Master_Port: 3307               Connect_Retry: 60             Master_Log_File: mysql-bin.000001         Read_Master_Log_Pos: 98              Relay_Log_File: mysqld-relay-bin.000002               Relay_Log_Pos: 235       Relay_Master_Log_File: mysql-bin.000001            Slave_IO_Running: Yes           Slave_SQL_Running: Yes             Replicate_Do_DB:      Replicate_Wild_Do_Table:  Replicate_Wild_Ignore_Table:  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: 98             Relay_Log_Space: 235             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)
相關文章
相關標籤/搜索