3
、在
slave
服务器连接
master
登陆
slave
的
mysql
库
mysql> change master to master_host='192.168.111.135',
-> master_user='repl',
-> master_password='Repl_123456',
-> master_log_)le='mysql01-bin.000001',
-> master_log_pos=154;
注:第
1
行,
master
的
IP
地址;
第
2
、
3
行,
master
上建置的同步用户及密码;
第
4
、
5
行,
master
上的
binlog
的文件及位置。
4
、开启
slave
start slave
5
、查看同步状态
show slave status\G
6
、设定
slave
只读
set global super_read_only=on;
set global read_only=on;
三、其他注意事项
1
、
binlog
的相关参数
binlog_ignore_db=informa(on-schema --
不同步的数据库
binlog-do-db=test --
只需要同步的数据库
expire_logs_days=7 --
超过
7
天的日志删除
max_binlog_size=50M --binary log
的最大值
binlog_cache_size=1M --
缓存多少
binlog
max_binlog_cache_size --
最大缓存多少
binlog
sync_binlog=0 --
这个值控制
cache
的数据
commit
多少次才刷到磁盘上。默认是
0
,也就是让数据库自己决定同步的频率。如设置成
1
的话,则每
commit
一次就会将
cache
的数据同步到磁盘上,这样做最安全,但是性能最差。
2
、复制分类
组复制(其他方式)、异步复制、半同步复制(需要安装插件)
文档被以下合辑收录
评论