Module to provide redis functionality to Salt
New in version 2014.7.0.
configuration: | This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: |
---|
redis.host: 'localhost'
redis.port: 6379
redis.db: 0
redis.password: None
Asynchronously rewrite the append-only file
CLI Example:
salt '*' redis.bgrewriteaof
Asynchronously save the dataset to disk
CLI Example:
salt '*' redis.bgsave
Get redis server configuration values
CLI Example:
salt '*' redis.config_get
salt '*' redis.config_get port
Set redis server configuration values
CLI Example:
salt '*' redis.config_set masterauth luv_kittens
Return the number of keys in the selected database
CLI Example:
salt '*' redis.dbsize
Deletes the keys from redis, returns number of keys deleted
CLI Example:
salt '*' redis.delete foo
Return true if the key exists in redis
CLI Example:
salt '*' redis.exists foo
Set a keys time to live in seconds
CLI Example:
salt '*' redis.expire foo 300
Set a keys expire at given UNIX time
CLI Example:
salt '*' redis.expireat foo 1400000000
Remove all keys from all databases
CLI Example:
salt '*' redis.flushall
Remove all keys from the selected database
CLI Example:
salt '*' redis.flushdb
Get redis key value
CLI Example:
salt '*' redis.get_key foo
Get specific field value from a redis hash, returns dict
CLI Example:
salt '*' redis.hget foo_hash bar_field
Get all fields and values from a redis hash, returns dict
CLI Example:
salt '*' redis.hgetall foo_hash
Get information and statistics about the server
CLI Example:
salt '*' redis.info
Get redis key type
CLI Example:
salt '*' redis.type foo
Get redis keys, supports glob style patterns
CLI Example:
salt '*' redis.keys
salt '*' redis.keys test*
Get the UNIX time in seconds of the last successful save to disk
CLI Example:
salt '*' redis.lastsave
Get the length of a list in Redis
CLI Example:
salt '*' redis.llen foo_list
Get a range of values from a list in Redis
CLI Example:
salt '*' redis.lrange foo_list 0 10
Ping the server, returns False on connection errors
CLI Example:
salt '*' redis.ping
Synchronously save the dataset to disk
CLI Example:
salt '*' redis.save
Set redis key value
CLI Example:
salt '*' redis.set_key foo bar
Synchronously save the dataset to disk and then shut down the server
CLI Example:
salt '*' redis.shutdown
Make the server a slave of another instance, or promote it as master
CLI Example:
# Become slave of redis-n01.example.com:6379
salt '*' redis.slaveof redis-n01.example.com 6379
salt '*' redis.slaveof redis-n01.example.com
# Become master
salt '*' redis.slaveof
Get members in a Redis set
CLI Example:
salt '*' redis.smembers foo_set
Return the current server UNIX time in seconds
CLI Example:
salt '*' redis.time
Get the length of a sorted set in Redis
CLI Example:
salt '*' redis.zcard foo_sorted
Get a range of values from a sorted set in Redis by index
CLI Example:
salt '*' redis.zrange foo_sorted 0 10
Docs for previous releases are available on salt.rtfd.org.
Latest Salt release: 2014.7.1
Upcoming SaltStack events, webinars and local meet ups and user groups.