Skip to content
yinqiwen edited this page Jul 8, 2018 · 17 revisions

Overview

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.

Supported Commands

Connection

  • AUTH
  • ECHO
  • PING
  • QUIT
  • SELECT

String

  • APPEND
  • BITCOUNT
  • BITOP
  • BITPOS
  • DECR
  • DECRBY
  • GET
  • GETBIT
  • GETRANGE
  • GETSET
  • INCR
  • INCRBY
  • INCRBTFLOAT
  • MGET
  • MSET
  • MSETNX
  • PSETEX
  • SET
  • SETBIT
  • SETEX
  • SETNX
  • SETRANGE
  • STRLEN

Hash

  • HDEL
  • HEXISTS
  • HGET
  • HGETALL
  • HINCRBY
  • HINCRBYFLOAT
  • HKEYS
  • HLEN
  • HMGET
  • HMSET
  • HSCAN
  • HSET
  • HSETNX
  • HSTRLEN
  • HVALS

List

  • BLPOP
  • BRPOP
  • BRPOPLPUSH
  • LINDEX
  • LINSERT
  • LLEN
  • LPOP
  • LPUSH
  • LPUSHX
  • LRANGE
  • LREM
  • LSET
  • LTRIM
  • RPOP
  • RPOPLPUSH
  • RPUSH
  • RPUSHX

Set

  • SADD
  • SCARD
  • SDIFF
  • SDIFFSTORE
  • SINTER
  • SINTERSTORE
  • SISMEMBER
  • SMEMBERS
  • SMOVE
  • SPOP
  • SRANDMEMBER
  • SREM
  • SSCAN
  • SUNION
  • SUNIONSTORE

Sorted Set

  • 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

Stream

  • XADD
  • XLEN
  • XPENDING
  • XRANGE
  • XREAD
  • XREADGROUP
  • XREVRANGE

Geo

  • GEOADD
  • GEODIST
  • GEOHASH
  • GEOPOS
  • GEORADIUS
  • GEORADIUSBYMEMBER

Hyperloglog

  • PFADD
  • PFCOUNT
  • PFMERGE

Keys

  • DEL
  • DUMP
  • EXISTS
  • EXPIRE
  • EXPIREAT
  • KEYS
  • MIGRATE
  • MOVE
  • OBJECT
  • PERSIST
  • PEXPIRE
  • PEXPIREAT
  • PTTL
  • RANDOMKEY
  • RENAME
  • RENAMENX
  • RESTORE
  • SCAN
  • SORT
  • TOUCH
  • TTL
  • TYPE
  • UNLINK

Pub/Sub

  • PSUBSCRIBE
  • PUBLISH
  • PUBSUB
  • PUNSUBSCRIBE
  • SUBSCRIBE
  • UNSUBSCRIBE

Scripting

  • EVAL
  • EVALSHA
  • SCRIPT DEBUG
  • SCRIPT EXISTS
  • SCRIPT FLUSH
  • SCRIPT KILL
  • SCRIPT LOAD

Server

  • 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

Transaction

  • DISCARD
  • EXEC
  • MULTI
  • UNWATCH
  • WATCH

Unsupported commands(Compared with Redis 3.2.0)

  • 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

Incompatible Commands

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.

Select
  • The db id argument can be any string not just integer.
DBSIZE
  • 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.
INFO
  • Ardb would have some different output content.
Save [redis|ardb|backup]
  • Save command has an argument to indicate the snapshot file format to save, default format is redis rdb.
BGSave [redis|ardb|backup]
  • BGSave command has an argument to indicate the snapshot file format to save, default format is redis rdb.
RandomKey/SPop/SRandMember
  • There is no any random operation in ardb, it would do read/write on same value every time.
Set/Set2/MSet/MSet2/MSetNX/MSetNX2
  • 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.
Incr/Incr2/Incrby/Incrby2/IncrByFloat/IncrByFloat/Append/Append2
  • 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.
Decr/Decr2/Decrby/SetNX/SetNX2/SetRange/SetRange2/SetBit/SetBit2
  • 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/HSet2/HSetNX/HSetNX2/HMSet/HMSet2/HDel/HDel2
  • 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.
HIncrBy/HIncrBy2/HIncrByFloat/HIncrByFloat2
  • 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/SAdd2/SRem/SRem2
  • 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/PFAdd2
  • 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.
Expire/ExpireAt/PExpire/PExpireAt
  • 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.

New Commands

SUnionCount - Used to count the unsion result number for sets.
  • 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
    
SInterCount - Used to count the inter result number for sets.
  • 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
    
SDiffCount - Used to count the diff result number for sets.
  • 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
    
BitOPCount - Used to count the number of bits for bitset operation result.
  • Syntax: BITOPCOUNT operation key [key ...]

  • Return value: Integer reply:The size of the bitsets opetaion result.

  • Example

    redis> BITOPCOUNT AND  key1 key2
    (integer) 20
    
KeysCount - Can count matched keys number for specified pattern.
  • 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 
    
CompactAll - Used to compact disk store(only work for LevlDB engine) for all range.
  • 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 
    
Clone this wiki locally