- 마스터, 슬레이브 Replication(동기화) 상태 보는 법

show master status -- 마스터에서

show slave status -- 슬레이브에서 (쉘에서 볼땐 show slave status \G; 로 하면 보기좋게 보임)


Master_Log_File

Read_Master_Log_Pos



SLAVE DB에서 확인해서

Slave_IO_Running와 Slave_SQL_Running이 Yes이고,

Read_Master_Log_Pos와 Exec_Master_Log_Pos 값이 일치하면 정상적으로 복제중이다.


==============================================================================


보통 리플리케이션이 깨졌을땐

슬레이브서버에서 stop slave 후


방법1. 

  에러부분을 수정


방법2.

  SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

처리 후 START SLAVE 하면 됨





- SLAVE DB 추가 및 이전 시 Read_Master_Log_Pos 틀릴경우 맞춰주는 법

슬레이브 서버에서

stop slave; # 슬레이브 서버를 멈춘 뒤

show slave status; # 현재 마스터의 쿼리실행내역을 확인

`Master_Log_File`

`Read_Master_Log_Pos`

# 서버이전 완료 후 슬레이브 서버에서 해당 쿼리 입력

CHANGE MASTER TO

MASTER_HOST = 'xxx.xxx.xxx.xxx'

,MASTER_PORT = 3306

,MASTER_USER = 'repl_user'

,MASTER_PASSWORD = 'NICE!COPYcat#00'

,MASTER_LOG_FILE = '마스터DB의 binary파일'

,MASTER_LOG_POS = 576375776;

START SLAVE;

+ Recent posts