首页 > 代码库 > ssdb双主同步

ssdb双主同步

配合lvs的ha模式,lvs的ha模式可以参考这里

 

ssdb主机:

192.168.1.104192.168.1.108

 

修改ssdb.conf

104主机

# ssdb-server config# MUST indent by TAB!# relative to path of this file, directory must existswork_dir = ./varpidfile = ./var/ssdb.pidserver:    #ip: 127.0.0.1    port: 11111    # bind to public ip    ip: 0.0.0.0    # format: allow|deny: all|ip_prefix    # multiple allows or denys is supported    #deny: all    #allow: 127.0.0.1    #allow: 192.168replication:    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: mirror        ip: 192.168.1.108        port: 11111logger:    level: debug    output: log.txt    rotate:        size: 1000000000leveldb:    # in MB    cache_size: 500    # in KB    block_size: 32    # in MB    write_buffer_size: 64    # in MB    compaction_speed: 1000    # yes|no    compression: no

 

108同上

# ssdb-server config# MUST indent by TAB!# relative to path of this file, directory must existswork_dir = ./varpidfile = ./var/ssdb.pidserver:    #ip: 127.0.0.1    port: 11111    # bind to public ip    ip: 0.0.0.0    # format: allow|deny: all|ip_prefix    # multiple allows or denys is supported    #deny: all    #allow: 127.0.0.1    #allow: 192.168replication:    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: mirror        ip: 192.168.1.104        port: 11111logger:    level: debug    output: log.txt    rotate:        size: 1000000000leveldb:    # in MB    cache_size: 500    # in KB    block_size: 32    # in MB    write_buffer_size: 64    # in MB    compaction_speed: 1000    # yes|no    compression: no

外面的客户端直接连接vip,端口11111,读写即可。

 

在rs主机上用ssdb-cli 11111进入管理shell,直接get查看数据即可。

 

------------------------------------------------------------------------------------------------------------

附ssdb关闭的命令

kill `cat ~/var/ssdb.pid`

注意,cat之前的不是单引号,是esc按键