标签:
主备复制配置
1,主备创建账号
GRANT REPLICATION SLAVE,REPLICATION CLIENT ON *.*
TO rep@’172.16.0.%’ IDENTIFIED BY ‘rep’;
2,配置主库
My.cnf
log_bin=mysql-bin
server_id=10
innodb_flush_log_at_trx_commit=1
sync_binlog=1
3,配置从库
log_bin=mysql-bin
server_id=2
relay_log = /var/lib/mysql/mysql-relay-bin
log_slave_updates = 1
read_only =1
sync_master_info=1
sync_relay_log=1
sync_relay_log_info=1
skip-host-cache
skip-name-resolve
slave_net_timeout=30 //主备未发现连接断开超时时间
slave_skip_errors=1062
mysql中执行
CHANGE MASTER TO MASTER_HOST=’172.16.0.129’,
MASTER_USER=’rep’,
MASTER_PASSWORD=’rep’,
MASTER_LOG_FILE=’mysql-bin.000001’,
MASTER_LOG_POS=0;
Start slave
Show slave status\G;
4,备库提升方法
STOP SLAVE
CHANGE MASTER TO MASTER_HOST=’’,
RESET SLAVE
标签:
原文地址:http://www.cnblogs.com/rspb/p/4435273.html