Redis is a key-value database in a similar vein to memcache but the
dataset is non-volatile. Redis additionally provides native support
for atomically manipulating and querying data structures such as lists
and sets. The dataset is stored entirely in memory and periodically
flushed to disk.
Leadership Layer for Juju Charms
The Leadership layer is for charm-tools and 'charm build', making it
easier for layered charms to deal with Juju leadership.
This layer will initialize charms.reactive states, allowing you to
write handlers that will be activated by these states. It allows you
to completely avoid writing leader-elected and leader-settings-changed
hooks. As a simple example, these two handlers are all that is required
to make the leader unit generate a password if it is not already set,
and have the shared password stored in a file on all units:
from charmhelpers.core.host import pwgen
write_file('/etc/foopass', leader_get('admin_password')) ```
The following states are set appropriately on startup, before any @hook
decorated methods are invoked:
This state is set when the unit is the leader. The unit will remain the leader for the remainder of the hook, but may not be leader in future hooks.
This state is set for each leadership setting (ie. the
leadership.set.foo state will be set if the leader has set
the foo leadership setting to any value). It will remain
set for the remainder of the hook, unless the unit is the leader
reactive.leadership.leader_set() and resets the value
This state is set for each leadership setting that has changed since the last hook. It will remain set for the remainder of the hook. It will not be set in the next hook, unless the leader has changed the leadership setting yet again.
One or more leadership settings has changed since the last hook. This state will remain set for the remainder of the hook. It will not be set in the next hook, unless the leader has made further changes.
charms.leadership module exposes the
leader_get() methods, which match the methods found in the
should be used instead of the charmhelpers function to ensure that
the reactive state is updated when the leadership settings are. If you
do not do this, then you risk handlers waiting on these states to not
be run on the leader (because when the leader changes settings, it
triggers leader-settings-changed hooks on the follower units but
no hooks on itself).
This layer is maintained on Launchpad by
Stuart Bishop (email@example.com).
Code is available using git at git+ssh://git.launchpad.net/layer-leadership.
Bug reports can be made at https://bugs.launchpad.net/layer-leadership.
Queries and comments can be made on the Juju mailing list, Juju IRC
channels, or at https://answers.launchpad.net/layer-leadership.
- (boolean) Enable or disable redis-cluster. This config can only be set pre-deploy.
- (int) Set the number of databases. The default database is DB 0. You can select a different one on a per-connection basis using SELECT <dbid> where dbid is a number between 0 and 'databases'-1.
- (string) Specify the Redis server verbosity level. Choices are: - debug (a lot of information, useful for development/testing); - verbose (many rarely useful info, but not a mess like the debug level); - notice (moderately verbose, what you want in production probably); - warning (only very important / critical messages are logged).
- (string) Used by the nrpe subordinate charms. A string that will be prepended to instance name to set the host name in nagios. So for instance the hostname would be something like: juju-myservice-0 If you're running multiple environments with the same services in them this allows you to differentiate between them.
- (string) A comma-separated list of nagios servicegroups. If left empty, the nagios_context will be used as the servicegroup
- (string) Require clients to issue AUTH <PASSWORD> before processing any other commands.
- (int) Accept connections on the specified port.
- (string) HTTP/HTTPS web proxy for Snappy to use when accessing the snap store.
- (string) The address of a Snap Store Proxy to use for snaps e.g. http://snap-proxy.example.com
- (string) How often snapd handles updates for installed snaps. The default (an empty string) is 4x per day. Set to "max" to check once per month based on the charm deployment date. You may also set a custom string as described in the 'refresh.timer' section here: https://forum.snapcraft.io/t/system-options/87
- (int) If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence of communication. This is useful to detect dead peers and to take the connection alive from the point of view of network quipment in the middle. The specified value is in seconds.
- (int) Close the connection after a client is idle for N seconds (0 to disable).