반응형
«   2020/12   »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Archives
Today
147
Total
1,100,789
관리 메뉴

Bryan's Tech-Log

MySQL replication 수동 복구(Slave 동기화) #2 본문

Technical/DBMS

MySQL replication 수동 복구(Slave 동기화) #2

Barracuda 2010. 7. 29. 08:25
반응형

Full dump 파일이 100MB 이상 되면 slave 에서 로드하다보면 제대로 되는지 확인이 안되서
시간은 급한데 억장이 무너진다면 아래의 방법을 써본다.

* Master: 10.10.0.200, Slave: 10.10.0.201

1. Master database read lock
# mysql -uroot -prootpass
<Master> flush logs;
<Master> flush tables with read lock;

2. Rsync from master to slave(Slave)
# mysqladmin -uroot -prootpass shutdown
# rm -rf /user/services/mysql/data/*
# rsync -r -p -v root@10.10.0.200:/user/service/mysql/data /user/service/mysql/

* Check my.cnf
server-id=2 (or other number, not 1)
master-host=10.10.0.200
master-user=root
master-password=rootpass

# chown -R mysql.mysql /user/service/mysql/data
# mysqld_safe --user=mysql --log-bin-trust-function-creators=1 --skip-slave --relay-log=mysql-relay-bin &
# mysql -uroot -prootpass
<Slave> stop slave;
<Slave> reset slave;

3. Reset master & start slave thread
<Master> unlock tables;
<Master> reset master; -- purge all log-bins
<Master> show master status;
<Slave> start slave;
<Slave> show slave status;

* Slave_IO_State : Waiting for master to send event, Master_Host : master_ip, ... => Successful 


- Barracuda -


반응형
0 Comments
댓글쓰기 폼