DB는 master(101), slave(102) 이렇게 구성하였다.
1. Replication 구성
기본적으로 데이터가 insert되지 않는 상황에서 작업하면 엄청 빠르다.
하지만, 난 두 서버의 데이터를 맞춰놓았다. 물리적 서버 이동해야 되서.. 휴..
처음부터 디스크 용량 큰거 맞춰놓고 mysql 쓰는게 편하다...ㅠㅠ
(1) Master
<my.conf 확인>
server-id = 1
<Slave에서 Replication할 계정 생성>
mysql> create user repl identified by 'replx123'
mysql> grant replication slave on *.* to 'repl'@'slave 102 address' identified by 'replx123';
<master log file과 position 확인 - Slave에서 사용>
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000016 | 10596158 | | |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
(2) Slave
<my.conf 확인>
# Replication setting
server-id = 2
<mysql restart>
ps -ef | grep mysqld
kill -9 데몬 id
./mysqld_safe &
<change master 확인>
mysql> change master to master_host='master ip address', master_user='repl', master_password='replx123', master_log_file='mysql-bin.000016', master_log_pos=10596158;
<Slave 쓰레드 기동>
mysql> start slave
<Slave 로그 확인 - tail ../data/호스트파일.err >
100210 11:17:02 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000016' at position 10596158, relay log '/mysql/data/mntdbs102-relay-bin.000003' position: 98
100210 11:17:02 [Note] Slave I/O thread: connected to master 'repl@master-ip address:3306', replication started in log 'mysql-bin.000016' at position 10596158