~canonical-sysadmins/charms/trusty/memcached/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Overview

[Memcached](http://memcached.org) 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.

# Usage

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.

# Replication

The charm uses the repcached patch ( http://repcached.lab.klab.org/ ), 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:
    ```yaml
    memcached:
        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](https://jujucharms.com/fullscreen/search/precise/memcached-7/?text=memcached#bws-related-charms)

To use memcached with the Rails charm follow [these instructions](https://jujucharms.com/fullscreen/search/precise/rails-1/?text=rails#bws-readme)

## 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-external-master:

    juju deploy memcached
    juju deploy local:trusty/nrpe-external-master
    juju add-relation memcached nrpe-external-master

For more details see the [nrpe-external-master charm](https://jujucharms.com/q/?text=nrpe-external-master).  Until there is a version of nrpe-external-master in trusty, you will need to use a local copy of the precise charm branched into an appropriate trusty directory.

## Known Limitations and Issues

# Configuration

Standard configuration options are provided, we recommend scanning the [Memcached documentation](https://code.google.com/p/memcached/wiki/NewConfiguringServer) before tweaking the default configuration.

# Contact Information

## Memcached

- [Memcached website](http://memcached.org)
- [Memcached bug tracker](https://code.google.com/p/memcached/issues/list)
- [Memcached mailing list](https://groups.google.com/forum/#!forum/memcached)