본문 바로가기
Database/MYSQL

MySQL 리플리케이션 상태 확인

by 반화넬 2016. 10. 27.
반응형

SLAVE DB에서 확인

  • Slave_IO_Running와 Slave_SQL_Running이 모두 Yes,
  • Read_Master_Log_Pos와 Exec_Master_Log_Pos 값이 일치,
  • Last_Errno는 0, Last_Error는 공란, Seconds_Behind_Master이 0이면 정상 복제중
정상 예시
[root@db02 ~]# mysql -uroot -p -e 'SHOW SLAVE STATUS\G' | egrep "Master_Log_Pos|Running|Last|Seconds"
        Read_Master_Log_Pos: 32974249
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
                 Last_Errno: 0
                 Last_Error: 
        Exec_Master_Log_Pos: 32974249
      Seconds_Behind_Master: 0
비정상 예시
[root@db02 ~]# mysql -uroot -p -e 'SHOW SLAVE STATUS\G' | egrep "Master_Log_Pos|Running"
        Read_Master_Log_Pos: 88149675
           Slave_IO_Running: No
          Slave_SQL_Running: Yes
        Exec_Master_Log_Pos: 88149675

[root@db02 ~]# mysql -uroot -p -e 'SHOW SLAVE STATUS\G' | egrep "Master_Log_Pos|Running" Read_Master_Log_Pos: 342179620 Slave_IO_Running: Yes Slave_SQL_Running: No Exec_Master_Log_Pos: 780301861


mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: db01.jmnote.com
                Master_User: replication
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000177
        Read_Master_Log_Pos: 1031981434
             Relay_Log_File: mysqld-relay-bin.000085
              Relay_Log_Pos: 1031981571
      Relay_Master_Log_File: mysql-bin.000177
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB: 
        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: 1031981434
            Relay_Log_Space: 1031981571
            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)

참고 자료


반응형