redis
¶
Return data to a redis server
To enable this returner the minion will need the python client for redis installed and the following values configured in the minion or master config, these are the defaults:
redis.db: '0'
redis.host: 'salt'
redis.port: 6379
redis.password: ''
Added in version 2018.3.1: Alternatively a UNIX socket can be specified by unix_socket_path:
redis.db: '0'
redis.unix_socket_path: /var/run/redis/redis.sock
Cluster Mode Example:
redis.db: '0'
redis.cluster_mode: true
redis.cluster.skip_full_coverage_check: true
redis.cluster.startup_nodes:
- host: redis-member-1
port: 6379
- host: redis-member-2
port: 6379
Alternative configuration values can be used by prefacing the configuration. Any values not found in the alternative configuration will be pulled from the default location:
alternative.redis.db: '0'
alternative.redis.host: 'salt'
alternative.redis.port: 6379
alternative.redis.password: ''
To use the redis returner, append ‘–return redis’ to the salt command.
salt '*' test.ping --return redis
To use the alternative configuration, append ‘–return_config alternative’ to the salt command.
Added in version 2015.5.0.
salt '*' test.ping --return redis --return_config alternative
To override individual configuration items, append –return_kwargs ‘{“key:”: “value”}’ to the salt command.
Added in version 2016.3.0.
salt '*' test.ping --return redis --return_kwargs '{"db": "another-salt"}'
Redis Cluster Mode Options:
- cluster_mode:
False
Whether cluster_mode is enabled or not
- cluster.startup_nodes:
A list of host, port dictionaries pointing to cluster members. At least one is required but multiple nodes are better
redis.cluster.startup_nodes - host: redis-member-1 port: 6379 - host: redis-member-2 port: 6379
- cluster.skip_full_coverage_check:
False
Some cluster providers restrict certain redis commands such as CONFIG for enhanced security. Set this option to true to skip checks that required advanced privileges.
Note
Most cloud hosted redis clusters will require this to be set to
True
- saltext.redis.returners.redis_return.__virtual__()[source]¶
The redis library must be installed for this module to work.
The redis redis cluster library must be installed if cluster_mode is True
- saltext.redis.returners.redis_return.save_load(jid, load, minions=None)[source]¶
Save the load to the specified jid
- saltext.redis.returners.redis_return.save_minions(jid, minions, syndic_id=None)[source]¶
Included for API consistency
- saltext.redis.returners.redis_return.get_load(jid)[source]¶
Return the load data that marks a specified jid
- saltext.redis.returners.redis_return.get_jid(jid)[source]¶
Return the information returned when the specified job id was executed
- saltext.redis.returners.redis_return.get_fun(fun)[source]¶
Return a dict of the last function called for all minions
- saltext.redis.returners.redis_return.get_jids()[source]¶
Return a dict mapping all job ids to job information
- saltext.redis.returners.redis_return.clean_old_jobs()[source]¶
Clean out minions’s return data for old jobs.
Normally, hset ‘ret:<jid>’ are saved with a TTL, and will eventually get cleaned by redis.But for jobs with some very late minion return, the corresponding hset’s TTL will be refreshed to a too late timestamp, we’ll do manually cleaning here.