# 启动为后台进程(不阻塞命令行)
./ssdb-server -d ssdb.conf
# 重启
./ssdb-server -d ./ssdb.conf -s restart
#关闭数据库
./ssdb-server ./ssdb.conf -s stop
#在SSDB服务器端更改ssdb.conf,允许所有client连接
[root@localhost ssdb]# vi ssdb.conf
server:
ip: 0.0.0.0 #允许所有client连接,默认127.0.0.1
port: 8888
#在SSDB客户端使用下面的命令连接到ssdb数据库,进行操作
cd /ssdb-master/tools
./ssdb-cli -h 10.20.1.225 -p 8888 #连接SSDB-server
ssdb 10.20.1.225:8888>info
serv_key_range
kv : "" - ""
hash: "" - ""
zset: "" - ""
list: "" - ""
data_key_range
kv : "" - ""
hash: "raw_proxy" - "useful_proxy"
zset: "" - ""
list: "" - ""
leveldb.stats
Compactions
Level Files Size(MB) Time(sec) Read(MB) Write(MB)
--------------------------------------------------
0 2 0 0 0 0
ssdb 10.20.1.225:8888> hgetall useful_proxy #查询数据类型=hash,集合名称=useful_proxy的Key-Value列表
.....
77.120.93.53:8080: 1
78.160.160.209:8080: -1
80.211.232.151:8080: 1
80.253.147.218:8080: 0
82.114.90.161:53281: 1
91.109.148.39:8080: 1
92.50.48.98:8080: 1
94.177.201.18:8080: 1
94.19.171.94:8081: 1
314 result(s) (0.030 sec) #一共314条记录,在这里key=ip:port,value=1(可用代理IP)
#导出整个数据库
ssdb 10.20.1.225:8888>export backup.ssdb
#导入整个数据库
ssdb 10.20.1.225:8888>import backup.ssdb