Redis Redis command set of commands

Operation commands related to the connection

  • ping: to test whether the connection alive if the normal returns pong
  • echo: Print
  • select: Switch to the specified database, the database index number specified by the index numeric value to the index value 0 as a starting
  • quit: close the connection (Connection)
  • auth: simple password authentication

# Server-related commands

  • time: Returns the current server time
  • client list: return all client information and statistical data connection to the server see http://redisdoc.com/server/client_list.html
  • client kill ip: port: closed address ip: port terminal client
  • save: synchronize data saved to disk
  • bgsave: save data to disk asynchronously
  • Stamp return to the last successful save data to disk Unix: lastsave
  • shundown: synchronize data saved to disk, and then close Services
  • info: provides server information and statistics
  • config resetstat: reset some statistics info command
  • config get: get profile information
  • config set: dynamically adjust the configuration Redis server (configuration) without having to reboot, you can modify configuration parameters can be used to list the command CONFIG GET *
  • config rewrite: Redis server when the specified file is rewritten redis.conf
  • monitor: real-time dump request received
  • slaveof: Copy change policy settings

# Publication subscription-related commands

  • psubscribe: subscribe to one or more channels that match a given pattern such as psubscribe news * tweet *..
  • publish: transmitting information message to the specified channel channel publish msg "good morning" e.g.
  • pubsub channels: Lists the current active channel such as PUBSUB CHANNELS news.i *
  • pubsub numsub: Returns the number of subscribers to fixed channels PUBSUB NUMSUB news.it news.internet news.sport news.music example
  • Returns the sum of the number of clients subscribed to all modes: pubsub numpat
  • punsubscribe: instruct the client to unsubscribe from all the given pattern.
  • subscribe: subscribe to the information given in one or more channels. For example subscribe msg chat_room
  • unsubscribe: unsubscribe instructions given client channel.

# Command KEY operation

  • exists (key): to confirm the existence of a key
  • del (key): delete a key
  • type (key): return type
  • keys (pattern): returns to meet all the key given pattern of
  • randomkey: returns a random key space
  • keyrename (oldname, newname): Rename the key
  • dbsize: Returns the number of key current database
  • expire: Time to set a key (s) of
  • ttl: Time to get a key of
  • move (key, dbindex): Moves the current database and the key database dbindex
  • flushdb: Delete the current selection of all key database
  • flushall: Delete all all key database

# Command String operations

  • set (key, value): the name given to the database key value contains the string
  • get (key): Returns the name of the database's string of key value
  • getset (key, value): to name one of the key value given the string
  • mget (key1, key2, ..., key N): Returns the string value plurality library
  • setnx (key, value): add string, the name key, value is value
  • setex (key, time, value): add a string to the library, set expiration time
  • mset (key N, value N): Bulk setting values ​​of a plurality of string
  • msetnx (key N, value N): If all the name string key i is not present
  • incr (key): name is key string by an operator
  • incrby (key, integer): integer is the key to increase the name of the string
  • decr (key): name is key string Decrement
  • decrby (key, integer): integer is the key to reduce the name of the string
  • append (key, value): value string of the name of an additional key value
  • substr (key, start, end): Returns the name of the key value for the sub-string of the string

# Command of operations List

  • rpush (key, value): value of the added value of a key element to the tail of the list name
  • lpush (key, value): value of the added value of a key element for the head of the list name
  • llen (key): Returns the name is key length of the list
  • lrange (key, start, end): Returns the list name is key to the start element between the end
  • ltrim (key, start, end): interception list name is key
  • lindex (key, index): Returns the name is key element in list at index
  • lset (key, index, value): the name assigned to the key elements of the list in the index position
  • lrem (key, count, value): Delete key to count median value of list elements
  • lpop (key): to go back and delete the name of the first key element of the list
  • Last element back and remove the name of the list is key in: rpop (key)
  • blpop (key1, key2, ... key N, timeout): block version lpop command.
  • brpop (key1, key2, ... key N, timeout): block version of rpop.
  • rpoplpush (srckey, dstkey): Returns the name and remove the last element of the list srckey, and adds the element to the name list of the head dstkey

