SSDB command line tool ssdb-cli
SSDB command line toolssdb-cli
is very useful for SSDB management. You can use it to execute all commands and monitor the status of the service. , clear the entire database, etc.
Connect to the SSDB server
$ /usr/local/ssdb/ssdb-cli -h 127.0.0.1 -p 8888
ssdb (cli) - ssdb command line tool.
Copyright (c) 2012-2013 ideawu.com
'h' or 'help' for help, 'q' to quit.
ssdb 127.0.0.1:8888>
Enter 'h', and then press Enter
to view the help information. The following is a demonstration of the operation:
ssdb 127.0.0.1:8888> set k 1ok(0.000 sec)ssdb 127.0.0.1:8888> get k1 (0.000 sec)ssdb 127.0.0.1:8888> del kok(0.000 sec)ssdb 127.0.0.1:8888> get kerror: not_found(0.000 sec)ssdb 127.0.0.1:8888>
For Windows users:
When running in the ssdb-master source code directory,
tools\ssdb-cli.bat
requires Python 2 to be installed. x, at the same time, you need to add the Python directory to the Path variable in the environment variable.
Escape Chinese and binary data in the response
If you find garbled characters or If the screen output is abnormal, you can copy the following line of command into ssdb-cli and press Enter
key:
: escape
Monitor the status of SSDB instance
info
Commandinfo
displays the distribution of data in SSDB and the health of LevelDB.
ssdb 127.0.0.1:8899> infoversion 1.8.0links 1total_calls 4dbsize 1829binlogs capacity : 10000000 min_seq : 1 max_seq : 74replication client 127.0.0.1:55479 type : sync status : SYNC last_seq : 73replication slaveof 127.0.0.1:8888 id : svc_2 type : sync status : SYNC last_seq : 73 copy_count : 0 sync_count : 44leveldb.stats CompactionsLevel Files Size(MB) Time(sec) Read(MB) Write(MB)0 0 0 0 0 0 1 1 0 0 0 0
25 result(s) (0.001 sec)
links
Number of connections to the current server.
dbsize
DatabaseEstimated size (may be very different from hard disk usage), number of bytes. If the server has compression turned on, this size is the compressed size.
binlogs
- See Synchronization and Replication
replication
- See Synchronization and Copy
key_range.
Keys of different data types are sorted in SSDB, so this information represents the minimum key and maximum key of different data types.
leveldb.stats
This information shows the number of files and the total size of files at each level of LevelDB. The smaller the level, the fewer files, the healthier the database (query Faster).
info cmd
ssdb 127.0.0.1:8899> info cmdversion 1.6.7cmd.get calls: 20000 time_wait: 27 time_proc: 472cmd.set calls: 267045 time_wait: 7431 time_proc: 7573cmd.setx calls: 111100 time_wait: 3663 time_proc: 6456cmd.del calls: 0 time_wait: 0 time_proc: 0
cmd.
- calls: How many times has this command been processed in total.
- time_wait: The total time the command waits before being processed (in milliseconds).
- time_proc: The total time spent in command processing (in milliseconds).
compact
This command forces the SSDB server to compact the data. After compaction, the operation will usually become faster.
However, the process of compact
may slow down normal services , especially when the database is relatively large. Therefore, it is recommended to use it when you are free.
SSDB graphical interface tool
You can try the graphical interface (GUI) SSDB management tool:
- phpssdbadmin - SSDB GUI management tool developed in PHP, similar to phpmyadmin.
- FastoNoSQL - Cross-platform SSDB, Redis, Memcached GUI management tool.