MySQL 레플리케이션 상태 확인

Jmnote (토론 | 기여)님의 2017년 9월 26일 (화) 23:56 판 (새 문서: ==개요== ;MySQL replication 점검 ;MySQL replication 상태 확인 ;MySQL 리플리케이션 상태 확인 ;MariaDB 리플리케이션 상태 확인 * ※ MySQL / MariaDB 동일함...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

MySQL replication 점검
MySQL replication 상태 확인
MySQL 리플리케이션 상태 확인
MariaDB 리플리케이션 상태 확인
  • ※ MySQL / MariaDB 동일함

2 방법 1

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이면 정상 복제중
mysql -u아이디 -p패스워드 -e 'SHOW SLAVE STATUS \G' | egrep "Master_Log_Pos|Running|IO_Err|SQL_Err"
mysql -u아이디 -p패스워드 -e 'SHOW SLAVE STATUS\G' | egrep "Master_Log_Pos|Running|Last|Seconds"
정상 예시
root@slave:~# mysql -utestuser -pP@ssw0rd -e 'SHOW SLAVE STATUS \G' | egrep "Master_Log_Pos|Running|IO_Err|SQL_Err"
          Read_Master_Log_Pos: 38144310
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
          Exec_Master_Log_Pos: 38144310
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error:
비정상 예시
root@slave:~# mysql -utestuser -pP@ssw0rd -e 'SHOW SLAVE STATUS \G' | egrep "Master_Log_Pos|Running|IO_Err|SQL_Err"
          Read_Master_Log_Pos: 38125518
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
          Exec_Master_Log_Pos: 29972602
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 1062
               Last_SQL_Error: Error 'Duplicate entry '4273' for key 'PRIMARY'' on query. ... (생략)

3 방법 2

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)

4 같이 보기

5 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}