SSDB基础6

2022-04-23 18:52:51 浏览数 (1)

config on h102

代码语言:javascript复制
[root@h102 ssdb]# grep -v "#" /etc/ssdb/ssdb1234.conf 
work_dir = /data/ssdb/ssdb1234
pidfile = /data/ssdb/ssdb1234/ssdb.pid

server:
	port: 1234
	ip: 0.0.0.0
	deny: all
	allow: 127.0.0.1
	allow: 192.168

replication:
	binlog: yes
	sync_speed: -1
	slaveof:
		id: svc_h101_1
		type: mirror
		host: h101
		port: 1234

logger:
	level: debug
	output: /data/ssdb/ssdb1234/log.txt
	rotate:
		size: 1000000000

leveldb:
	cache_size: 500
	block_size: 32
	write_buffer_size: 64
	compaction_speed: 1000
	compression: yes
[root@h102 ssdb]# 

Note: 注意以下几点

  • 1 . 注意防火墙的影响
  • 2 . slaveof.idmaster的id ,这是从 slave角度来看的, 不要在 master 上配置它自己的id.
  • 3 . 对于新版本(1.9.2 ), slaveof.ip 改成了 slaveof.host 用来指定 master 的主机名(域名)
  • 4 . type设定为 mirror ,默认情况下是sync

分别启动服务

代码语言:javascript复制
[root@h101 ~]# /usr/local/ssdb/ssdb-server -d /etc/ssdb/ssdb1234.conf
ssdb-server 1.9.2
Copyright (c) 2012-2015 ssdb.io

[root@h101 ~]# 
----------
[root@h102 ~]# /usr/local/ssdb/ssdb-server -d /etc/ssdb/ssdb1234.conf
ssdb-server 1.9.2
Copyright (c) 2012-2015 ssdb.io

[root@h102 ~]#

分别查看状态

代码语言:javascript复制
ssdb h101:1234> info 
version
	1.9.2
links
	1
total_calls
	10
dbsize
	240
binlogs
	    capacity : 20000000
	    min_seq  : 1
	    max_seq  : 7
replication
	client 192.168.100.102:38671
	    type     : mirror
	    status   : SYNC
	    last_seq : 7
replication
	slaveof h102:1234
	    id         : svc_h102_1
	    type       : mirror
	    status     : SYNC
	    last_seq   : 9
	    copy_count : 0
	    sync_count : 4
serv_key_range
	    kv  : "" - ""
	    hash: "" - ""
	    zset: "" - ""
	    list: "" - ""
data_key_range
	    kv  : "1" - "z"
	    hash: "" - ""
	    zset: "" - ""
	    list: "" - ""
leveldb.stats
	                               Compactions
	Level  Files Size(MB) Time(sec) Read(MB) Write(MB)
	--------------------------------------------------
	  0        1        0         0        0         0
	
21 result(s) (0.001 sec)
ssdb h101:1234> 
----------
ssdb h102:1234> info 
version
	1.9.2
links
	1
total_calls
	12
dbsize
	234
binlogs
	    capacity : 20000000
	    min_seq  : 3
	    max_seq  : 9
replication
	client 192.168.100.101:43355
	    type     : mirror
	    status   : SYNC
	    last_seq : 9
replication
	slaveof h101:1234
	    id         : svc_h101_1
	    type       : mirror
	    status     : SYNC
	    last_seq   : 7
	    copy_count : 0
	    sync_count : 1
serv_key_range
	    kv  : "" - ""
	    hash: "" - ""
	    zset: "" - ""
	    list: "" - ""
data_key_range
	    kv  : "1" - "z"
	    hash: "" - ""
	    zset: "" - ""
	    list: "" - ""
leveldb.stats
	                               Compactions
	Level  Files Size(MB) Time(sec) Read(MB) Write(MB)
	--------------------------------------------------
	  1        1        0         0        0         0
	
21 result(s) (0.001 sec)
ssdb h102:1234> 

0 人点赞