Notice
Important
max open files
, refer to [1] and [2]. Or you will see error messages like Too many open files
in log.txt, or Connection reset by peer
on client side.
PS: Use c1000k to test how many concurrent connections your system supports.
server:
ip: 127.0.0.1
port: 8888
The default configuration listen to the 127.0.0.1
local loopback network interface, so other machine will not be able to connect to that ssdb server. If you want to connect to ssdb server from other machine, change 127.0.0.1
to 0.0.0.0
.
Meanwhile, specify with deny, allow
instructions to only allow connections from reliable IP.
WARNING!
0.0.0.0
without network restriction is often a security issue, any one can access to your data! You can use iptables as well.
server:
readonly: yes|no
SSDB server can be configured as readonly mode, if SSDB is running in readonly mode, any write operation command will be rejected by the server:
ssdb 127.0.0.1:8888> set a 2
client_error: Forbidden Command: set
(0.000 sec)
The default option is not set, that is SSDB server works in readwrite mode.
See also Log Analytics.
logger.level
Log LevelsThe log levels are: debug, info, warn, error, fatal
.
Generally, I recommend you set logger.level
to debug
.
logger.output
Log Output DestinationCan be relative path or absolute path, if relative path is set, it is relative to the directory of the ssdb.conf file.
If you want to write logs to console, edit ssdb.conf, modify
logger:
output: log.txt
to
logger:
output: stdout
logger.rorate.size
Logrotate and CleanupSets the max size of log file in bytes. Log files will be cut into 1000MB size files, the names are in the form of: log.txt.20150723-230422
.
The rotated files will not be deleted automatically, you need to write a crontab script to deleted unused files yourself.
leveldb.cache_size
Max memory usage for caching data, in MBSet this item to a large number will normally give better performance, usually half of the physical memory. If your server has less memory, set it to a smaller number, the minimum number is 16.
leveldb.block_size
Don't bother with this number
leveldb.write_buffer_size
Write buffer size, in MB
If your server has less memory, set it to a smaller number, vice verse. It should be between [4, 128]
;
leveldb.compaction_speed
Normally, you should not change this. If you have a slower disk and most of your data will never be updated and new data barely be inserted, set it to a smaller number(better to be greater than 50).
leveldb.compression
Compress data before they are written to diskYou SHOULD let it be yes
! Normally you will be able to store 10 times disk space of data, and have better performance, if you set it to yes
.
A ssdb-server may temporarily(only last for short time) consume up to this many memory(in MB):
cache_size + write_buffer_size * 66 + 32
This is for compression
is set to no
, if compression
is set to yes
, it would be:
cache_size + 10 * write_buffer_size * 66 + 32
You can tune the configuration to limit the memory usage of a ssdb-server instance.
Users reported that with default configuration, the memory usage is about 1GB, you can refer to this.
Sorry, you cannot set the maximum memory usage of SSDB. SSDB may use memory according to these facts:
cache_size
configuration, the most important fact.cache_size
is what you can control, but you can not control others. With a SSDB instance running on a 16G physical memory machine, you set cache_size
to 8000(8G), then you may find the process ssdb-server may use 12G RES memory with top command. If the instance is very busy, it may use 15G RES memory as well.