변군이글루

[mysql] mysql 리플리케이션(replication) 설정 방법 본문

및___APM

[mysql] mysql 리플리케이션(replication) 설정 방법

변군 변군이글루 2013.07.24 17:02

mysql 리플리케이션(replication) 설정 방법

 

1. master 서버 작업

 

1.1 /etc/mysql.cnf

# vi /etc/mysql.cnf

 

 

[mysqld]

# Replication Master Server (default)

# binary logging is required for replication

log-bin=mysql-bin

 

# required unique id between 1 and 2^32 - 1

# defaults to 1 if master-host is not set

# but will not function as a master if omitted

server-id           = 1

// binlog-do-db = 특정디비만

// replicate-ignore-db = 특정db제외

// replicate-wild-ignore-table = 특정 table 제외

 

1.2 mysql 재시작

# /bin/sh /usr/local/mysql/bin/mysqld_safe &

 

1.3 slave에서 접속 할 계정 생성

# mysql –u root –p

 

mysql> use mysql

 

mysql> GRANT REPLICATION SLAVE ON *.* TO 'repuser'@10.0.10.101' IDENTIFIED BY '123456';

 

1.4 Slave의 설정을 위한 Master STATUS 정보

(File의 값과 Position의 값 추출)

mysql> FLUSH TABLES WITH READ LOCK;

1 row in set (0.00 sec)

 

mysql> SHOW MASTER STATUS;

+------------------+----------+--------------+------------------+

| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |

+------------------+----------+--------------+------------------+

| mysql-bin.000001 |   198032 |              |                  |

+------------------+----------+--------------+------------------+

1 row in set (0.00 sec)

 

mysql> UNLOCK TABLES;

1 row in set (0.00 sec)

 

2. slave 서버 작업

2.1 /etc/mysql.cnf

 

 

 

 

0 Comments
댓글쓰기 폼