[MYSQL] REPLICATION

개발/MySql 2010. 10. 28. 11:13
REPLICATION
#MASTER
#vi /etc/my.cnf
# 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

#mysql
grant replication slave on *.* to 'backup'@'xxx.xxx.xxx.xxx' identified by 'dnsaud';

#SLAVE
#vi /etc/my.cnf

# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
server-id       = 2
#
# The replication master for this slave - required
master-host     =   db1
#
# The username the slave will use for authentication when connecting
# to the master - required
master-user     =   backup


>master db 를 slave로 복사
#/usr/local/mysql/bin/mysqldump -hxxx.xxx.xxx.xxx -ucutalk -pcutalk cutalkdb | /usr/local/mysql/bin/mysql -uroot -C cutalkdb

#/usr/local/mysql/bin/mysql
CHANGE MASTER TO MASTER_HOST='xxx.xxx.xxx.xxx', MASTER_PORT=3306,
    MASTER_USER='backup', MASTER_PASSWORD='dnsaud', master_log_file='mysql-bin.000007', master_log_pos=659277542;


#master_log_file 및 master_log_pos
show master status;
+------------------+-----------+--------------+------------------+
| File             | Position  | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+-----------+--------------+------------------+
| mysql-bin.000008 | 121100486 |              |                  |
+------------------+-----------+--------------+------------------+
1 row in set (0.00 sec)


'개발 > MySql' 카테고리의 다른 글

[MYSQL] 'table is full' 에러 날 때  (0) 2010.12.23
[MYSQL] 5.1이상에서 Partitioning ...  (0) 2010.12.16
[MYSQL] 상태 확인  (0) 2010.11.01
[MYSQL] SQLDUMP  (0) 2010.10.28
[MYSQL] DB 생성 및 계정 설정  (0) 2010.10.28
Posted by 나랑살자
,