两台机器,系统版本CentOS6.5,主机名分别是master和slave,IP地址分别是192.168.8.57和192.168.8.58
1、分别在两个节点创建复制用户
在主动节点:
grant replication slave on *.* to 'repl'@'192.168.8.58' identified by 'mysql';
在被动节点:
grant replication slave on *.* to 'repl'@'192.168.8.57' identified by 'mysql';
2、修改数据库配置文件
在主动节点添加如下配置:
server-id = 1
log-bin = /mysql/data/mysql-bin-3306
relay-log = relay-log
read-only = false
log-slave-updates
skip-slave-start
在被动节点添加如下配置:
server-id = 2
log-bin = /mysql/data/mysql-bin-3306
relay-log = relay-log
read-only = true
log-slave-updates
3、配置复制流
配置第一个复制流:
change master to
master_host='192.168.8.57',
master_port=3306,
master_user='repl',
master_password='mysql',
master_log_file='mysql-bin.000001',
master_log_pos=154,
master_connect_retry=10;
配置第二个复制流:
change master to
master_host='192.168.8.58',
master_port=3306,
master_user='repl',
master_password='mysql',
master_log_file='mysql-bin.000002',
master_log_pos=154,
master_connect_retry=10;
4、双向复制验证
相关文章
- 02-16vim 配置快捷以使复制可用
- 02-16vscode配置(复制直接用)
- 02-16heartbeat双主高可用
- 02-16mogodb 可随意复制的简单配置
- 02-16ogg同步服务配置复制和同步进程的开始文件及RBA
- 02-16流复制浅析 —— 主备切换
- 02-16双主复制配置
- 02-16OGG安装部署及数据复制配置
- 02-16OGG安装部署及数据复制配置
- 02-16RocketMQ双主双备集群搭建