# Command Set operations

  • sadd (key, member): the name for the key elements of the set to add member
  • srem (key, member): delete the element member name is key set of
  • spop (key): random back and delete the name of a key element in the set
  • smove (srckey, dstkey, member): Move collection element
  • scard (key): Returns the name is key set of base
  • sismember (key, member): member whether it is the name of the key elements in this set of
  • sinter (key1, key2, ... key N): intersection of
  • sinterstore (dstkey, (keys)): and the intersection of the intersection of a set of saved to dstkey
  • sunion (key1, (keys)): find and set
  • sunionstore (dstkey, (keys)): seeking and sets and save and set to set dstkey
  • sdiff (key1, (keys)): Set differencing
  • sdiffstore (dstkey, (keys)): differencing sets and save the current difference set dstkey
  • smembers (key): Returns the name of all the elements of the set of key
  • A random element of the set key and returns the name of: srandmember (key)

# Command Hash operation

  • hset (key, field, value): the name is key hash to add elements field
  • hget (key, field): Returns the name is key corresponding to the hash value in field
  • hmget (key, (fields)): Returns the name of the field i corresponding to the hash value of the key
  • hmset (key, (fields)): add an element field for the hash key in the name
  • hincrby (key, field, integer): integer is the key to increase the name of the hash value in the field of
  • hexists (key, field): the domain name if there is a key field for the hash of the key
  • hdel (key, field): delete the name is key to the hash key field of domain
  • The number of the hash key and returns the name of elements: hlen (key)
  • hkeys (key): Returns the name is key hash of all keys
  • hvals (key): Returns the name of all of the keys corresponding to the hash value key
  • hgetall (key): Returns the name is key hash of all keys (field) and its corresponding value

#Redis Sentinel

  • ping: pong return
  • sentinel masters: the master list of all servers being monitored, and the current status of the primary server.
  • sentinel slaves: List all the given master server from the server, and the current state from the server.
  • sentinel get-master-addr-by-name: return to the IP address and port number of the primary server's given name. If the primary server is performing a failover operation, or for the primary server failover operation has been completed, then the command returns the new primary server's IP address and port number.
  • sentinel reset: Reset all the names in a given pattern, and pattern matching primary server. Glob-style pattern parameter is a mode reset operation for all the current state of apparent primary server, including executing the failover, and remove and has now been found associated, and all the server from the primary server Sentinel.
  • sentinel failover: When the primary server fails, without asking other Sentinel opinion, forced to start an automatic failover (but initiate failover Sentinel will send a new configuration to the other Sentinel, other Sentinel will be based on this configuration appropriate update).

Technology changes everything

Operation commands related to the connection

  • ping: to test whether the connection alive if the normal returns pong
  • echo: Print
  • select: Switch to the specified database, the database index number specified by the index numeric value to the index value 0 as a starting
  • quit: close the connection (Connection)
  • auth: simple password authentication

# Server-related commands

  • time: Returns the current server time
  • client list: return all client information and statistical data connection to the server see http://redisdoc.com/server/client_list.html
  • client kill ip: port: closed address ip: port terminal client
  • save: synchronize data saved to disk
  • bgsave: save data to disk asynchronously
  • Stamp return to the last successful save data to disk Unix: lastsave
  • shundown: synchronize data saved to disk, and then close Services
  • info: provides server information and statistics
  • config resetstat: reset some statistics info command
  • config get: get profile information
  • config set: dynamically adjust the configuration Redis server (configuration) without having to reboot, you can modify configuration parameters can be used to list the command CONFIG GET *
  • config rewrite: Redis server when the specified file is rewritten redis.conf
  • monitor: real-time dump request received
  • slaveof: Copy change policy settings

# Publication subscription-related commands

  • psubscribe: subscribe to one or more channels that match a given pattern such as psubscribe news * tweet *..
  • publish: transmitting information message to the specified channel channel publish msg "good morning" e.g.
  • pubsub channels: Lists the current active channel such as PUBSUB CHANNELS news.i *
  • pubsub numsub: Returns the number of subscribers to fixed channels PUBSUB NUMSUB news.it news.internet news.sport news.music example
  • Returns the sum of the number of clients subscribed to all modes: pubsub numpat
  • punsubscribe: instruct the client to unsubscribe from all the given pattern.
  • subscribe: subscribe to the information given in one or more channels. For example subscribe msg chat_room
  • unsubscribe: unsubscribe instructions given client channel.

# Command KEY operation

  • exists (key): to confirm the existence of a key
  • del (key): delete a key
  • type (key): return type
  • keys (pattern): returns to meet all the key given pattern of
  • randomkey: returns a random key space
  • keyrename (oldname, newname): Rename the key
  • dbsize: Returns the number of key current database
  • expire: Time to set a key (s) of
  • ttl: Time to get a key of
  • move (key, dbindex): Moves the current database and the key database dbindex
  • flushdb: Delete the current selection of all key database
  • flushall: Delete all all key database

