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.
This charm supports data replication and provides both the master and the
- databases ›
Redis (http://redis.io) is an open source, advanced key-value cache and
store. It is often referred to as a data structure server since keys can
contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.
In order to achieve its outstanding performance, Redis works with an in-memory
dataset that can be written to disk. Redis also supports master-slave
Redis can be configured in a master or slave configuration. This charm
provides a single stand alone implementation of Redis software supporting the
master-slave relationship. Go to the Redis web pages for more information on
To deploy this charm first bootstrap your Juju environment and issue the
juju deploy redis
Expose the master if you need to contact them for some reason.
juju expose redis
Redis can be set up with master-slave replication in Juju. This allows the
Redis slave to be an exact copy of master server. A master can have multiple
To set up a master-slave scenario, deploy two services using this charm, one
for the master and one the slave server, then relate the two.
juju deploy redis redis1 juju deploy redis redis2 juju add-relation redis1:master redis2:slave
Connecting to the charm
The charm provides a
db relation for services wanting to connect to the Redis
service. When the relation established the following data is passed to the
hostname: the Redis server host name;
port: the port the Redis server is listening to;
password: the optional authentication password, or an empty string if no authentication is required.
To test if Redis software is functioning properly, telnet to the Redis private
ip address using port 6379. First you need to retrieve the private address of
the Redis instance, then you can use
juju ssh to connect to that address,
juju ssh redis/0 telnet `juju run --unit redis/0 "unit-get private-address"` 6379
You can also install the redis-tools package
apt-get install redis-tools
and connect using the Redis client command:
From there you can issue Redis commands to test
that Redis is working as intended.
Development and automated testing.
To create a development environment, obtain a copy of the sources, run
make sysdeps to install the required system packages and then
make to set
up the development virtual environment. At this point, it is possible to run
unit and functional tests, including lint checks, by executing
make deploy to deploy the local copy of the charm for development
purposes on your already bootstrapped environment.
make help for further information about available make targets.
- (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 log file name.
- (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) Require clients to issue AUTH <PASSWORD> before processing any other commands.
- (int) Accept connections on the specified port.
- (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).