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', then press Enter to view the help information. The following are the operations Demonstration:

ssdb 127.0.0.1:8888> set k 1
ok
(0.000 sec)
ssdb 127.0.0.1:8888> get k
1
(0.000 sec)
ssdb 127.0.0.1:8888> del k
ok
(0.000 sec)
ssdb 127.0.0.1:8888> get k
error: 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.x to be installed, and 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 abnormal screen output after executing the command , 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> info
version
    1.8.0
links
    1
total_calls
    4
dbsize
    1829
binlogs
    capacity : 10000000
    min_seq  : 1
    max_seq  : 74
replication
    client 127.0.0.1:55479
        type     : sync
        status   : SYNC
        last_seq : 73
replication
    slaveof 127.0.0.1:8888
        id         : svc_2
        type       : sync
        status     : SYNC
        last_seq   : 73
        copy_count : 0
        sync_count : 44
leveldb.stats
                     Compactions

Level  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

The number of connections to the current server.

dbsize

DatabaseEstimated size of (may be very different from the hard disk usage ), number of bytes. If the server has compression turned on, this size is the compressed size.

binlogs

replication

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 (the query is faster).

info cmd

ssdb 127.0.0.1:8899> info cmd
version
    1.6.7
cmd.get
    calls: 20000    time_wait: 27   time_proc: 472
cmd.set
    calls: 267045   time_wait: 7431 time_proc: 7573
cmd.setx
    calls: 111100   time_wait: 3663 time_proc: 6456
cmd.del
    calls: 0    time_wait: 0    time_proc: 0

cmd.

  • calls: The total number of times the command has been processed.
  • time_wait: The total time the command waits before being processed (in milliseconds).
  • time_proc: The total time consumed 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 compact process may slow down the normal service, especially when the database is large. Therefore, it is recommended to use it when idle.

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 .