Channel Version Revision Published Runs on
latest/stable 34 34 26 Jul 2021
Ubuntu 20.04 Ubuntu 19.10 Ubuntu 19.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/candidate 34 34 26 Jul 2021
Ubuntu 20.04 Ubuntu 19.10 Ubuntu 19.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
juju deploy memcached
Show information
You will need Juju 2.9 to be able to run this command. Learn how to upgrade to Juju 2.9.


16.04 14.04 18.04 19.04 19.10 20.04


A high-performance memory object caching system Read more

Relevant links

Discuss this charm

Share your thoughts on this charm with the community on discourse.

Join the discussion


Memcached is a Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.


You can deploy a memcached instance with

juju deploy memcached

Memcached listens to port 11211 on the internal network, it is not recommended to expose memcached directly to the open internet. If you want to check that it has deployed correctly you can ssh into the unit and then check the port by hand:

juju status memcached
juju ssh memcached/3
echo "stats settings" | nc localhost 11211

The "3" in this case is an example, the juju status memcached will show you which machine number the service is running on so you can juju ssh to it.


The charm uses the repcached patch ( ), this patch has some limitations, as the ability to just replicate between 2 nodes.

For enabling replication create a config.yaml file with the following content:

    repcached: True

Then deploy a maximum of 2 units of memcached:

juju deploy -n 2 config.yaml memcached

Caution : As per design limitations, If you try to add another unit of memcached, all the units will be set as standalone you decide to disable repcached by using juju set memcached repcached=false and re-deploy the unit.

Or you can deploy 2 units and then enable replication by running juju deploy -n 2 memcached juju set memcached repcached=true

Removing a unit

Removing one of the cluster units, means remove replication, please disable replication first and then remove the unit safely.

juju set memcached repcached=false
juju remove-unit memcached/0
Removing replication

For turning the replication support off on memcached, you need to run the following command:

juju set memcached repcached=false

Example Usage

This charm can be used with other charms, in particular make note of these possible relations

To use memcached with the Rails charm follow these instructions

Scale out Usage

You can

juju add-unit memcached

To add more units. Memcached doesn't share load, it's very simple and the clients have the intelligence to know which server to pick.

Nagios Monitoring

To use this charm with nrpe (assuming you want to use the nrpe-external-master relation):

juju deploy memcached
juju deploy nrpe
juju add-relation memcached:nrpe-external-master nrpe:nrpe-external-master

For more details see the nrpe charm.

Known Limitations and Issues

Juju Network Space support

The charm supports Juju network space bindings on its interfaces. This is activated in Juju 2.0+ by either using a --bind during a deploy, or using --constraints. If an interface is not bound to a space then the charm falls back to the default behaviour of using the unit's private address.

The following network space strings are used in the charm to support binding to specific interfaces:

  • 'cluster' for the interface: memcached-replication
  • 'cache' for the interface: memcache
  • 'munin' for the interface: munin-node
  • 'monitors' for the interface: monitors
  • 'nrpe-external-master' for the interface: nrpe-external-master

Thus, for a Juju network space called 'memcache-space', the binding would be

juju ... --bind='cache:memcache-space' ...

Juju 1.25.x continues to use the private address of the unit.


Standard configuration options are provided, we recommend scanning the Memcached documentation before tweaking the default configuration.

Contact Information