# Command String operations

  • set (key, value): the name given to the database key value contains the string
  • get (key): Returns the name of the database's string of key value
  • getset (key, value): to name one of the key value given the string
  • mget (key1, key2, ..., key N): Returns the string value plurality library
  • setnx (key, value): add string, the name key, value is value
  • setex (key, time, value): add a string to the library, set expiration time
  • mset (key N, value N): Bulk setting values ​​of a plurality of string
  • msetnx (key N, value N): If all the name string key i is not present
  • incr (key): name is key string by an operator
  • incrby (key, integer): integer is the key to increase the name of the string
  • decr (key): name is key string Decrement
  • decrby (key, integer): integer is the key to reduce the name of the string
  • append (key, value): value string of the name of an additional key value
  • substr (key, start, end): Returns the name of the key value for the sub-string of the string

# Command of operations List

  • rpush (key, value): value of the added value of a key element to the tail of the list name
  • lpush (key, value): value of the added value of a key element for the head of the list name
  • llen (key): Returns the name is key length of the list
  • lrange (key, start, end): Returns the list name is key to the start element between the end
  • ltrim (key, start, end): interception list name is key
  • lindex (key, index): Returns the name is key element in list at index
  • lset (key, index, value): the name assigned to the key elements of the list in the index position
  • lrem (key, count, value): Delete key to count median value of list elements
  • lpop (key): to go back and delete the name of the first key element of the list
  • Last element back and remove the name of the list is key in: rpop (key)
  • blpop (key1, key2, ... key N, timeout): block version lpop command.
  • brpop (key1, key2, ... key N, timeout): block version of rpop.
  • rpoplpush (srckey, dstkey): Returns the name and remove the last element of the list srckey, and adds the element to the name list of the head dstkey

# Command Set operations

  • sadd (key, member): the name for the key elements of the set to add member
  • srem (key, member): delete the element member name is key set of
  • spop (key): random back and delete the name of a key element in the set
  • smove (srckey, dstkey, member): Move collection element
  • scard (key): Returns the name is key set of base
  • sismember (key, member): member whether it is the name of the key elements in this set of
  • sinter (key1, key2, ... key N): intersection of
  • sinterstore (dstkey, (keys)): and the intersection of the intersection of a set of saved to dstkey
  • sunion (key1, (keys)): find and set
  • sunionstore (dstkey, (keys)): seeking and sets and save and set to set dstkey
  • sdiff (key1, (keys)): Set differencing
  • sdiffstore (dstkey, (keys)): differencing sets and save the current difference set dstkey
  • smembers (key): Returns the name of all the elements of the set of key
  • A random element of the set key and returns the name of: srandmember (key)

# Command Hash operation

  • hset (key, field, value): the name is key hash to add elements field
  • hget (key, field): Returns the name is key corresponding to the hash value in field
  • hmget (key, (fields)): Returns the name of the field i corresponding to the hash value of the key
  • hmset (key, (fields)): add an element field for the hash key in the name
  • hincrby (key, field, integer): integer is the key to increase the name of the hash value in the field of
  • hexists (key, field): the domain name if there is a key field for the hash of the key
  • hdel (key, field): delete the name is key to the hash key field of domain
  • The number of the hash key and returns the name of elements: hlen (key)
  • hkeys (key): Returns the name is key hash of all keys
  • hvals (key): Returns the name of all of the keys corresponding to the hash value key
  • hgetall (key): Returns the name is key hash of all keys (field) and its corresponding value

#Redis Sentinel

  • ping: pong return
  • sentinel masters: the master list of all servers being monitored, and the current status of the primary server.
  • sentinel slaves: List all the given master server from the server, and the current state from the server.
  • sentinel get-master-addr-by-name: return to the IP address and port number of the primary server's given name. If the primary server is performing a failover operation, or for the primary server failover operation has been completed, then the command returns the new primary server's IP address and port number.
  • sentinel reset: Reset all the names in a given pattern, and pattern matching primary server. Glob-style pattern parameter is a mode reset operation for all the current state of apparent primary server, including executing the failover, and remove and has now been found associated, and all the server from the primary server Sentinel.
  • sentinel failover: When the primary server fails, without asking other Sentinel opinion, forced to start an automatic failover (but initiate failover Sentinel will send a new configuration to the other Sentinel, other Sentinel will be based on this configuration appropriate update).

Guess you like

Origin www.cnblogs.com/qxh-beijing2016/p/11407359.html