|
1 |
| -# Module redis |
| 1 | +#redis |
2 | 2 |
|
3 |
| -This module installs and makes basic configs for multiple redis instances on the same node. |
4 |
| -It installs redis from source. (http://redis.io/) |
| 3 | +####Table of Contents |
5 | 4 |
|
6 |
| -# Tested on |
7 |
| -RHEL/CentOS/Scientific 6+/Ubuntu 12.04 |
| 5 | +1. [Overview - What is the graphite module?](#overview) |
| 6 | +2. [Setup - The basics of getting started with redis](#setup) |
| 7 | + * [Beginning with redis - Installation](#beginning-with-redis) |
| 8 | + * [Run multiple instances on same host](#run-multiple-instances-on-same-host) |
| 9 | +3. [Usage - The class and defined types available for configuration](#usage) |
| 10 | + * [Classes and Defined Types](#classes-and-defined-types) |
| 11 | + * [Class: redis::install](#class-redisinstall) |
| 12 | + * [Defined Type: redis::server](#defined-type-redisserver) |
| 13 | +4. [Limitations - OS compatibility, etc.](#limitations) |
| 14 | +5. [Contributing to the graphite module](#contributing) |
8 | 15 |
|
9 |
| -# Sample usage: |
| 16 | +##Overview |
10 | 17 |
|
11 |
| -### Running two redis instances on port 6379 and 6380 |
12 |
| -<pre> |
| 18 | +This module installs and makes basic configs for multiple redis instances on |
| 19 | +the same node. It installs redis from source. (http://redis.io/) |
| 20 | + |
| 21 | +##Setup |
| 22 | + |
| 23 | +**What redis affects:** |
| 24 | + |
| 25 | +* packages/configuration to compile and install redis from source |
| 26 | +* services/configuration files to run multiple redis |
| 27 | + |
| 28 | +###Beginning with redis |
| 29 | + |
| 30 | +To just compile and install redis binaries. As default the |
| 31 | +latest stable release will be used. |
| 32 | + |
| 33 | +```puppet |
| 34 | + class { 'redis::install': } |
| 35 | +``` |
| 36 | + |
| 37 | +To install a specific redis version use the following parameters. |
| 38 | +Most of the time you will only need `redis_version`. |
| 39 | + |
| 40 | +```puppet |
| 41 | + class { 'redis::install': |
| 42 | + redis_version => '2.8.8', |
| 43 | + redis_build_dir => '/opt', |
| 44 | + redis_install_dir => '/usr/bin' |
| 45 | + } |
| 46 | +``` |
| 47 | + |
| 48 | +###Run multiple instances on same host |
| 49 | + |
| 50 | +As example run two redis instances on port 6379 and 6380. |
| 51 | + |
| 52 | +```puppet |
13 | 53 | node "redis.my.domain" {
|
14 | 54 |
|
15 |
| - # install latest stable build. |
16 |
| - include redis::install |
17 |
| - |
18 |
| - redis::server { |
19 |
| - "instance1": |
20 |
| - redis_memory => "1g", |
21 |
| - redis_ip => "0.0.0.0", |
22 |
| - redis_port => 6379, |
23 |
| - redis_mempolicy => "allkeys-lru", |
24 |
| - redis_timeout => 0, |
25 |
| - redis_nr_dbs => 16, |
26 |
| - redis_loglevel => "notice", |
27 |
| - running => "true", |
28 |
| - enabled => "true", |
29 |
| - } |
30 |
| - |
31 |
| - redis::server { |
32 |
| - "secondRedis": |
33 |
| - redis_memory => "112m", |
34 |
| - redis_ip => "0.0.0.0", |
35 |
| - redis_port => 6380, |
36 |
| - redis_mempolicy => "allkeys-lru", |
37 |
| - redis_timeout => 0, |
38 |
| - redis_nr_dbs => 2, |
39 |
| - redis_loglevel => "info", |
40 |
| - running => "true", |
41 |
| - enabled => "true", |
42 |
| - } |
| 55 | + # install latest stable build. |
| 56 | + class { 'redis::install': } |
| 57 | +
|
| 58 | + redis::server { |
| 59 | + 'instance1': |
| 60 | + redis_memory => '1g', |
| 61 | + redis_ip => '0.0.0.0', |
| 62 | + redis_port => 6379, |
| 63 | + redis_mempolicy => 'allkeys-lru', |
| 64 | + redis_timeout => 0, |
| 65 | + redis_nr_dbs => 16, |
| 66 | + redis_loglevel => 'notice', |
| 67 | + running => true, |
| 68 | + enabled => true |
| 69 | + } |
| 70 | +
|
| 71 | + redis::server { |
| 72 | + 'secondRedis': |
| 73 | + redis_memory => '112m', |
| 74 | + redis_ip => '0.0.0.0', |
| 75 | + redis_port => 6380, |
| 76 | + redis_mempolicy => 'allkeys-lru', |
| 77 | + redis_timeout => 0, |
| 78 | + redis_nr_dbs => 2, |
| 79 | + redis_loglevel => 'info', |
| 80 | + running => true, |
| 81 | + enabled => true |
| 82 | + } |
43 | 83 | }
|
44 |
| -</pre> |
| 84 | +``` |
| 85 | + |
| 86 | +##Usage |
| 87 | + |
| 88 | +###Classes and Defined Types |
| 89 | + |
| 90 | +This module compiles and installs redis with the class `redis::install`. |
| 91 | +The redis service(s) are configured with the defined type `redis::server`. |
| 92 | + |
| 93 | +####Class: `redis::install` |
| 94 | + |
| 95 | +This class downloads, compiles and installs redis. It does not configure any |
| 96 | +redis services. This is done by defimed type redis::server. |
| 97 | + |
| 98 | +**Parameters within `redis::install`:** |
| 99 | + |
| 100 | +#####`redis_version` |
| 101 | + |
| 102 | +The redis version to be installed. |
| 103 | +By default, the latest stable build will be installed. |
| 104 | + |
| 105 | +#####`redis_build_dir` |
| 106 | + |
| 107 | +Default is '/opt/' (string) |
| 108 | +The dir to store redis source code. This will result in a |
| 109 | +directoy like '/opt/redis-2.8.8/' |
| 110 | + |
| 111 | +#####`redis_install_dir` |
| 112 | + |
| 113 | +Default is '/usr/bin' (string). |
| 114 | +The dir to which the newly built redis binaries are copied. |
| 115 | + |
| 116 | +####Defined Type: `redis::server` |
| 117 | + |
| 118 | +Used to configure redis instances. You can setup multiple redis servers on the |
| 119 | +same node. See the setup examples. |
| 120 | + |
| 121 | +**Parameters within `redis::server` |
| 122 | + |
| 123 | +#####`redis_name` |
| 124 | + |
| 125 | +Name of Redis instance. Default: call name of the function. |
| 126 | + |
| 127 | +#####`redis_memory` |
| 128 | + |
| 129 | +Default is '100mb' (string). |
| 130 | +Sets amount of memory used. eg. 100mb or 4g. |
| 131 | + |
| 132 | +#####`redis_ip` |
| 133 | + |
| 134 | +Default is '127.0.0.1' (string). Listen IP of redis. |
| 135 | + |
| 136 | +#####`redis_port` |
| 137 | + |
| 138 | +Listen port of Redis. Default: 6379 |
| 139 | + |
| 140 | +#####`redis_mempolicy` |
| 141 | + |
| 142 | +Algorithm used to manage keys. See Redis docs for possible values. Default: allkeys-lru |
| 143 | + |
| 144 | +#####`redis_timeout` |
| 145 | + |
| 146 | +Default: 0 |
| 147 | + |
| 148 | +#####`redis_nr_dbs` |
| 149 | + |
| 150 | +Number of databases provided by redis. Default: 1 |
| 151 | + |
| 152 | +#####`redis_dbfilename` |
| 153 | + |
| 154 | +Name of database dump file. Default: dump.rdb |
| 155 | + |
| 156 | +#####`redis_dir` |
| 157 | + |
| 158 | +Default is '/var/lib' (string) |
| 159 | +Path for persistent data. Path is <redis_dir>/redis_<redis_name>/. |
| 160 | + |
| 161 | +#####`redis_log_dir` |
| 162 | + |
| 163 | +Default is '/var/log' (string). |
| 164 | +Path for log. Full log path is <redis_log_dir>/redis_<redis_name>.log. |
| 165 | + |
| 166 | +#####`redis_loglevel` |
| 167 | + |
| 168 | +Loglevel of Redis. Default: 'notice' (string) |
| 169 | + |
| 170 | +#####`running` |
| 171 | + |
| 172 | +Configure if Redis should be running or not. Default: true (boolean) |
| 173 | + |
| 174 | +#####`enabled` |
| 175 | + |
| 176 | +Configure if Redis is started at boot. Default: true (boolean) |
| 177 | + |
| 178 | +##Limitations |
| 179 | + |
| 180 | +This module is tested on CentOS 6.5 and Debian 7 (Wheezy) and should also run without problems on |
| 181 | + |
| 182 | +* RHEL/CentOS/Scientific 6+ |
| 183 | +* Debian 6+ |
| 184 | +* Ubunutu 10.04 and newer |
45 | 185 |
|
| 186 | +##Contributing |
46 | 187 |
|
| 188 | +Echocat modules are open projects. So if you want to make this module even better, you can contribute to this module on [Github](https://github.com/echocat/puppet-redis). |
0 commit comments