mysql du-master配置

db-server1 my.cnf

log_bin = mysql-bin
binlog_format = mixed
server_id = 1

read-only = 0
#binlog-do-db = db_name
#binlog-ignore-db = mysql
auto_increment_increment=2
auto_increment offset=1

#replicate-do-db = db_name
#replicate-ignore-db = mysql
relay_log = mysqld-relay-bin
log-slave-updates = ON

db-server2 my.cnf

log_bin = mysql-bin
binlog_format = mixed
server_id = 2

read-only = 0
auto_increment_increment=2
auto_increment offset=1

relay_log = mysqld-relay-bin
log-slave-updates = ON

 

新配置的话,开启复制步骤:
1) server1上执行,show master status\G,记下binlog名字和位置
2) server2上执行:
change master to
master_host='x.x.x.x',
master_port=3306,
master_user='xxx',
master_password='xxx',
master_log_file='log.xxxxxx',
master_log_pos=xxx;
代入步骤1记下的内容
3) server2上执行 start slave;
4)反过来再做一遍,从server2上show master status\G 。。。直到在server1上执行 start slave;
5)检查,两边都执行show slave status\G 看看有没有错误信息,没就成功了

 

你可能感兴趣的:(master)