-
Notifications
You must be signed in to change notification settings - Fork 278
ARDB Commands
Ardb implements most Redis commands. For some reasons, some commands can not be implemented now, and a few new commands are introduced in ardb. There are also some commands that have different syntax & semantics in Ardb. The following would list all changes in ardb and differences between ardb/redis, the redis commands which not listed have same syntax & semantics in Ardb.
- AUTH
- ECHO
- PING
- QUIT
- SELECT
- APPEND
- BITCOUNT
- BITOP
- BITPOS
- DECR
- DECRBY
- GET
- GETBIT
- GETRANGE
- GETSET
- INCR
- INCRBY
- INCRBTFLOAT
- MGET
- MSET
- MSETNX
- PSETEX
- SET
- SETBIT
- SETEX
- SETNX
- SETRANGE
- STRLEN
- HDEL
- HEXISTS
- HGET
- HGETALL
- HINCRBY
- HINCRBYFLOAT
- HKEYS
- HLEN
- HMGET
- HMSET
- HSCAN
- HSET
- HSETNX
- HSTRLEN
- HVALS
- BLPOP
- BRPOP
- BRPOPLPUSH
- LINDEX
- LINSERT
- LLEN
- LPOP
- LPUSH
- LPUSHX
- LRANGE
- LREM
- LSET
- LTRIM
- RPOP
- RPOPLPUSH
- RPUSH
- RPUSHX
- SADD
- SCARD
- SDIFF
- SDIFFSTORE
- SINTER
- SINTERSTORE
- SISMEMBER
- SMEMBERS
- SMOVE
- SPOP
- SRANDMEMBER
- SREM
- SSCAN
- SUNION
- SUNIONSTORE
- BZPOPMAX
- BZPOPMIN
- ZADD
- ZCARD
- ZCOUNT
- ZINCRBY
- ZINTERSTORE
- ZLEXCOUNT
- ZPOPMAX
- ZPOPMIN
- ZRANGE
- ZRANGEBYLEX
- ZRANGEBYSCORE
- ZRANK
- ZREM
- ZREMRANGEBYLEX
- ZREMRANGEBYRANK
- ZREMRANGEBYSCORE
- ZREVRANGE
- ZREVRANGEBYLEX
- ZREVRANGEBYSCORE
- ZREVRANK
- ZSCAN
- ZSCORE
- ZUNIONSTORE
- XADD
- XLEN
- XPENDING
- XRANGE
- XREAD
- XREADGROUP
- XREVRANGE
- GEOADD
- GEODIST
- GEOHASH
- GEOPOS
- GEORADIUS
- GEORADIUSBYMEMBER
- PFADD
- PFCOUNT
- PFMERGE
- DEL
- DUMP
- EXISTS
- EXPIRE
- EXPIREAT
- KEYS
- MIGRATE
- MOVE
- OBJECT
- PERSIST
- PEXPIRE
- PEXPIREAT
- PTTL
- RANDOMKEY
- RENAME
- RENAMENX
- RESTORE
- SCAN
- SORT
- TOUCH
- TTL
- TYPE
- UNLINK
- PSUBSCRIBE
- PUBLISH
- PUBSUB
- PUNSUBSCRIBE
- SUBSCRIBE
- UNSUBSCRIBE
- EVAL
- EVALSHA
- SCRIPT DEBUG
- SCRIPT EXISTS
- SCRIPT FLUSH
- SCRIPT KILL
- SCRIPT LOAD
- BGSAVE
- CLIENT GETNAME
- CLIENT KILL
- CLIENT LIST
- CLIENT PAUSE
- CLIENT REPLY
- CLIENT SETNAME
- CONFIG GET
- CONFIG RESETSTAT
- CONFIG REWRITE
- CONFIG SET
- DBSIZE
- FLUSHALL
- FLUSHDB
- INFO
- LASTSAVE
- SAVE
- SHUTDOWN
- SLAVEOF
- SLOWLOG
- SYNC
- TIME
- DISCARD
- EXEC
- MULTI
- UNWATCH
- WATCH
- OBJECT - would be implemented in future version
- DEBUG - would be implemented in future version
- BITFIELD - would be implemented in future version
- COMMAND - would be implemented in future version
- BGREWRITEAOF - Discard
- CLUSTER - would be implemented in future version
- READONLY - would be implemented in future version
- ROLE - would be implemented in future version
- WAIT - would be implemented in future version
Some write commands could get higher performance if we change the return value, like 'set/incr/append', so we provide 'redis-compatible-mode' in ardb.conf, which indicate that the server should follow the reply format with redis or not. The default value of 'redis-compatible-mode' is 'no'.
Some commands like 'dbsize' can NOT be implemented with local kv storage engine, for such commands, the return value have different meanings in redis and ardb.
- The db id argument can be any string not just integer.
- Return the estimate k/v pair number in storage engine.
- The value could be -1 which means server have no idea how many keys stored.
- Ardb would have some different output content.
- Save command has an argument to indicate the snapshot file format to save, default format is redis rdb.
- BGSave command has an argument to indicate the snapshot file format to save, default format is redis rdb.
- There is no any random operation in ardb, it would do read/write on same value every time.
- Set/MSet/MSetNX only work incompatible mode if 'redis-compatible-mode' set to 'no'
- Set2/MSet2/MSetNX2 is executed in incompatible mode.
- Return OK status in incompatible mode.
- Redis standard commands work incompatible mode if the storage engine support merge operation and config 'redis-compatible-mode' set to 'no'.
- Ardb extend commands work incompatible mode if the storage engine support merge operation.
- Return OK status in incompatible mode.
- Redis standard commands work incompatible mode if the storage engine support merge operation and config 'redis-compatible-mode' set to 'no'.
- Ardb extend commands work incompatible mode if the storage engine support merge operation.
- Return OK status in incompatible mode.
- HSet/HSetNX/HMSet only work incompatible mode if 'redis-compatible-mode' set to 'no'
- HSet2/HSetNX2/HMSet2 alway work in incompatible mode.
- Return OK status in incompatible mode.
- Redis standard commands work incompatible mode if the storage engine support merge operation and config 'redis-compatible-mode' set to 'no'.
- Ardb extend commands work incompatible mode if the storage engine support merge operation.
- Return OK status in incompatible mode.
- SAdd/SRem only work incompatible mode if 'redis-compatible-mode' set to 'no'
- SAdd2/SRem2 alway work in incompatible mode.
- Return OK status in incompatible mode.
- PFAdd/SRem/HMSet only work incompatible mode if 'redis-compatible-mode' set to 'no'
- PFAdd2/SRem2/HMSet2 alway work in incompatible mode.
- Return OK status in incompatible mode.
- Redis standard commands work incompatible mode if the storage engine support merge operation and config 'redis-compatible-mode' set to 'no'.
- Ardb extend commands work incompatible mode if the storage engine support merge operation.
- Return OK status in incompatible mode.
-
Syntax: SUNIONCOUNT key [key ...]
-
Return value: Integer reply: the size of the result set, or 0 if key does not exist.
-
Example
redis> sunioncount myset myset1 (integer) 2
-
Syntax: SINTERCOUNT key [key ...]
-
Return value: Integer reply: the size of the result set, or 0 if key does not exist.
-
Example
redis> sintercount myset myset1 (integer) 2
-
Syntax: SDIFFCOUNT key [key ...]
-
Return value: Integer reply: the size of the result set, or 0 if key does not exist.
-
Example
redis> sdiffcount myset myset1 (integer) 2
-
Syntax: BITOPCOUNT operation key [key ...]
-
Return value: Integer reply:The size of the bitsets opetaion result.
-
Example
redis> BITOPCOUNT AND key1 key2 (integer) 20
-
Syntax: KeysCount pattern
-
Return value: Integer reply:The number of matched keys.
-
Example
redis> keyscount * (integer) 20
CompactDB - Used to compact disk store(only work for LevlDB engine), the range is current selected DB
-
Syntax: COMPACTDB
-
Return value: Status code reply
-
Example
redis> SELECT 1 OK redis> COMAPCTDB OK
-
Syntax: COMPACTALL
-
Return value: Status code reply
-
Example
redis> COMAPCTALL OK
Import - Use to import data from backup data file, it no path specified, use <ARDB_BACKUP_DIR>/dump.ardb as the import data file
-
Syntax: IMPORT FilePath
-
Return value: Status code reply
-
Example
redis> import /tmp/data/dump.ardb OK
MigrateDB - Use to migrate data in current db to other server, only works with remote ardb instance.
-
Syntax: MigrateDB host port destination-db timeout
-
Return value: Status code reply
-
Example
redis> migratedb 127.0.0.1 16379 1 0 OK