wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip
unzip master
cd ssdb-master
make
# 将安装在 /usr/local/ssdb 目录下
sudo make install
# 启动主库
./ssdb-server ssdb.conf
# 或者启动为后台进程
./ssdb-server -d ssdb.conf
# 启动 ssdb 命令行客户端
./tools/ssdb-cli -p 8888
# 停止 ssdb-server
./ssdb-server ssdb.conf -s stop
# 对于旧版本
kill `cat ./var/ssdb.pid`
ssdb.conf
work_dir = ./var
pidfile = ./var/ssdb.pid
server:
ip: 127.0.0.1
port: 8888
# 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.168
# auth password must be at least 32 characters
#auth: very-strong-password
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
logger:
level: debug
# 支持的日志级别有:
debug, warn, error, fatal
.
output: log.txt
rotate:
size: 1000000000
leveldb:
# in MB
cache_size: 500
# in KB
block_size: 32
# in MB
write_buffer_size: 64
# in MB
compaction_speed: 1000
# yes|no
compression: yes
一个 ssdb-server 实例占用的内存瞬时(有可能, 而且即使达到, 也只是持续短时间)最高达到(MB):
cache_size + write_buffer_size * 66 + 32
压缩选项没有开启的情况, 如果 compression: yes, 计算公式是:
cache_size + 10 * write_buffer_size * 66 + 32
调整配置参数, 限制 ssdb-server 的内存占用