Mysql 环形复制
2013-12-19 09:39
363 查看
三台主机: 192.168.0.205, 192.168.0.206,192.168.0.207
配置192.168.0.205
1.edit /etc/mysql/my.cnf
[mysqld]
log-bin=mysql-bin
server-id=5
binlog-do-db=test
binlog-ignore-db=information_schema,performance_schema,mysql
replicate-do-db=test
replicate-ignore-db=information_schema,performance_schema,mysql
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=3
auto_increment_offset=1
2.sudo service mysql restart
3.create user 'repl'@'%' identified by 'slavepass'; grant replication slave on *.* to 'repl'@'%';
4.show master status\G;
File: mysql-bin.000003
Position: 4049
配置192.168.0.206
1.edit /etc/mysql/my.cnf
[mysqld]
log-bin=mysql-bin
server-id=5
binlog-do-db=test
binlog-ignore-db=information_schema,performance_schema,mysql
replicate-do-db=test
replicate-ignore-db=information_schema,performance_schema,mysql
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=3
auto_increment_offset=2
2.sudo service mysql restart
3.create user 'repl'@'%' identified by 'slavepass'; grant replication slave on *.* to 'repl'@'%';
4. execute mysql scripts:
1) stop slave;
2) change master to master_host='192.168.0.205', master_user='repl', master_password='slavepass', master_log_file='mysql-bin.000003', master_log_pos=4049;
3) start slave;
5.show master status\G;
File: mysql-bin.000001
Position: 1142
配置192.168.0.207
1.edit /etc/mysql/my.cnf
[mysqld]
log-bin=mysql-bin
server-id=5
binlog-do-db=test
binlog-ignore-db=information_schema,performance_schema,mysql
replicate-do-db=test
replicate-ignore-db=information_schema,performance_schema,mysql
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=3
auto_increment_offset=3
2.sudo service mysql restart
3.create user 'repl'@'%' identified by 'slavepass'; grant replication slave on *.* to 'repl'@'%';
4. execute mysql scripts:
1) stop slave;
2) change master to master_host='192.168.0.206', master_user='repl', master_password='slavepass', master_log_file='mysql-bin.000001', master_log_pos=1142;
3) start slave;
5.show master status\G;
File: mysql-bin.000002
Position: 1234
配置192.168.0.205
1. execute mysql scripts:
1) stop slave;
2) change master to master_host='192.168.0.207', master_user='repl', master_password='slavepass', master_log_file='mysql-bin.000002', master_log_pos=1234;
3) start slave;
配置192.168.0.205
1.edit /etc/mysql/my.cnf
[mysqld]
log-bin=mysql-bin
server-id=5
binlog-do-db=test
binlog-ignore-db=information_schema,performance_schema,mysql
replicate-do-db=test
replicate-ignore-db=information_schema,performance_schema,mysql
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=3
auto_increment_offset=1
2.sudo service mysql restart
3.create user 'repl'@'%' identified by 'slavepass'; grant replication slave on *.* to 'repl'@'%';
4.show master status\G;
File: mysql-bin.000003
Position: 4049
配置192.168.0.206
1.edit /etc/mysql/my.cnf
[mysqld]
log-bin=mysql-bin
server-id=5
binlog-do-db=test
binlog-ignore-db=information_schema,performance_schema,mysql
replicate-do-db=test
replicate-ignore-db=information_schema,performance_schema,mysql
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=3
auto_increment_offset=2
2.sudo service mysql restart
3.create user 'repl'@'%' identified by 'slavepass'; grant replication slave on *.* to 'repl'@'%';
4. execute mysql scripts:
1) stop slave;
2) change master to master_host='192.168.0.205', master_user='repl', master_password='slavepass', master_log_file='mysql-bin.000003', master_log_pos=4049;
3) start slave;
5.show master status\G;
File: mysql-bin.000001
Position: 1142
配置192.168.0.207
1.edit /etc/mysql/my.cnf
[mysqld]
log-bin=mysql-bin
server-id=5
binlog-do-db=test
binlog-ignore-db=information_schema,performance_schema,mysql
replicate-do-db=test
replicate-ignore-db=information_schema,performance_schema,mysql
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=3
auto_increment_offset=3
2.sudo service mysql restart
3.create user 'repl'@'%' identified by 'slavepass'; grant replication slave on *.* to 'repl'@'%';
4. execute mysql scripts:
1) stop slave;
2) change master to master_host='192.168.0.206', master_user='repl', master_password='slavepass', master_log_file='mysql-bin.000001', master_log_pos=1142;
3) start slave;
5.show master status\G;
File: mysql-bin.000002
Position: 1234
配置192.168.0.205
1. execute mysql scripts:
1) stop slave;
2) change master to master_host='192.168.0.207', master_user='repl', master_password='slavepass', master_log_file='mysql-bin.000002', master_log_pos=1234;
3) start slave;
相关文章推荐
- M M M 的MYSQL 环形复制
- mysql主从、主主复制架构
- mysql 架构篇系列 3 复制运行状态监控与选项参数说明
- mysql主从复制监控shell脚本
- MySQL主从复制配置
- MYSQL复制的几种模式
- MySQL主从复制资料汇总
- MySQL复制表结构和内容到另一张表中的SQL语句
- Mysql 5.5 主从数据复制(Master-Slave Replication)配置笔记
- MySQL5.6主从复制的配置(CentOS-6.6+MySQL-5.6)(二)
- MySQL主从复制,双机热备实战
- mysql 主从复制,读写分离
- MySql的几种数据复制模式介绍
- mysql 5.6复制新特性下主从复制配置[基于GTID]
- mysql主从复制,半同步,主主复制架构的实现
- MySQL主从复制(Master-Slave)与读写分离(MySQL-Proxy)实践
- mysql主从复制配置
- mysql5.6基于主从复制的mmm高可用架构详解
- MYSQL复制源文件 丢失问题解决, innoDB 类型转换为 MyISAM
- mysql-5.6.x半同步复制配置