1、配置:
master:
只需在replication中把binlog打开即可,其它不需要配置
replication:
binlog: yes
# Limit sync speed to *MB/s, -1: no limit
sync_speed: -1
slaveof:
# to identify a master even if it moved(ip, port changed)
# if set to empty or not defined, ip:port will be used.
#id: svc_2
# sync|mirror, default is sync
#type: sync
#ip: 127.0.0.1
#port: 8889
slave:
replication:
binlog: yes
# Limit sync speed to *MB/s, -1: no limit
sync_speed: -1
slaveof:
# to identify a master even if it moved(ip, port changed)
# if set to empty or not defined, ip:port will be used.
id: svc_1
# sync|mirror, default is sync
type: sync
ip: 192.168.111.19
port: 8886
1) slaveof.id任意配置即可,并且只需要在slave上配置,master上不 需要进行任何配置slaveof.ip和slaveof.port是master的ip和post
2) type必须是sync,mirror是主主配置
2、监控:控制台输入info可进行主从监控
master:
ssdb 127.0.0.1:8886> info
…
binlogs
capacity : 20000000
min_seq : 1
max_seq : 1
replication
client 192.168.111.20:55744
type : sync
status : SYNC
last_seq : 1
…
slave:
ssdb 127.0.0.1:8886> info
…
binlogs
capacity : 20000000
min_seq : 1
max_seq : 1
replication
slaveof 192.168.111.19:8886
id : svc_1
type : sync
status : SYNC
last_seq : 1
copy_count : 0
sync_count : 0
…
每一项的含义详见官方文档:http://ssdb.io/docs/zh_cn/replication.html
注意:
1) master的replication中是client,slave的replication中是slaveof
2) 主从是否同步到位,可比较binlogs.max_seq 和 replication.client.last_seq 是否相等