summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriberezovskiy <iberezovskiy@mirantis.com>2015-07-28 13:00:54 +0300
committeriberezovskiy <iberezovskiy@mirantis.com>2015-07-28 13:18:36 +0300
commit6a9a83d0d9da73a094bd29e5629b4c4b93d151bd (patch)
treeeb0f194848b22558610d57c3bd2ae8a099a3a990
parent9721e5ce8d6d553a117d6b86366929ae34297f14 (diff)
Add Redis puppet module
Add upstream Redis puppet module which will be used as base module for Ceilometer-Redis plugin: https://github.com/fsalum/puppet-redis Partially implements: blueprint ceilometer-central-agent-ha Change-Id: Icbd879623790bf96e54b6dad7435594f107cb650
Notes
Notes (review): Verified+2: Jenkins Code-Review+1: Nadya Shakhat <nprivalova@mirantis.com> Code-Review+2: Ilya Tyaptin <ityaptin@mirantis.com> Workflow+1: Ilya Tyaptin <ityaptin@mirantis.com> Submitted-by: Jenkins Submitted-at: Tue, 15 Sep 2015 13:27:00 +0000 Reviewed-on: https://review.openstack.org/206453 Project: stackforge/fuel-plugin-ceilometer-redis Branch: refs/heads/master
-rw-r--r--deployment_scripts/puppet/modules/redis/.travis.yml21
-rw-r--r--deployment_scripts/puppet/modules/redis/CHANGELOG99
-rw-r--r--deployment_scripts/puppet/modules/redis/Gemfile24
-rw-r--r--deployment_scripts/puppet/modules/redis/LICENSE201
-rw-r--r--deployment_scripts/puppet/modules/redis/Modulefile13
-rw-r--r--deployment_scripts/puppet/modules/redis/README.md108
-rw-r--r--deployment_scripts/puppet/modules/redis/Rakefile11
-rw-r--r--deployment_scripts/puppet/modules/redis/Vagrantfile43
-rw-r--r--deployment_scripts/puppet/modules/redis/lib/facter/redis_version.rb71
-rw-r--r--deployment_scripts/puppet/modules/redis/manifests/init.pp211
-rw-r--r--deployment_scripts/puppet/modules/redis/manifests/params.pp37
-rw-r--r--deployment_scripts/puppet/modules/redis/manifests/sentinel.pp152
-rw-r--r--deployment_scripts/puppet/modules/redis/manifests/sentinel_params.pp42
-rw-r--r--deployment_scripts/puppet/modules/redis/metadata.json51
-rw-r--r--deployment_scripts/puppet/modules/redis/spec/spec_helper.rb17
-rw-r--r--deployment_scripts/puppet/modules/redis/templates/logrotate.erb9
-rw-r--r--deployment_scripts/puppet/modules/redis/templates/redis.conf.erb2790
-rw-r--r--deployment_scripts/puppet/modules/redis/templates/sentinel-init.conf.erb14
-rw-r--r--deployment_scripts/puppet/modules/redis/templates/sentinel.conf.erb178
-rw-r--r--deployment_scripts/puppet/modules/redis/tests/Puppetfile2
-rw-r--r--deployment_scripts/puppet/modules/redis/tests/init.pp97
-rw-r--r--deployment_scripts/puppet/modules/redis/tests/sentinel.pp38
22 files changed, 4229 insertions, 0 deletions
diff --git a/deployment_scripts/puppet/modules/redis/.travis.yml b/deployment_scripts/puppet/modules/redis/.travis.yml
new file mode 100644
index 0000000..53b9381
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/.travis.yml
@@ -0,0 +1,21 @@
1---
2language: ruby
3bundler_args: --without development
4script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--color --format documentation'"
5matrix:
6 fast_finish: true
7 include:
8 - rvm: 1.8.7
9 env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
10 - rvm: 1.8.7
11 env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
12 - rvm: 1.8.7
13 env: PUPPET_GEM_VERSION="~> 3.0"
14 - rvm: 1.9.3
15 env: PUPPET_GEM_VERSION="~> 3.0"
16 - rvm: 2.0.0
17 env: PUPPET_GEM_VERSION="~> 3.0"
18 - rvm: 2.1.6
19 env: PUPPET_GEM_VERSION="~> 4.0"
20notifications:
21 email: false
diff --git a/deployment_scripts/puppet/modules/redis/CHANGELOG b/deployment_scripts/puppet/modules/redis/CHANGELOG
new file mode 100644
index 0000000..976c243
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/CHANGELOG
@@ -0,0 +1,99 @@
1## fsalum-redis changelog
2
3Release notes for the fsalum-redis module.
4
5------------------------------------------
6
7#### 1.0.3 - 2014-11-25
8
9* Version lookup not working (#41)
10* Remove from facter warning when redis is not installed #42 (@pmoranga)
11
12#### 1.0.2 - 2014-10-25
13
14* Fixed Travis integration and tests
15* Added metadata.json
16* Making it compatible to be 'puppet approved' :)
17
18#### 1.0.1 - 2014-09-16
19
20* Allowing redis package name as a param. #35 (@nprimmer)
21* add $redis_version_override #37 (@tmclaugh)
22
23#### 1.0.0 - 2014-06-08
24
25Many CHANGES to this version, complete rewrite of redis.conf template
26to support Redis 2.2 to 2.8.
27
28Make sure to test the module and parameters before upgrading in production.
29
30Thanks to @zxjinn and @zeroecco for their hard work on this release.
31
32* some parameters were removed, added and/or default values changed
33* update redis.conf to the latest version available #32 (@zxjinn)
34* Logic for redis config file to support 2.2.x through 2.8.x #31 (@zeroecco)
35* Unixsocketoptions #33 (@nbeernink)
36* Changed operating system check to validate osfamily #29 (@george-b)
37
38#### 0.0.12 - 2014-03-21
39
40* Unset cleanup #27 (@trlinkin)
41* toggle ability to notify service to restart when config file changes #28 (@tmclaugh)
42
43#### 0.0.11 - 2014-02-19
44
45* system_sysctl parameter for redis class (@tehmaspc)
46
47#### 0.0.10 - 2014-02-19
48
49* Allow conf_bind to be unset (@stevelacey)
50* Changing default of glueoutputbuf to UNSET (@tehmaspc)
51
52#### 0.0.9 - 2014-01-09
53
54* Add quotes around all instances of UNSET (@charlesdunbar)
55
56#### 0.0.8 - 2013-12-20
57
58* Setting mode permission for conf_dir (@KlavsKlavsen)
59
60#### 0.0.7 - 2013-12-11
61
62* Add glueoutputbuf config option (@kryptx)
63* Add support for Amazon Linux AMI (@mattboston)
64
65#### 0.0.6 - 2013-08-01
66
67* Install package before poking config (@doismellburning)
68
69#### 0.0.5 - 2013-06-06
70
71* Fix Puppet 3.2.1 deprecation warnings (@ripienaar)
72* Fix duplicate entry for logrotate on Debian/RHEL using different paths (@arthurfurlan)
73* Add $conf_nosave parameter (@fsalum)
74* Minor changes to params variables (@fsalum)
75* Update CHANGELOG format
76
77------------------------------------------
78
79#### 0.0.4 - 2013-04-18
80
81* Creates conf_dir directory if it doesn't exist
82
83------------------------------------------
84
85#### 0.0.3 - 2013-02-25
86
87* Fixing redis.conf less options on Debian
88
89------------------------------------------
90
91#### 0.0.2 - 2013-02-25
92
93* Fixing redis.conf location for Debian
94
95------------------------------------------
96
97#### 0.0.1 - 2013-02-25
98
99* Initial Forge release
diff --git a/deployment_scripts/puppet/modules/redis/Gemfile b/deployment_scripts/puppet/modules/redis/Gemfile
new file mode 100644
index 0000000..02d5334
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/Gemfile
@@ -0,0 +1,24 @@
1source ENV['GEM_SOURCE'] || "https://rubygems.org"
2
3group :development, :test do
4 gem 'rake', :require => false
5 gem 'rspec-puppet', :require => false
6 gem 'puppetlabs_spec_helper', :require => false
7 gem 'puppet-lint', :require => false
8 gem 'puppet_facts', :require => false
9 gem 'metadata-json-lint', :require => false
10end
11
12if facterversion = ENV['FACTER_GEM_VERSION']
13 gem 'facter', facterversion, :require => false
14else
15 gem 'facter', :require => false
16end
17
18if puppetversion = ENV['PUPPET_GEM_VERSION']
19 gem 'puppet', puppetversion, :require => false
20else
21 gem 'puppet', :require => false
22end
23
24# vim:ft=ruby
diff --git a/deployment_scripts/puppet/modules/redis/LICENSE b/deployment_scripts/puppet/modules/redis/LICENSE
new file mode 100644
index 0000000..8ab6801
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/LICENSE
@@ -0,0 +1,201 @@
1 Apache License
2 Version 2.0, January 2004
3 http://www.apache.org/licenses/
4
5 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
7 1. Definitions.
8
9 "License" shall mean the terms and conditions for use, reproduction,
10 and distribution as defined by Sections 1 through 9 of this document.
11
12 "Licensor" shall mean the copyright owner or entity authorized by
13 the copyright owner that is granting the License.
14
15 "Legal Entity" shall mean the union of the acting entity and all
16 other entities that control, are controlled by, or are under common
17 control with that entity. For the purposes of this definition,
18 "control" means (i) the power, direct or indirect, to cause the
19 direction or management of such entity, whether by contract or
20 otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 outstanding shares, or (iii) beneficial ownership of such entity.
22
23 "You" (or "Your") shall mean an individual or Legal Entity
24 exercising permissions granted by this License.
25
26 "Source" form shall mean the preferred form for making modifications,
27 including but not limited to software source code, documentation
28 source, and configuration files.
29
30 "Object" form shall mean any form resulting from mechanical
31 transformation or translation of a Source form, including but
32 not limited to compiled object code, generated documentation,
33 and conversions to other media types.
34
35 "Work" shall mean the work of authorship, whether in Source or
36 Object form, made available under the License, as indicated by a
37 copyright notice that is included in or attached to the work
38 (an example is provided in the Appendix below).
39
40 "Derivative Works" shall mean any work, whether in Source or Object
41 form, that is based on (or derived from) the Work and for which the
42 editorial revisions, annotations, elaborations, or other modifications
43 represent, as a whole, an original work of authorship. For the purposes
44 of this License, Derivative Works shall not include works that remain
45 separable from, or merely link (or bind by name) to the interfaces of,
46 the Work and Derivative Works thereof.
47
48 "Contribution" shall mean any work of authorship, including
49 the original version of the Work and any modifications or additions
50 to that Work or Derivative Works thereof, that is intentionally
51 submitted to Licensor for inclusion in the Work by the copyright owner
52 or by an individual or Legal Entity authorized to submit on behalf of
53 the copyright owner. For the purposes of this definition, "submitted"
54 means any form of electronic, verbal, or written communication sent
55 to the Licensor or its representatives, including but not limited to
56 communication on electronic mailing lists, source code control systems,
57 and issue tracking systems that are managed by, or on behalf of, the
58 Licensor for the purpose of discussing and improving the Work, but
59 excluding communication that is conspicuously marked or otherwise
60 designated in writing by the copyright owner as "Not a Contribution."
61
62 "Contributor" shall mean Licensor and any individual or Legal Entity
63 on behalf of whom a Contribution has been received by Licensor and
64 subsequently incorporated within the Work.
65
66 2. Grant of Copyright License. Subject to the terms and conditions of
67 this License, each Contributor hereby grants to You a perpetual,
68 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 copyright license to reproduce, prepare Derivative Works of,
70 publicly display, publicly perform, sublicense, and distribute the
71 Work and such Derivative Works in Source or Object form.
72
73 3. Grant of Patent License. Subject to the terms and conditions of
74 this License, each Contributor hereby grants to You a perpetual,
75 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 (except as stated in this section) patent license to make, have made,
77 use, offer to sell, sell, import, and otherwise transfer the Work,
78 where such license applies only to those patent claims licensable
79 by such Contributor that are necessarily infringed by their
80 Contribution(s) alone or by combination of their Contribution(s)
81 with the Work to which such Contribution(s) was submitted. If You
82 institute patent litigation against any entity (including a
83 cross-claim or counterclaim in a lawsuit) alleging that the Work
84 or a Contribution incorporated within the Work constitutes direct
85 or contributory patent infringement, then any patent licenses
86 granted to You under this License for that Work shall terminate
87 as of the date such litigation is filed.
88
89 4. Redistribution. You may reproduce and distribute copies of the
90 Work or Derivative Works thereof in any medium, with or without
91 modifications, and in Source or Object form, provided that You
92 meet the following conditions:
93
94 (a) You must give any other recipients of the Work or
95 Derivative Works a copy of this License; and
96
97 (b) You must cause any modified files to carry prominent notices
98 stating that You changed the files; and
99
100 (c) You must retain, in the Source form of any Derivative Works
101 that You distribute, all copyright, patent, trademark, and
102 attribution notices from the Source form of the Work,
103 excluding those notices that do not pertain to any part of
104 the Derivative Works; and
105
106 (d) If the Work includes a "NOTICE" text file as part of its
107 distribution, then any Derivative Works that You distribute must
108 include a readable copy of the attribution notices contained
109 within such NOTICE file, excluding those notices that do not
110 pertain to any part of the Derivative Works, in at least one
111 of the following places: within a NOTICE text file distributed
112 as part of the Derivative Works; within the Source form or
113 documentation, if provided along with the Derivative Works; or,
114 within a display generated by the Derivative Works, if and
115 wherever such third-party notices normally appear. The contents
116 of the NOTICE file are for informational purposes only and
117 do not modify the License. You may add Your own attribution
118 notices within Derivative Works that You distribute, alongside
119 or as an addendum to the NOTICE text from the Work, provided
120 that such additional attribution notices cannot be construed
121 as modifying the License.
122
123 You may add Your own copyright statement to Your modifications and
124 may provide additional or different license terms and conditions
125 for use, reproduction, or distribution of Your modifications, or
126 for any such Derivative Works as a whole, provided Your use,
127 reproduction, and distribution of the Work otherwise complies with
128 the conditions stated in this License.
129
130 5. Submission of Contributions. Unless You explicitly state otherwise,
131 any Contribution intentionally submitted for inclusion in the Work
132 by You to the Licensor shall be under the terms and conditions of
133 this License, without any additional terms or conditions.
134 Notwithstanding the above, nothing herein shall supersede or modify
135 the terms of any separate license agreement you may have executed
136 with Licensor regarding such Contributions.
137
138 6. Trademarks. This License does not grant permission to use the trade
139 names, trademarks, service marks, or product names of the Licensor,
140 except as required for reasonable and customary use in describing the
141 origin of the Work and reproducing the content of the NOTICE file.
142
143 7. Disclaimer of Warranty. Unless required by applicable law or
144 agreed to in writing, Licensor provides the Work (and each
145 Contributor provides its Contributions) on an "AS IS" BASIS,
146 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 implied, including, without limitation, any warranties or conditions
148 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 PARTICULAR PURPOSE. You are solely responsible for determining the
150 appropriateness of using or redistributing the Work and assume any
151 risks associated with Your exercise of permissions under this License.
152
153 8. Limitation of Liability. In no event and under no legal theory,
154 whether in tort (including negligence), contract, or otherwise,
155 unless required by applicable law (such as deliberate and grossly
156 negligent acts) or agreed to in writing, shall any Contributor be
157 liable to You for damages, including any direct, indirect, special,
158 incidental, or consequential damages of any character arising as a
159 result of this License or out of the use or inability to use the
160 Work (including but not limited to damages for loss of goodwill,
161 work stoppage, computer failure or malfunction, or any and all
162 other commercial damages or losses), even if such Contributor
163 has been advised of the possibility of such damages.
164
165 9. Accepting Warranty or Additional Liability. While redistributing
166 the Work or Derivative Works thereof, You may choose to offer,
167 and charge a fee for, acceptance of support, warranty, indemnity,
168 or other liability obligations and/or rights consistent with this
169 License. However, in accepting such obligations, You may act only
170 on Your own behalf and on Your sole responsibility, not on behalf
171 of any other Contributor, and only if You agree to indemnify,
172 defend, and hold each Contributor harmless for any liability
173 incurred by, or claims asserted against, such Contributor by reason
174 of your accepting any such warranty or additional liability.
175
176 END OF TERMS AND CONDITIONS
177
178 APPENDIX: How to apply the Apache License to your work.
179
180 To apply the Apache License to your work, attach the following
181 boilerplate notice, with the fields enclosed by brackets "{}"
182 replaced with your own identifying information. (Don't include
183 the brackets!) The text should be enclosed in the appropriate
184 comment syntax for the file format. We also recommend that a
185 file or class name and description of purpose be included on the
186 same "printed page" as the copyright notice for easier
187 identification within third-party archives.
188
189 Copyright {2014} {Felipe Salum}
190
191 Licensed under the Apache License, Version 2.0 (the "License");
192 you may not use this file except in compliance with the License.
193 You may obtain a copy of the License at
194
195 http://www.apache.org/licenses/LICENSE-2.0
196
197 Unless required by applicable law or agreed to in writing, software
198 distributed under the License is distributed on an "AS IS" BASIS,
199 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 See the License for the specific language governing permissions and
201 limitations under the License.
diff --git a/deployment_scripts/puppet/modules/redis/Modulefile b/deployment_scripts/puppet/modules/redis/Modulefile
new file mode 100644
index 0000000..c58f5cf
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/Modulefile
@@ -0,0 +1,13 @@
1name 'fsalum-redis'
2version '1.0.3'
3source 'git://github.com/fsalum/puppet-redis.git'
4author 'Felipe Salum'
5license 'Apache License, Version 2.0'
6summary 'Puppet module for Redis Server'
7description 'Module to install and configure a Redis server'
8project_page 'https://github.com/fsalum/puppet-redis'
9
10## Add dependencies, if any:
11
12# https://forge.puppetlabs.com/thias/sysctl
13dependency 'thias/sysctl', '>= 0.3.0'
diff --git a/deployment_scripts/puppet/modules/redis/README.md b/deployment_scripts/puppet/modules/redis/README.md
new file mode 100644
index 0000000..54d9898
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/README.md
@@ -0,0 +1,108 @@
1#Redis Module for Puppet
2[![puppet-redis](https://img.shields.io/puppetforge/v/fsalum/redis.svg)](https://forge.puppetlabs.com/fsalum/redis) [![Build Status](https://travis-ci.org/fsalum/puppet-redis.svg?branch=master)](https://travis-ci.org/fsalum/puppet-redis)
3
4This module installs and manages a Redis server. All redis.conf options are
5accepted in the parameterized class.
6
7##Important
8
9If you are upgrading this module from 0.x to 1.0+, please test it carefully
10outside production as it is not fully backwards compatible.
11
12Some class parameters were added, removed or had their default values changed.
13
14The redis.conf template has been completely rewritten to support Redis 2.2+ to 2.8+.
15
16##Operating System
17
18Tested on CentOS 6.5, Ubuntu Saucy/Trusty/Precise, Debian 7.4
19redis.conf options compatible with Redis 2.2, 2.4, 2.6, 2.8
20
21##Quick Start
22
23Use the default parameters:
24
25 class { 'redis': }
26
27To change the port and listening network interface:
28
29 class { 'redis':
30 conf_port => '6379',
31 conf_bind => '0.0.0.0',
32 }
33
34##Parameters
35
36Check the [init.pp](https://github.com/fsalum/puppet-redis/blob/master/manifests/init.pp) file for a complete list of parameters accepted.
37
38* custom sysctl
39
40To enable and set important Linux kernel sysctl parameters as described in the [Redis Admin Guide](http://redis.io/topics/admin) - use the following configuration option:
41
42 class { 'redis':
43 system_sysctl => true
44 }
45
46By default, this sysctl parameter will not be enabled. Furthermore, you will need the sysctl module defined in the [Modulefile](https://github.com/fsalum/puppet-redis/blob/master/Modulefile) file.
47
48* service restart
49
50If you need to execute a controlled restart of redis after changes due master/slave relationships to avoid that both are restarted at the same time use the parameter below.
51
52 class { 'redis':
53 service_restart => false
54 }
55
56By default service restart is true.
57
58#Sentinel
59
60This module supports Redis Sentinel that comes with Redis 2.8+ with all the configuration parameters.
61
62It manages upstart scripts (can be deactivated with parameter manage_upstart_scripts = false).
63
64##Operating System
65
66Tested on Ubuntu 14.04 with Redis 2.8
67
68##Quick Start
69
70Example:
71
72 class { redis::sentinel:
73 conf_port => '26379',
74 sentinel_confs => {
75 'mymaster' => {
76 'monitor' => '127.0.0.1 6379 2',
77 'down-after-milliseconds' => '60000',
78 'failover-timeout' => 180000,
79 'notification-script' => '/etc/redis/scripts/thescript.py',
80 'parallel-syncs' => '3',
81 },
82 'resque' => {
83 'monitor' => '127.0.0.1 6379 4',
84 'down-after-milliseconds' => '10000',
85 'failover-timeout' => 180000,
86 'notification-script' => '/etc/redis/scripts/thescript.py',
87 'parallel-syncs' => '5',
88 }
89 }
90 }
91
92##Copyright and License
93
94Copyright (C) 2014 Felipe Salum
95
96Felipe Salum can be contacted at: fsalum@gmail.com
97
98Licensed under the Apache License, Version 2.0 (the "License");
99you may not use this file except in compliance with the License.
100You may obtain a copy of the License at
101
102 http://www.apache.org/licenses/LICENSE-2.0
103
104 Unless required by applicable law or agreed to in writing, software
105 distributed under the License is distributed on an "AS IS" BASIS,
106 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
107 See the License for the specific language governing permissions and
108 limitations under the License.
diff --git a/deployment_scripts/puppet/modules/redis/Rakefile b/deployment_scripts/puppet/modules/redis/Rakefile
new file mode 100644
index 0000000..43e1b83
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/Rakefile
@@ -0,0 +1,11 @@
1require 'puppetlabs_spec_helper/rake_tasks'
2require 'puppet-lint/tasks/puppet-lint'
3
4PuppetLint.configuration.fail_on_warnings
5PuppetLint.configuration.send('relative')
6PuppetLint.configuration.send('disable_80chars')
7PuppetLint.configuration.send('disable_class_inherits_from_params_class')
8PuppetLint.configuration.send('disable_class_parameter_defaults')
9PuppetLint.configuration.send('disable_documentation')
10PuppetLint.configuration.send('disable_single_quote_string_with_variables')
11PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
diff --git a/deployment_scripts/puppet/modules/redis/Vagrantfile b/deployment_scripts/puppet/modules/redis/Vagrantfile
new file mode 100644
index 0000000..5b6a302
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/Vagrantfile
@@ -0,0 +1,43 @@
1# -*- mode: ruby -*-
2# vi: set ft=ruby :
3#
4
5if ENV['VAGRANT_HOME'].nil?
6 ENV['VAGRANT_HOME'] = './'
7end
8
9redis = {
10 :'centos5' => { :memory => '120', :ip => '10.1.1.10', :box => 'puppetlabs/centos-5.11-64-puppet', :domain => 'redis.local' },
11 :'centos65' => { :memory => '120', :ip => '10.1.1.11', :box => 'puppetlabs/centos-6.5-64-puppet', :domain => 'redis.local' },
12 :'precise' => { :memory => '120', :ip => '10.1.1.20', :box => 'puppetlabs/ubuntu-12.04-64-puppet', :domain => 'redis.local' },
13 :'saucy' => { :memory => '120', :ip => '10.1.1.21', :box => 'puppetlabs/ubuntu-13.10-64-puppet', :domain => 'redis.local' },
14 :'trusty' => { :memory => '240', :ip => '10.1.1.22', :box => 'puppetlabs/ubuntu-14.04-64-puppet', :domain => 'redis.local' },
15 :'squeeze' => { :memory => '120', :ip => '10.1.1.30', :box => 'puppetlabs/debian-6.0.9-64-puppet', :domain => 'redis.local' },
16 :'wheezy' => { :memory => '120', :ip => '10.1.1.31', :box => 'puppetlabs/debian-7.6-64-puppet', :domain => 'redis.local' },
17}
18
19Vagrant::Config.run("2") do |config|
20 config.vbguest.auto_update = true
21 config.hostmanager.enabled = false
22
23 redis.each_pair do |name, opts|
24 config.vm.define name do |n|
25 config.vm.provider :virtualbox do |vb|
26 vb.customize ["modifyvm", :id, "--memory", opts[:memory] ]
27 end
28 n.vm.network "private_network", ip: opts[:ip]
29 n.vm.box = opts[:box]
30 n.vm.host_name = "#{name}" + "." + opts[:domain]
31 n.vm.synced_folder "#{ENV['VAGRANT_HOME']}","/etc/puppet/modules/redis"
32 n.vm.provision :shell, :inline => "gem install puppet facter --no-ri --no-rdoc" if name == "trusty"
33 n.vm.provision :shell, :inline => "puppet module install thias-sysctl --force"
34 n.vm.provision :puppet do |puppet|
35 puppet.manifests_path = "tests"
36 puppet.manifest_file = "init.pp"
37 #puppet.manifest_file = "sentinel.pp"
38 puppet.module_path = "./"
39 end
40 end
41 end
42
43end
diff --git a/deployment_scripts/puppet/modules/redis/lib/facter/redis_version.rb b/deployment_scripts/puppet/modules/redis/lib/facter/redis_version.rb
new file mode 100644
index 0000000..1aa7606
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/lib/facter/redis_version.rb
@@ -0,0 +1,71 @@
1require 'facter'
2
3Facter.add("redis_version", :timeout => 120) do
4 confine :osfamily => "Debian"
5
6 setcode do
7
8 dpkg = `which apt-cache 2> /dev/null`.chomp
9 if dpkg == ''
10 dpkg = '/usr/bin/apt-cache'
11 end
12
13 redis_version = Facter::Util::Resolution.exec('/usr/bin/redis-server --version')
14 if redis_version.nil?
15 redis_version = Facter::Util::Resolution.exec(dpkg+" show redis-server 2> /dev/null | /bin/grep -i 'version:' | /usr/bin/awk '{printf(\"%s\",$2)}' | sort -nr | head -1")
16 end
17
18 case redis_version
19 when /2\.8\.[0-9]/
20 #set version to 2.8
21 redis_version = '2.8.x'
22 when /2\.6\.[0-9]/
23 #set version to 2.6
24 redis_version = '2.6.x'
25 when /2\.4\.[0-9]/
26 #set version to 2.4
27 redis_version = '2.4.x'
28 when /2\.2\.[0-9]/
29 #set version to 2.2
30 redis_version = '2.2.x'
31 else
32 redis_version = 'nil'
33 end
34 redis_version
35 end
36end
37
38Facter.add("redis_version", :timeout => 120) do
39 confine :osfamily => "RedHat"
40
41 setcode do
42
43 yum = `which yum 2> /dev/null`.chomp
44 if yum == ''
45 yum = '/usr/bin/yum'
46 end
47
48 redis_version = Facter::Util::Resolution.exec('/usr/sbin/redis-server --version')
49 if redis_version.nil?
50 redis_version = Facter::Util::Resolution.exec(yum+" info redis 2> /dev/null | /bin/grep '^Version' | /bin/awk -F ':' '{printf(\"%s\",$2)}' | sort -nr | head -1")
51 end
52
53 case redis_version
54 when /2\.8\.[0-9]/
55 #set version to 2.8
56 redis_version = '2.8.x'
57 when /2\.6\.[0-9]/
58 #set version to 2.6
59 redis_version = '2.6.x'
60 when /2\.4\.[0-9]/
61 #set version to 2.4
62 redis_version = '2.4.x'
63 when /2\.2\.[0-9]/
64 #set version to 2.2
65 redis_version = '2.2.x'
66 else
67 redis_version = 'nil'
68 end
69 redis_version
70 end
71end
diff --git a/deployment_scripts/puppet/modules/redis/manifests/init.pp b/deployment_scripts/puppet/modules/redis/manifests/init.pp
new file mode 100644
index 0000000..d2d3814
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/manifests/init.pp
@@ -0,0 +1,211 @@
1# == Class: redis
2#
3# Install and configure a Redis server
4#
5# === Parameters
6#
7# All the redis.conf parameters can be passed to the class.
8# See below for a complete list of parameters accepted.
9#
10# Check the README.md file for any further information about parameters for this class.
11#
12# === Examples
13#
14# class { redis:
15# conf_port => '6380',
16# conf_bind => '0.0.0.0',
17# }
18#
19# === Authors
20#
21# Felipe Salum <fsalum@gmail.com>
22#
23# === Copyright
24#
25# Copyright 2013 Felipe Salum, unless otherwise noted.
26#
27class redis (
28 $conf_activerehashing = 'yes',
29 $conf_aof_rewrite_incremental_fsync = 'yes', # 2.6+
30 $conf_append = {}, # hash of custom variables+values
31 $conf_appendfilename = undef, # default appendonly.aof
32 $conf_appendfsync = 'everysec',
33 $conf_appendonly = 'no',
34 $conf_auto_aof_rewrite_min_size = '64mb',
35 $conf_auto_aof_rewrite_percentage = '100',
36 $conf_bind = '0.0.0.0',
37 $conf_client_output_buffer_limit_normal = '0 0 0', # 2.6+
38 $conf_client_output_buffer_limit_pubsub = '32mb 8mb 60', # 2.6+
39 $conf_client_output_buffer_limit_slave = '256mb 64mb 60', # 2.6+
40 $conf_daemonize = 'yes',
41 $conf_databases = '16',
42 $conf_dbfilename = 'dump.rdb',
43 $conf_dir = '/var/lib/redis/',
44 $conf_glueoutputbuf = undef,
45 $conf_hash_max_zipmap_entries = '512',
46 $conf_hash_max_zipmap_value = '64',
47 $conf_hll_sparse_max_bytes = undef, # default 3000, 2.8.5?+
48 $conf_hz = '10', # 2.6+
49 $conf_include = [], # array of custom include files
50 $conf_list_max_ziplist_entries = '512',
51 $conf_list_max_ziplist_value = '64',
52 $conf_logfile = undef, #default ""
53 $conf_loglevel = 'notice',
54 $conf_lua_time_limit = '5000', # 2.6+
55 $conf_masterauth = undef,
56 $conf_maxclients = undef, # default 10000 in 2.6+
57 $conf_maxmemory = undef,
58 $conf_maxmemory_policy = undef,
59 $conf_maxmemory_samples = undef,
60 $conf_min_slaves_max_lag = undef, # default 10, 2.8+
61 $conf_min_slaves_to_write = undef, # 2.8+
62 $conf_no_appendfsync_on_rewrite = 'no',
63 $conf_nosave = undef,
64 $conf_notify_keyspace_events = undef, # 2.8+
65 $conf_pidfile = undef,
66 $conf_port = '6379',
67 $conf_rdbchecksum = 'yes', # 2.6+
68 $conf_rdbcompression = 'yes',
69 $conf_repl_backlog_size = '1mb', # 2,8+
70 $conf_repl_backlog_ttl = '3600', # 2.8+
71 $conf_repl_disable_tcp_nodelay = 'no', # 2,6+
72 $conf_repl_ping_slave_period = '10', # 2.4+
73 $conf_repl_timeout = '60', # 2.4+
74 $conf_requirepass = undef,
75 $conf_save = {'900' =>'1', '300' => '10', '60' => '10000'},
76 $conf_set_max_intset_entries = '512',
77 $conf_slave_priority = undef, # 2.6+
78 $conf_slave_read_only = 'yes', # 2.6+
79 $conf_slave_serve_stale_data = 'yes',
80 $conf_slaveof = undef,
81 $conf_slowlog_log_slower_than = '10000',
82 $conf_slowlog_max_len = '128',
83 $conf_stop_writes_on_bgsave_error = 'yes', # 2.6+
84 $conf_syslog_enabled = undef,
85 $conf_syslog_facility = undef,
86 $conf_syslog_ident = undef,
87 $conf_tcp_backlog = undef, # default is 511, 2.8.5+
88 $conf_tcp_keepalive = '0', # 2.6+
89 $conf_timeout = '0',
90 $conf_unixsocket = '/tmp/redis.sock', # 2.2+
91 $conf_unixsocketperm = '755', # 2.4+
92 $conf_vm_enabled = 'no', # deprecated in 2.4+
93 $conf_vm_max_memory = '0', # deprecated in 2.4+
94 $conf_vm_max_threads = '4', # deprecated in 2.4+
95 $conf_vm_page_size = '32', # deprecated in 2.4+
96 $conf_vm_pages = '134217728', # deprecated in 2.4+
97 $conf_vm_swap_file = '/tmp/redis.swap', # deprecated in 2.4+
98 $conf_zset_max_ziplist_entries = '128', # 2.4+
99 $conf_zset_max_ziplist_value = '64', # 2.4+
100 $package_ensure = 'present',
101 $package_name = undef,
102 $redis_version_override = undef,
103 $service_enable = true,
104 $service_ensure = 'running',
105 $service_restart = true,
106 $system_sysctl = false,
107) {
108
109 include redis::params
110
111 $conf_redis = $redis::params::conf
112 $conf_logrotate = $redis::params::conf_logrotate
113 $service = $redis::params::service
114
115 if $redis_version_override {
116 $redis_version_real = $redis_version_override
117 } else {
118 $redis_version_real = $package_ensure ? {
119 /2\.2\..*/ => '2.2.x',
120 /2\.4\..*/ => '2.4.x',
121 /2\.6\..*/ => '2.6.x',
122 /2\.8\..*/ => '2.8.x',
123 default => $::redis_version
124 }
125 }
126
127 if $package_name {
128 $package = $package_name
129 }else{
130 $package = $redis::params::package
131 }
132
133 if $conf_pidfile {
134 $conf_pidfile_real = $conf_pidfile
135 }else{
136 $conf_pidfile_real = $::redis::params::pidfile
137 }
138
139 if $conf_logfile {
140 $conf_logfile_real = $conf_logfile
141 }else{
142 $conf_logfile_real = $::redis::params::logfile
143 }
144
145 package { 'redis':
146 ensure => $package_ensure,
147 name => $package,
148 }
149
150 service { 'redis':
151 ensure => $service_ensure,
152 name => $service,
153 enable => $service_enable,
154 hasrestart => true,
155 hasstatus => true,
156 require => [ Package['redis'],
157 Exec[$conf_dir],
158 File[$conf_redis] ],
159 }
160
161 file { $conf_redis:
162 path => $conf_redis,
163 content => template('redis/redis.conf.erb'),
164 owner => root,
165 group => root,
166 mode => '0644',
167 require => Package['redis'],
168 }
169
170 file { $conf_logrotate:
171 path => $conf_logrotate,
172 content => template('redis/logrotate.erb'),
173 owner => root,
174 group => root,
175 mode => '0644',
176 }
177
178 exec { $conf_dir:
179 path => '/bin:/usr/bin:/sbin:/usr/sbin',
180 command => "mkdir -p ${conf_dir}",
181 user => root,
182 group => root,
183 creates => $conf_dir,
184 before => Service['redis'],
185 require => Package['redis'],
186 }
187
188 file { $conf_dir:
189 ensure => directory,
190 owner => redis,
191 group => redis,
192 mode => '0755',
193 before => Service['redis'],
194 require => Exec[$conf_dir],
195 }
196
197 if ( $system_sysctl == true ) {
198 # add necessary kernel parameters
199 # see the redis admin guide here: http://redis.io/topics/admin
200 sysctl { 'vm.overcommit_memory':
201 value => '1',
202 }
203 }
204
205 if $service_restart == true {
206 # https://github.com/fsalum/puppet-redis/pull/28
207 Exec[$conf_dir] ~> Service['redis']
208 File[$conf_redis] ~> Service['redis']
209 }
210
211}
diff --git a/deployment_scripts/puppet/modules/redis/manifests/params.pp b/deployment_scripts/puppet/modules/redis/manifests/params.pp
new file mode 100644
index 0000000..1373b4a
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/manifests/params.pp
@@ -0,0 +1,37 @@
1# Class: redis::params
2#
3# This class configures parameters for the puppet-redis module.
4#
5# Parameters:
6#
7# Actions:
8#
9# Requires:
10#
11# Sample Usage:
12#
13class redis::params {
14
15 case $::osfamily {
16 'redhat': {
17 $package = 'redis'
18 $service = 'redis'
19 $conf = '/etc/redis.conf'
20 $conf_logrotate = '/etc/logrotate.d/redis'
21 $pidfile = '/var/run/redis/redis.pid'
22 $logfile = '/var/log/redis/redis.log'
23 }
24 'debian': {
25 $package = 'redis-server'
26 $service = 'redis-server'
27 $conf = '/etc/redis/redis.conf'
28 $conf_logrotate = '/etc/logrotate.d/redis-server'
29 $pidfile = '/var/run/redis/redis-server.pid'
30 $logfile = '/var/log/redis/redis-server.log'
31 }
32 default: {
33 fail("Unsupported osfamily: ${::osfamily}, module ${module_name} only support osfamily RedHat and Debian")
34 }
35 }
36
37}
diff --git a/deployment_scripts/puppet/modules/redis/manifests/sentinel.pp b/deployment_scripts/puppet/modules/redis/manifests/sentinel.pp
new file mode 100644
index 0000000..fa9c3ed
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/manifests/sentinel.pp
@@ -0,0 +1,152 @@
1# == Class: redis::sentinel
2#
3# Install and configure a Redis Sentinel
4#
5# === Parameters
6#
7# All the sentinel.conf parameters can be passed to the class.
8# See below for a complete list of parameters accepted.
9#
10# Check the README.md file for any further information about parameters for this class.
11#
12# === Examples
13#
14# class { redis::sentinel:
15# conf_port => '26379',
16# sentinel_confs => {
17# 'mymaster' => {
18# 'monitor' => '127.0.0.1 6379 2',
19# 'down-after-milliseconds' => '60000',
20# 'notification-script' => '/etc/redis/scripts/thescript.py',
21# 'parallel-syncs' => '3',
22# }
23# 'resque' => {
24# 'monitor' => 'resque 6379 4',
25# 'down-after-milliseconds' => '10000',
26# 'failover-timeout' => 180000,
27# 'notification-script' => '/etc/redis/scripts/thescript.py',
28# 'parallel-syncs' => '5',
29# }
30# }
31# }
32#
33# === Authors
34#
35# Victor Garcia <bravejolie@gmail.com>
36#
37# === Copyright
38#
39# Copyright 2013 Felipe Salum, unless otherwise noted.
40#
41class redis::sentinel (
42 $conf_port = '26379',
43 $conf_daemonize = 'yes',
44 $sentinel_confs = [],
45 $service_enable = true,
46 $service_ensure = 'running',
47 $service_restart = true,
48 $manage_upstart_scripts = true,
49 $package_name = undef,
50) {
51
52 include redis::sentinel_params
53
54 $conf_sentinel = $redis::sentinel_params::conf
55 $conf_sentinel_orig = "${conf_sentinel}.puppet"
56 $conf_logrotate = $redis::sentinel_params::conf_logrotate
57 $service = $redis::sentinel_params::service
58 $upstart_script = $redis::sentinel_params::upstart_script
59
60 if $package_name {
61 $package = $package_name
62 }else{
63 $package = $redis::sentinel_params::package
64 }
65
66 if $conf_pidfile {
67 $conf_pidfile_real = $conf_pidfile
68 }else{
69 $conf_pidfile_real = $::redis::sentinel_params::pidfile
70 }
71 if $conf_logfile {
72 $conf_logfile_real = $conf_logfile
73 }else{
74 $conf_logfile_real = $::redis::sentinel_params::logfile
75 }
76
77 package { 'redis':
78 ensure => $package_ensure,
79 name => $package,
80 }
81
82 if $manage_upstart_scripts == true {
83 service { 'sentinel':
84 ensure => $service_ensure,
85 name => $service,
86 hasrestart => true,
87 hasstatus => true,
88 require => [ File[$conf_sentinel_orig],
89 File[$upstart_script] ],
90 provider => 'upstart'
91 }
92 } else {
93 service { 'sentinel':
94 ensure => $service_ensure,
95 name => $service,
96 enable => $service_enable,
97 hasrestart => true,
98 hasstatus => true,
99 require => [ Package['redis'],
100 File[$conf_sentinel_orig] ],
101 }
102 }
103
104 # Sentinel rewrites the config file so, to avoid overriding it
105 # with the original content everytime puppet runs, this manages the
106 # "notify" event on an original file that triggers a copy to the good one
107 # only if it changed.
108 file { $conf_sentinel_orig:
109 content => template('redis/sentinel.conf.erb'),
110 owner => redis,
111 group => redis,
112 mode => '0644',
113 require => Package['redis'],
114 notify => Exec["cp ${conf_sentinel_orig} ${conf_sentinel}"],
115 }
116
117 file { $conf_sentinel:
118 owner => redis,
119 group => redis,
120 require => Package['redis'],
121 }
122
123 exec { "cp ${conf_sentinel_orig} ${conf_sentinel}":
124 path => '/bin:/usr/bin:/sbin:/usr/sbin',
125 refreshonly => true,
126 user => redis,
127 group => redis,
128 notify => Service['sentinel'],
129 require => File[$conf_sentinel],
130 }
131
132 file { $conf_logrotate:
133 path => $conf_logrotate,
134 content => template('redis/logrotate.erb'),
135 owner => root,
136 group => root,
137 mode => '0644',
138 }
139
140 if $service_restart == true {
141 # https://github.com/fsalum/puppet-redis/pull/28
142 File[$conf_sentinel_orig] ~> Service['sentinel']
143 }
144
145 if $manage_upstart_scripts == true {
146 file { $upstart_script:
147 ensure => present,
148 content => template('redis/sentinel-init.conf.erb'),
149 }
150 }
151
152}
diff --git a/deployment_scripts/puppet/modules/redis/manifests/sentinel_params.pp b/deployment_scripts/puppet/modules/redis/manifests/sentinel_params.pp
new file mode 100644
index 0000000..5fc8bf7
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/manifests/sentinel_params.pp
@@ -0,0 +1,42 @@
1# Class: redis::sentinel_params
2#
3# This class configures sentinel parameters for the puppet-redis module.
4#
5# Parameters:
6#
7# Actions:
8#
9# Requires:
10#
11# Sample Usage:
12#
13class redis::sentinel_params {
14
15 case $::osfamily {
16 # TODO: add redhat support
17 #'redhat': {
18 # $package = 'redis'
19 # $service = 'redis-sentinel'
20 # $conf = '/etc/sentinel.conf'
21 # $conf_dir = undef
22 # $conf_logrotate = '/etc/logrotate.d/sentinel'
23 # $pidfile = '/var/run/redis/sentinel.pid'
24 # $logfile = '/var/log/redis/sentinel.log'
25 # $upstart_script = '/etc/init/redis-sentinel.conf'
26 #}
27 'debian': {
28 $package = 'redis-server'
29 $service = 'redis-sentinel'
30 $conf_dir = '/etc/redis'
31 $conf = '/etc/redis/sentinel.conf'
32 $conf_logrotate = '/etc/logrotate.d/redis-sentinel'
33 $pidfile = '/var/run/redis/redis-sentinel.pid'
34 $logfile = '/var/log/redis/redis-sentinel.log'
35 $upstart_script = '/etc/init/redis-sentinel.conf'
36 }
37 default: {
38 fail("Unsupported osfamily: ${::osfamily}, module ${module_name} only support osfamily RedHat and Debian")
39 }
40 }
41
42}
diff --git a/deployment_scripts/puppet/modules/redis/metadata.json b/deployment_scripts/puppet/modules/redis/metadata.json
new file mode 100644
index 0000000..917416f
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/metadata.json
@@ -0,0 +1,51 @@
1{
2 "name": "fsalum-redis",
3 "version": "1.0.3",
4 "author": "Felipe Salum",
5 "summary": "Puppet module for Redis Server",
6 "license": "Apache-2.0",
7 "source": "git://github.com/fsalum/puppet-redis.git",
8 "project_page": "https://github.com/fsalum/puppet-redis",
9 "issues_url": "https://github.com/fsalum/puppet-redis/issues",
10 "tags": ["redis", "memcached", "cache", "nosql"],
11 "operatingsystem_support": [
12 {
13 "operatingsystem": "Centos",
14 "operatingsystemrelease": [
15 "5",
16 "6"
17 ]
18 },
19 {
20 "operatingsystem": "Ubuntu",
21 "operatingsystemrelease": [
22 "12.04",
23 "13.10",
24 "14.04"
25 ]
26 },
27 {
28 "operatingsystem":"Debian",
29 "operatingsystemrelease": [
30 "6",
31 "7"
32 ]
33 }
34 ],
35 "requirements": [
36 {
37 "name": "pe",
38 "version_requirement": "3.x"
39 },
40 {
41 "name": "puppet",
42 "version_requirement": "3.x"
43 }
44 ],
45 "dependencies": [
46 {
47 "name": "thias/sysctl",
48 "version_requirement": ">= 0.3.0"
49 }
50 ]
51}
diff --git a/deployment_scripts/puppet/modules/redis/spec/spec_helper.rb b/deployment_scripts/puppet/modules/redis/spec/spec_helper.rb
new file mode 100644
index 0000000..5fda588
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/spec/spec_helper.rb
@@ -0,0 +1,17 @@
1dir = File.expand_path(File.dirname(__FILE__))
2$LOAD_PATH.unshift File.join(dir, 'lib')
3
4require 'mocha'
5require 'puppet'
6require 'rspec'
7require 'spec/autorun'
8
9Spec::Runner.configure do |config|
10 config.mock_with :mocha
11end
12
13# We need this because the RAL uses 'should' as a method. This
14# allows us the same behaviour but with a different method name.
15class Object
16 alias :must :should
17end
diff --git a/deployment_scripts/puppet/modules/redis/templates/logrotate.erb b/deployment_scripts/puppet/modules/redis/templates/logrotate.erb
new file mode 100644
index 0000000..b9ba724
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/templates/logrotate.erb
@@ -0,0 +1,9 @@
1<%= @conf_logfile_real %> {
2 weekly
3 rotate 10
4 copytruncate
5 delaycompress
6 compress
7 notifempty
8 missingok
9}
diff --git a/deployment_scripts/puppet/modules/redis/templates/redis.conf.erb b/deployment_scripts/puppet/modules/redis/templates/redis.conf.erb
new file mode 100644
index 0000000..aec4179
--- /dev/null
+++ b/deployment_scripts/puppet/modules/redis/templates/redis.conf.erb
@@ -0,0 +1,2790 @@
1<%- if @redis_version_real == "2.2.x" -%>
2# MANAGED BY PUPPET #
3#
4# Redis 2.2 configuration file example
5
6# Note on units: when memory size is needed, it is possible to specifiy
7# it in the usual form of 1k 5GB 4M and so forth:
8#
9# 1k => 1000 bytes
10# 1kb => 1024 bytes
11# 1m => 1000000 bytes
12# 1mb => 1024*1024 bytes
13# 1g => 1000000000 bytes
14# 1gb => 1024*1024*1024 bytes
15#
16# units are case insensitive so 1GB 1Gb 1gB are all the same.
17
18# By default Redis does not run as a daemon. Use 'yes' if you need it.
19# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
20<%- if @conf_daemonize -%>
21daemonize <%= @conf_daemonize %>
22<%- end -%>
23
24# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
25# default. You can specify a custom pid file location here.
26pidfile <%= @conf_pidfile_real %>
27
28# Accept connections on the specified port, default is 6379.
29# If port 0 is specified Redis will not listen on a TCP socket.
30<%- if @conf_port -%>
31port <%= @conf_port %>
32<%- end -%>
33
34# If you want you can bind a single interface, if the bind option is not
35# specified all the interfaces will listen for incoming connections.
36#
37# bind 127.0.0.1
38<%- if @conf_bind -%>
39bind <%= @conf_bind %>
40<%- end -%>
41
42# Specify the path for the unix socket that will be used to listen for
43# incoming connections. There is no default, so Redis will not listen
44# on a unix socket when not specified.
45#
46# unixsocket /tmp/redis.sock
47<%- if @conf_unixsocket -%>
48unixsocket <%= @conf_unixsocket %>
49<%- end -%>
50
51# Close the connection after a client is idle for N seconds (0 to disable)
52<%- if @conf_timeout -%>
53timeout <%= @conf_timeout %>
54<%- end -%>
55
56# Set server verbosity to 'debug'
57# it can be one of:
58# debug (a lot of information, useful for development/testing)
59# verbose (many rarely useful info, but not a mess like the debug level)
60# notice (moderately verbose, what you want in production probably)
61# warning (only very important / critical messages are logged)
62<%- if @conf_loglevel -%>
63loglevel <%= @conf_loglevel %>
64<%- end -%>
65
66# Specify the log file name. Also 'stdout' can be used to force
67# Redis to log on the standard output. Note that if you use standard
68# output for logging but daemonize, logs will be sent to /dev/null
69logfile <%= @conf_logfile_real %>
70
71# To enable logging to the system logger, just set 'syslog-enabled' to yes,
72# and optionally update the other syslog parameters to suit your needs.
73# syslog-enabled no
74<%- if @conf_syslog_enabled -%>
75syslog-enabled <%= @conf_syslog_enabled %>
76<%- end -%>
77
78# Specify the syslog identity.
79# syslog-ident redis
80<%- if @conf_syslog_ident -%>
81syslog-ident <%= @conf_syslog_ident %>
82<%- end -%>
83
84# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
85# syslog-facility local0
86<%- if @conf_syslog_facility -%>
87syslog-facility <%= @conf_syslog_facility %>
88<%- end -%>
89
90# Set the number of databases. The default database is DB 0, you can select
91# a different one on a per-connection basis using SELECT <dbid> where
92# dbid is a number between 0 and 'databases'-1
93<%- if @conf_databases -%>
94databases <%= @conf_databases %>
95<%- end -%>
96
97################################ SNAPSHOTTING #################################
98#
99# Save the DB on disk:
100#
101# save <seconds> <changes>
102#
103# Will save the DB if both the given number of seconds and the given
104# number of write operations against the DB occurred.
105#
106# In the example below the behaviour will be to save:
107# after 900 sec (15 min) if at least 1 key changed
108# after 300 sec (5 min) if at least 10 keys changed
109# after 60 sec if at least 10000 keys changed
110#
111# Note: you can disable saving at all commenting all the "save" lines.
112<%- if @conf_nosave -%>
113# do not persist to disk
114<%- else -%>
115<%- @conf_save.sort.each do |seconds, changes| -%>
116save <%= seconds -%> <%= changes -%> <%= "\n" -%>
117<%- end -%>
118<%- end -%>
119
120# Compress string objects using LZF when dump .rdb databases?
121# For default that's set to 'yes' as it's almost always a win.
122# If you want to save some CPU in the saving child set it to 'no' but
123# the dataset will likely be bigger if you have compressible values or keys.
124<%- if @conf_rdbcompression -%>
125rdbcompression <%= @conf_rdbcompression %>
126<%- end -%>
127
128# The filename where to dump the DB
129<%- if @conf_dbfilename -%>
130dbfilename <%= @conf_dbfilename %>
131<%- end -%>
132
133# The working directory.
134#
135# The DB will be written inside this directory, with the filename specified
136# above using the 'dbfilename' configuration directive.
137#
138# Also the Append Only File will be created inside this directory.
139#
140# Note that you must specify a directory here, not a file name.
141<%- if @conf_dir -%>
142dir <%= @conf_dir %>
143<%- end -%>
144
145################################# REPLICATION #################################
146
147# Master-Slave replication. Use slaveof to make a Redis instance a copy of
148# another Redis server. Note that the configuration is local to the slave
149# so for example it is possible to configure the slave to save the DB with a
150# different interval, or to listen to another port, and so on.
151#
152# slaveof <masterip> <masterport>
153<%- if @conf_slaveof -%>
154slaveof <%= @conf_slaveof %>
155<%- end -%>
156
157# If the master is password protected (using the "requirepass" configuration
158# directive below) it is possible to tell the slave to authenticate before
159# starting the replication synchronization process, otherwise the master will
160# refuse the slave request.
161#
162# masterauth <master-password>
163<%- if @conf_masterauth -%>
164masterauth <%= @conf_masterauth %>
165<%- end -%>
166
167# When a slave lost the connection with the master, or when the replication
168# is still in progress, the slave can act in two different ways:
169#
170# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
171# still reply to client requests, possibly with out of data data, or the
172# data set may just be empty if this is the first synchronization.
173#
174# 2) if slave-serve-stale data is set to 'no' the slave will reply with
175# an error "SYNC with master in progress" to all the kind of commands
176# but to INFO and SLAVEOF.
177#
178<%- if @conf_slave_serve_stale_data -%>
179slave-serve-stale-data <%= @conf_slave_serve_stale_data %>
180<%- end -%>
181
182################################## SECURITY ###################################
183
184# Require clients to issue AUTH <PASSWORD> before processing any other
185# commands. This might be useful in environments in which you do not trust
186# others with access to the host running redis-server.
187#
188# This should stay commented out for backward compatibility and because most
189# people do not need auth (e.g. they run their own servers).
190#
191# Warning: since Redis is pretty fast an outside user can try up to
192# 150k passwords per second against a good box. This means that you should
193# use a very strong password otherwise it will be very easy to break.
194#
195# requirepass foobared
196<%- if @conf_requirepass -%>
197requirepass <%= @conf_requirepass %>
198<%- end -%>
199
200# Command renaming.
201#
202# It is possilbe to change the name of dangerous commands in a shared
203# environment. For instance the CONFIG command may be renamed into something
204# of hard to guess so that it will be still available for internal-use
205# tools but not available for general clients.
206#
207# Example:
208#
209# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
210#
211# It is also possilbe to completely kill a command renaming it into
212# an empty string:
213#
214# rename-command CONFIG ""
215
216################################### LIMITS ####################################
217
218# Set the max number of connected clients at the same time. By default there
219# is no limit, and it's up to the number of file descriptors the Redis process
220# is able to open. The special value '0' means no limits.
221# Once the limit is reached Redis will close all the new connections sending
222# an error 'max number of clients reached'.
223#
224# maxclients 128
225<%- if @conf_maxclients -%>
226maxclients <%= @conf_maxclients %>
227<%- end -%>
228
229# Don't use more memory than the specified amount of bytes.
230# When the memory limit is reached Redis will try to remove keys with an
231# EXPIRE set. It will try to start freeing keys that are going to expire
232# in little time and preserve keys with a longer time to live.
233# Redis will also try to remove objects from free lists if possible.
234#
235# If all this fails, Redis will start to reply with errors to commands
236# that will use more memory, like SET, LPUSH, and so on, and will continue
237# to reply to most read-only commands like GET.
238#
239# WARNING: maxmemory can be a good idea mainly if you want to use Redis as a
240# 'state' server or cache, not as a real DB. When Redis is used as a real
241# database the memory usage will grow over the weeks, it will be obvious if
242# it is going to use too much memory in the long run, and you'll have the time
243# to upgrade. With maxmemory after the limit is reached you'll start to get
244# errors for write operations, and this may even lead to DB inconsistency.
245#
246# maxmemory <bytes>
247<%- if @conf_maxmemory -%>
248maxmemory <%= @conf_maxmemory %>
249<%- end -%>
250
251# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
252# is reached? You can select among five behavior:
253#
254# volatile-lru -> remove the key with an expire set using an LRU algorithm
255# allkeys-lru -> remove any key accordingly to the LRU algorithm
256# volatile-random -> remove a random key with an expire set
257# allkeys->random -> remove a random key, any key
258# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
259# noeviction -> don't expire at all, just return an error on write operations
260#
261# Note: with all the kind of policies, Redis will return an error on write
262# operations, when there are not suitable keys for eviction.
263#
264# At the date of writing this commands are: set setnx setex append
265# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
266# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
267# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
268# getset mset msetnx exec sort
269#
270# The default is:
271#
272# maxmemory-policy volatile-lru
273<%- if @conf_maxmemory_policy -%>
274maxmemory-policy <%= @conf_maxmemory_policy %>
275<%- end -%>
276
277# LRU and minimal TTL algorithms are not precise algorithms but approximated
278# algorithms (in order to save memory), so you can select as well the sample
279# size to check. For instance for default Redis will check three keys and
280# pick the one that was used less recently, you can change the sample size
281# using the following configuration directive.
282#
283# maxmemory-samples 3
284<%- if @conf_maxmemory_samples -%>
285maxmemory-samples <%= @conf_maxmemory_samples %>
286<%- end -%>
287
288############################## APPEND ONLY MODE ###############################
289
290# By default Redis asynchronously dumps the dataset on disk. If you can live
291# with the idea that the latest records will be lost if something like a crash
292# happens this is the preferred way to run Redis. If instead you care a lot
293# about your data and don't want to that a single record can get lost you should
294# enable the append only mode: when this mode is enabled Redis will append
295# every write operation received in the file appendonly.aof. This file will
296# be read on startup in order to rebuild the full dataset in memory.
297#
298# Note that you can have both the async dumps and the append only file if you
299# like (you have to comment the "save" statements above to disable the dumps).
300# Still if append only mode is enabled Redis will load the data from the
301# log file at startup ignoring the dump.rdb file.
302#
303# IMPORTANT: Check the BGREWRITEAOF to check how to rewrite the append
304# log file in background when it gets too big.
305
306<%- if @conf_appendonly -%>
307appendonly <%= @conf_appendonly %>
308<%- end -%>
309
310# The name of the append only file (default: "appendonly.aof")
311# appendfilename appendonly.aof
312<%- if @conf_appendfilename -%>
313appendfilename <%= @conf_appendfilename %>
314<%- end -%>
315
316# The fsync() call tells the Operating System to actually write data on disk
317# instead to wait for more data in the output buffer. Some OS will really flush
318# data on disk, some other OS will just try to do it ASAP.
319#
320# Redis supports three different modes:
321#
322# no: don't fsync, just let the OS flush the data when it wants. Faster.
323# always: fsync after every write to the append only log . Slow, Safest.
324# everysec: fsync only if one second passed since the last fsync. Compromise.
325#
326# The default is "everysec" that's usually the right compromise between
327# speed and data safety. It's up to you to understand if you can relax this to
328# "no" that will will let the operating system flush the output buffer when
329# it wants, for better performances (but if you can live with the idea of
330# some data loss consider the default persistence mode that's snapshotting),
331# or on the contrary, use "always" that's very slow but a bit safer than
332# everysec.
333#
334# If unsure, use "everysec".
335
336# appendfsync always
337<%- if @conf_appendfsync -%>
338appendfsync <%= @conf_appendfsync %>
339<%- end -%>
340# appendfsync no
341
342# When the AOF fsync policy is set to always or everysec, and a background
343# saving process (a background save or AOF log background rewriting) is
344# performing a lot of I/O against the disk, in some Linux configurations
345# Redis may block too long on the fsync() call. Note that there is no fix for
346# this currently, as even performing fsync in a different thread will block
347# our synchronous write(2) call.
348#
349# In order to mitigate this problem it's possible to use the following option
350# that will prevent fsync() from being called in the main process while a
351# BGSAVE or BGREWRITEAOF is in progress.
352#
353# This means that while another child is saving the durability of Redis is
354# the same as "appendfsync none", that in pratical terms means that it is
355# possible to lost up to 30 seconds of log in the worst scenario (with the
356# default Linux settings).
357#
358# If you have latency problems turn this to "yes". Otherwise leave it as
359# "no" that is the safest pick from the point of view of durability.
360<%- if @conf_no_appendfsync_on_rewrite -%>
361no-appendfsync-on-rewrite <%= @conf_no_appendfsync_on_rewrite %>
362<%- end -%>
363
364################################## SLOW LOG ###################################
365
366# The Redis Slow Log is a system to log queries that exceeded a specified
367# execution time. The execution time does not include the I/O operations
368# like talking with the client, sending the reply and so forth,
369# but just the time needed to actually execute the command (this is the only
370# stage of command execution where the thread is blocked and can not serve
371# other requests in the meantime).
372#
373# You can configure the slow log with two parameters: one tells Redis
374# what is the execution time, in microseconds, to exceed in order for the
375# command to get logged, and the other parameter is the length of the
376# slow log. When a new command is logged the oldest one is removed from the
377# queue of logged commands.
378
379# The following time is expressed in microseconds, so 1000000 is equivalent
380# to one second. Note that a negative number disables the slow log, while
381# a value of zero forces the logging of every command.
382<%- if @conf_slowlog_log_slower_than -%>
383slowlog-log-slower-than <%= @conf_slowlog_log_slower_than %>
384<%- end -%>
385
386# There is no limit to this length. Just be aware that it will consume memory.
387# You can reclaim memory used by the slow log with SLOWLOG RESET.
388<%- if @conf_slowlog_max_len -%>
389slowlog-max-len <%= @conf_slowlog_max_len %>
390<%- end -%>
391
392################################ VIRTUAL MEMORY ###############################
393
394### WARNING! Virtual Memory is deprecated in Redis 2.4
395### The use of Virtual Memory is strongly discouraged.
396
397# Virtual Memory allows Redis to work with datasets bigger than the actual
398# amount of RAM needed to hold the whole dataset in memory.
399# In order to do so very used keys are taken in memory while the other keys
400# are swapped into a swap file, similarly to what operating systems do
401# with memory pages.
402#
403# To enable VM just set 'vm-enabled' to yes, and set the following three
404# VM parameters accordingly to your needs.
405
406<%- if @conf_vm_enabled -%>
407vm-enabled <%= @conf_vm_enabled %>
408<%- end -%>
409# vm-enabled yes
410
411# This is the path of the Redis swap file. As you can guess, swap files
412# can't be shared by different Redis instances, so make sure to use a swap
413# file for every redis process you are running. Redis will complain if the
414# swap file is already in use.
415#
416# The best kind of storage for the Redis swap file (that's accessed at random)
417# is a Solid State Disk (SSD).
418#
419# *** WARNING *** if you are using a shared hosting the default of putting
420# the swap file under /tmp is not secure. Create a dir with access granted
421# only to Redis user and configure Redis to create the swap file there.
422<%- if @conf_vm_swap_file -%>
423vm-swap-file <%= @conf_vm_swap_file %>
424<%- end -%>
425
426# vm-max-memory configures the VM to use at max the specified amount of
427# RAM. Everything that deos not fit will be swapped on disk *if* possible, that
428# is, if there is still enough contiguous space in the swap file.
429#
430# With vm-max-memory 0 the system will swap everything it can. Not a good
431# default, just specify the max amount of RAM you can in bytes, but it's
432# better to leave some margin. For instance specify an amount of RAM
433# that's more or less between 60 and 80% of your free RAM.
434<%- if @conf_vm_max_memory -%>
435vm-max-memory <%= @conf_vm_max_memory %>
436<%- end -%>
437
438# Redis swap files is split into pages. An object can be saved using multiple
439# contiguous pages, but pages can't be shared between different objects.
440# So if your page is too big, small objects swapped out on disk will waste
441# a lot of space. If you page is too small, there is less space in the swap
442# file (assuming you configured the same number of total swap file pages).
443#
444# If you use a lot of small objects, use a page size of 64 or 32 bytes.
445# If you use a lot of big objects, use a bigger page size.
446# If unsure, use the default :)
447<%- if @conf_vm_page_size -%>
448vm-page-size <%= @conf_vm_page_size %>
449<%- end -%>
450
451# Number of total memory pages in the swap file.
452# Given that the page table (a bitmap of free/used pages) is taken in memory,
453# every 8 pages on disk will consume 1 byte of RAM.
454#
455# The total swap size is vm-page-size * vm-pages
456#
457# With the default of 32-bytes memory pages and 134217728 pages Redis will
458# use a 4 GB swap file, that will use 16 MB of RAM for the page table.
459#
460# It's better to use the smallest acceptable value for your application,
461# but the default is large in order to work in most conditions.
462<%- if @conf_vm_pages -%>
463vm-pages <%= @conf_vm_pages %>
464<%- end -%>
465
466# Max number of VM I/O threads running at the same time.
467# This threads are used to read/write data from/to swap file, since they
468# also encode and decode objects from disk to memory or the reverse, a bigger
469# number of threads can help with big objects even if they can't help with
470# I/O itself as the physical device may not be able to couple with many
471# reads/writes operations at the same time.
472#
473# The special value of 0 turn off threaded I/O and enables the blocking
474# Virtual Memory implementation.
475<%- if @conf_vm_max_threads -%>
476vm-max-threads <%= @conf_vm_max_threads %>
477<%- end -%>
478
479############################### ADVANCED CONFIG ###############################
480
481# Hashes are encoded in a special way (much more memory efficient) when they
482# have at max a given numer of elements, and the biggest element does not
483# exceed a given threshold. You can configure this limits with the following
484# configuration directives.
485<%- if @conf_hash_max_zipmap_entries -%>
486hash-max-zipmap-entries <%= @conf_hash_max_zipmap_entries %>
487<%- end -%>
488<%- if @conf_hash_max_zipmap_value -%>
489hash-max-zipmap-value <%= @conf_hash_max_zipmap_value %>
490<%- end -%>
491
492# Similarly to hashes, small lists are also encoded in a special way in order
493# to save a lot of space. The special representation is only used when
494# you are under the following limits:
495<%- if @conf_list_max_ziplist_entries -%>
496list-max-ziplist-entries <%= @conf_list_max_ziplist_entries %>
497<%- end -%>
498<%- if @conf_list_max_ziplist_value -%>
499list-max-ziplist-value <%= @conf_list_max_ziplist_value %>
500<%- end -%>
501
502# Sets have a special encoding in just one case: when a set is composed
503# of just strings that happens to be integers in radix 10 in the range
504# of 64 bit signed integers.
505# The following configuration setting sets the limit in the size of the
506# set in order to use this special memory saving encoding.
507<%- if @conf_set_max_intset_entries -%>
508set-max-intset-entries <%= @conf_set_max_intset_entries %>
509<%- end -%>
510
511# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
512# order to help rehashing the main Redis hash table (the one mapping top-level
513# keys to values). The hash table implementation redis uses (see dict.c)
514# performs a lazy rehashing: the more operation you run into an hash table
515# that is rhashing, the more rehashing "steps" are performed, so if the
516# server is idle the rehashing is never complete and some more memory is used
517# by the hash table.
518#
519# The default is to use this millisecond 10 times every second in order to
520# active rehashing the main dictionaries, freeing memory when possible.
521#
522# If unsure:
523# use "activerehashing no" if you have hard latency requirements and it is
524# not a good thing in your environment that Redis can reply form time to time
525# to queries with 2 milliseconds delay.
526#
527# use "activerehashing yes" if you don't have such hard requirements but
528# want to free memory asap when possible.
529<%- if @conf_activerehashing -%>
530activerehashing <%= @conf_activerehashing %>
531<%- end -%>
532
533################################## INCLUDES ###################################
534
535# Include one or more other config files here. This is useful if you
536# have a standard template that goes to all redis server but also need
537# to customize a few per-server settings. Include files can include
538# other files, so use this wisely.
539#
540# include /path/to/local.conf
541# include /path/to/other.conf
542<%- if @conf_include -%>
543<%- @conf_include.each do |include| -%>
544include <%= include %><%= "\n" -%>
545<%- end -%>
546<%- end -%>
547<%- end -%>
548<%- if @redis_version_real == "2.4.x" -%>
549# MANAGED BY PUPPET #
550#
551# Redis 2.4 configuration file example
552
553# Note on units: when memory size is needed, it is possible to specifiy
554# it in the usual form of 1k 5GB 4M and so forth:
555#
556# 1k => 1000 bytes
557# 1kb => 1024 bytes
558# 1m => 1000000 bytes
559# 1mb => 1024*1024 bytes
560# 1g => 1000000000 bytes
561# 1gb => 1024*1024*1024 bytes
562#
563# units are case insensitive so 1GB 1Gb 1gB are all the same.
564
565# By default Redis does not run as a daemon. Use 'yes' if you need it.
566# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
567<%- if @conf_daemonize -%>
568daemonize <%= @conf_daemonize %>
569<%- end -%>
570
571# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
572# default. You can specify a custom pid file location here.
573pidfile <%= @conf_pidfile_real %>
574
575# Accept connections on the specified port, default is 6379.
576# If port 0 is specified Redis will not listen on a TCP socket.
577<%- if @conf_port -%>
578port <%= @conf_port %>
579<%- end -%>
580
581# If you want you can bind a single interface, if the bind option is not
582# specified all the interfaces will listen for incoming connections.
583#
584# bind 127.0.0.1
585<%- if @conf_bind -%>
586bind <%= @conf_bind %>
587<%- end -%>
588
589# Specify the path for the unix socket that will be used to listen for
590# incoming connections. There is no default, so Redis will not listen
591# on a unix socket when not specified.
592#
593# unixsocket /tmp/redis.sock
594<%- if @conf_unixsocket -%>
595unixsocket <%= @conf_unixsocket %>
596<%- end -%>
597# unixsocketperm 755
598<%- if @conf_unixsocketperm -%>
599unixsocketperm <%= @conf_unixsocketperm %>
600<%- end -%>
601
602# Close the connection after a client is idle for N seconds (0 to disable)
603<%- if @conf_timeout -%>
604timeout <%= @conf_timeout %>
605<%- end -%>
606
607# Set server verbosity to 'debug'
608# it can be one of:
609# debug (a lot of information, useful for development/testing)
610# verbose (many rarely useful info, but not a mess like the debug level)
611# notice (moderately verbose, what you want in production probably)
612# warning (only very important / critical messages are logged)
613<%- if @conf_loglevel -%>
614loglevel <%= @conf_loglevel %>
615<%- end -%>
616
617# Specify the log file name. Also 'stdout' can be used to force
618# Redis to log on the standard output. Note that if you use standard
619# output for logging but daemonize, logs will be sent to /dev/null
620logfile <%= @conf_logfile_real %>
621
622# To enable logging to the system logger, just set 'syslog-enabled' to yes,
623# and optionally update the other syslog parameters to suit your needs.
624# syslog-enabled no
625<%- if @conf_syslog_enabled -%>
626syslog-enabled <%= @conf_syslog_enabled %>
627<%- end -%>
628
629# Specify the syslog identity.
630# syslog-ident redis
631<%- if @conf_syslog_ident -%>
632syslog-ident <%= @conf_syslog_ident %>
633<%- end -%>
634
635# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
636# syslog-facility local0
637<%- if @conf_syslog_facility -%>
638syslog-facility <%= @conf_syslog_facility %>
639<%- end -%>
640
641# Set the number of databases. The default database is DB 0, you can select
642# a different one on a per-connection basis using SELECT <dbid> where
643# dbid is a number between 0 and 'databases'-1
644<%- if @conf_databases -%>
645databases <%= @conf_databases %>
646<%- end -%>
647
648################################ SNAPSHOTTING #################################
649#
650# Save the DB on disk:
651#
652# save <seconds> <changes>
653#
654# Will save the DB if both the given number of seconds and the given
655# number of write operations against the DB occurred.
656#
657# In the example below the behaviour will be to save:
658# after 900 sec (15 min) if at least 1 key changed
659# after 300 sec (5 min) if at least 10 keys changed
660# after 60 sec if at least 10000 keys changed
661#
662# Note: you can disable saving at all commenting all the "save" lines.
663<%- if @conf_nosave -%>
664# do not persist to disk
665<%- else -%>
666<%- @conf_save.sort.each do |seconds, changes| -%>
667save <%= seconds -%> <%= changes -%> <%= "\n" -%>
668<%- end -%>
669<%- end -%>
670
671# Compress string objects using LZF when dump .rdb databases?
672# For default that's set to 'yes' as it's almost always a win.
673# If you want to save some CPU in the saving child set it to 'no' but
674# the dataset will likely be bigger if you have compressible values or keys.
675<%- if @conf_rdbcompression -%>
676rdbcompression <%= @conf_rdbcompression %>
677<%- end -%>
678
679# The filename where to dump the DB
680<%- if @conf_dbfilename -%>
681dbfilename <%= @conf_dbfilename %>
682<%- end -%>
683
684# The working directory.
685#
686# The DB will be written inside this directory, with the filename specified
687# above using the 'dbfilename' configuration directive.
688#
689# Also the Append Only File will be created inside this directory.
690#
691# Note that you must specify a directory here, not a file name.
692<%- if @conf_dir -%>
693dir <%= @conf_dir %>
694<%- end -%>
695
696################################# REPLICATION #################################
697
698# Master-Slave replication. Use slaveof to make a Redis instance a copy of
699# another Redis server. Note that the configuration is local to the slave
700# so for example it is possible to configure the slave to save the DB with a
701# different interval, or to listen to another port, and so on.
702#
703# slaveof <masterip> <masterport>
704<%- if @conf_slaveof -%>
705slaveof <%= @conf_slaveof %>
706<%- end -%>
707
708# If the master is password protected (using the "requirepass" configuration
709# directive below) it is possible to tell the slave to authenticate before
710# starting the replication synchronization process, otherwise the master will
711# refuse the slave request.
712#
713# masterauth <master-password>
714<%- if @conf_masterauth -%>
715masterauth <%= @conf_masterauth %>
716<%- end -%>
717
718# When a slave lost the connection with the master, or when the replication
719# is still in progress, the slave can act in two different ways:
720#
721# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
722# still reply to client requests, possibly with out of data data, or the
723# data set may just be empty if this is the first synchronization.
724#
725# 2) if slave-serve-stale data is set to 'no' the slave will reply with
726# an error "SYNC with master in progress" to all the kind of commands
727# but to INFO and SLAVEOF.
728#
729<%- if @conf_slave_serve_stale_data -%>
730slave-serve-stale-data <%= @conf_slave_serve_stale_data %>
731<%- end -%>
732
733# Slaves send PINGs to server in a predefined interval. It's possible to change
734# this interval with the repl_ping_slave_period option. The default value is 10
735# seconds.
736#
737# repl-ping-slave-period 10
738<%- if @conf_repl_ping_slave_period -%>
739repl-ping-slave-period <%= @conf_repl_ping_slave_period %>
740<%- end -%>
741
742# The following option sets a timeout for both Bulk transfer I/O timeout and
743# master data or ping response timeout. The default value is 60 seconds.
744#
745# It is important to make sure that this value is greater than the value
746# specified for repl-ping-slave-period otherwise a timeout will be detected
747# every time there is low traffic between the master and the slave.
748#
749# repl-timeout 60
750<%- if @conf_repl_timeout -%>
751repl-timeout <%= @conf_repl_timeout %>
752<%- end -%>
753
754# The slave priority is an integer number published by Redis in the INFO output.
755# It is used by Redis Sentinel in order to select a slave to promote into a
756# master if the master is no longer working correctly.
757#
758# A slave with a low priority number is considered better for promotion, so
759# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
760# pick the one wtih priority 10, that is the lowest.
761#
762# However a special priority of 0 marks the slave as not able to perform the
763# role of master, so a slave with priority of 0 will never be selected by
764# Redis Sentinel for promotion.
765#
766# By default the priority is 100.
767<%- if @conf_slave_priority -%>
768slave-priority <%= @conf_slave_priority %>
769<%- end -%>
770
771################################## SECURITY ###################################
772
773# Require clients to issue AUTH <PASSWORD> before processing any other
774# commands. This might be useful in environments in which you do not trust
775# others with access to the host running redis-server.
776#
777# This should stay commented out for backward compatibility and because most
778# people do not need auth (e.g. they run their own servers).
779#
780# Warning: since Redis is pretty fast an outside user can try up to
781# 150k passwords per second against a good box. This means that you should
782# use a very strong password otherwise it will be very easy to break.
783#
784# requirepass foobared
785<%- if @conf_requirepass -%>
786requirepass <%= @conf_requirepass %>
787<%- end -%>
788
789# Command renaming.
790#
791# It is possilbe to change the name of dangerous commands in a shared
792# environment. For instance the CONFIG command may be renamed into something
793# of hard to guess so that it will be still available for internal-use
794# tools but not available for general clients.
795#
796# Example:
797#
798# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
799#
800# It is also possilbe to completely kill a command renaming it into
801# an empty string:
802#
803# rename-command CONFIG ""
804
805################################### LIMITS ####################################
806
807# Set the max number of connected clients at the same time. By default there
808# is no limit, and it's up to the number of file descriptors the Redis process
809# is able to open. The special value '0' means no limits.
810# Once the limit is reached Redis will close all the new connections sending
811# an error 'max number of clients reached'.
812#
813# maxclients 128
814<%- if @conf_maxclients -%>
815maxclients <%= @conf_maxclients %>
816<%- end -%>
817
818# Don't use more memory than the specified amount of bytes.
819# When the memory limit is reached Redis will try to remove keys
820# accordingly to the eviction policy selected (see maxmemmory-policy).
821#
822# If Redis can't remove keys according to the policy, or if the policy is
823# set to 'noeviction', Redis will start to reply with errors to commands
824# that would use more memory, like SET, LPUSH, and so on, and will continue
825# to reply to read-only commands like GET.
826#
827# This option is usually useful when using Redis as an LRU cache, or to set
828# an hard memory limit for an instance (using the 'noeviction' policy).
829#
830# WARNING: If you have slaves attached to an instance with maxmemory on,
831# the size of the output buffers needed to feed the slaves are subtracted
832# from the used memory count, so that network problems / resyncs will
833# not trigger a loop where keys are evicted, and in turn the output
834# buffer of slaves is full with DELs of keys evicted triggering the deletion
835# of more keys, and so forth until the database is completely emptied.
836#
837# In short... if you have slaves attached it is suggested that you set a lower
838# limit for maxmemory so that there is some free RAM on the system for slave
839# output buffers (but this is not needed if the policy is 'noeviction').
840#
841# maxmemory <bytes>
842<%- if @conf_maxmemory -%>
843maxmemory <%= @conf_maxmemory %>
844<%- end -%>
845
846# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
847# is reached? You can select among five behavior:
848#
849# volatile-lru -> remove the key with an expire set using an LRU algorithm
850# allkeys-lru -> remove any key accordingly to the LRU algorithm
851# volatile-random -> remove a random key with an expire set
852# allkeys->random -> remove a random key, any key
853# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
854# noeviction -> don't expire at all, just return an error on write operations
855#
856# Note: with all the kind of policies, Redis will return an error on write
857# operations, when there are not suitable keys for eviction.
858#
859# At the date of writing this commands are: set setnx setex append
860# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
861# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
862# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
863# getset mset msetnx exec sort
864#
865# The default is:
866#
867# maxmemory-policy volatile-lru
868<%- if @conf_maxmemory_policy -%>
869maxmemory-policy <%= @conf_maxmemory_policy %>
870<%- end -%>
871
872# LRU and minimal TTL algorithms are not precise algorithms but approximated
873# algorithms (in order to save memory), so you can select as well the sample
874# size to check. For instance for default Redis will check three keys and
875# pick the one that was used less recently, you can change the sample size
876# using the following configuration directive.
877#
878# maxmemory-samples 3
879<%- if @conf_maxmemory_samples -%>
880maxmemory-samples <%= @conf_maxmemory_samples %>
881<%- end -%>
882
883############################## APPEND ONLY MODE ###############################
884
885# By default Redis asynchronously dumps the dataset on disk. If you can live
886# with the idea that the latest records will be lost if something like a crash
887# happens this is the preferred way to run Redis. If instead you care a lot
888# about your data and don't want to that a single record can get lost you should
889# enable the append only mode: when this mode is enabled Redis will append
890# every write operation received in the file appendonly.aof. This file will
891# be read on startup in order to rebuild the full dataset in memory.
892#
893# Note that you can have both the async dumps and the append only file if you
894# like (you have to comment the "save" statements above to disable the dumps).
895# Still if append only mode is enabled Redis will load the data from the
896# log file at startup ignoring the dump.rdb file.
897#
898# IMPORTANT: Check the BGREWRITEAOF to check how to rewrite the append
899# log file in background when it gets too big.
900
901<%- if @conf_appendonly -%>
902appendonly <%= @conf_appendonly %>
903<%- end -%>
904
905# The name of the append only file (default: "appendonly.aof")
906# appendfilename appendonly.aof
907<%- if @conf_appendfilename -%>
908appendfilename <%= @conf_appendfilename %>
909<%- end -%>
910
911# The fsync() call tells the Operating System to actually write data on disk
912# instead to wait for more data in the output buffer. Some OS will really flush
913# data on disk, some other OS will just try to do it ASAP.
914#
915# Redis supports three different modes:
916#
917# no: don't fsync, just let the OS flush the data when it wants. Faster.
918# always: fsync after every write to the append only log . Slow, Safest.
919# everysec: fsync only if one second passed since the last fsync. Compromise.
920#
921# The default is "everysec" that's usually the right compromise between
922# speed and data safety. It's up to you to understand if you can relax this to
923# "no" that will will let the operating system flush the output buffer when
924# it wants, for better performances (but if you can live with the idea of
925# some data loss consider the default persistence mode that's snapshotting),
926# or on the contrary, use "always" that's very slow but a bit safer than
927# everysec.
928#
929# If unsure, use "everysec".
930
931# appendfsync always
932<%- if @conf_appendfsync -%>
933appendfsync <%= @conf_appendfsync %>
934<%- end -%>
935# appendfsync no
936
937# When the AOF fsync policy is set to always or everysec, and a background
938# saving process (a background save or AOF log background rewriting) is
939# performing a lot of I/O against the disk, in some Linux configurations
940# Redis may block too long on the fsync() call. Note that there is no fix for
941# this currently, as even performing fsync in a different thread will block
942# our synchronous write(2) call.
943#
944# In order to mitigate this problem it's possible to use the following option
945# that will prevent fsync() from being called in the main process while a
946# BGSAVE or BGREWRITEAOF is in progress.
947#
948# This means that while another child is saving the durability of Redis is
949# the same as "appendfsync none", that in pratical terms means that it is
950# possible to lost up to 30 seconds of log in the worst scenario (with the
951# default Linux settings).
952#
953# If you have latency problems turn this to "yes". Otherwise leave it as
954# "no" that is the safest pick from the point of view of durability.
955<%- if @conf_no_appendfsync_on_rewrite -%>
956no-appendfsync-on-rewrite <%= @conf_no_appendfsync_on_rewrite %>
957<%- end -%>
958
959# Automatic rewrite of the append only file.
960# Redis is able to automatically rewrite the log file implicitly calling
961# BGREWRITEAOF when the AOF log size will growth by the specified percentage.
962#
963# This is how it works: Redis remembers the size of the AOF file after the
964# latest rewrite (or if no rewrite happened since the restart, the size of
965# the AOF at startup is used).
966#
967# This base size is compared to the current size. If the current size is
968# bigger than the specified percentage, the rewrite is triggered. Also
969# you need to specify a minimal size for the AOF file to be rewritten, this
970# is useful to avoid rewriting the AOF file even if the percentage increase
971# is reached but it is still pretty small.
972#
973# Specify a precentage of zero in order to disable the automatic AOF
974# rewrite feature.
975
976<%- if @conf_auto_aof_rewrite_percentage -%>
977auto-aof-rewrite-percentage <%= @conf_auto_aof_rewrite_percentage %>
978<%- end -%>
979<%- if @conf_auto_aof_rewrite_min_size -%>
980auto-aof-rewrite-min-size <%= @conf_auto_aof_rewrite_min_size %>
981<%- end -%>
982
983################################## SLOW LOG ###################################
984
985# The Redis Slow Log is a system to log queries that exceeded a specified
986# execution time. The execution time does not include the I/O operations
987# like talking with the client, sending the reply and so forth,
988# but just the time needed to actually execute the command (this is the only
989# stage of command execution where the thread is blocked and can not serve
990# other requests in the meantime).
991#
992# You can configure the slow log with two parameters: one tells Redis
993# what is the execution time, in microseconds, to exceed in order for the
994# command to get logged, and the other parameter is the length of the
995# slow log. When a new command is logged the oldest one is removed from the
996# queue of logged commands.
997
998# The following time is expressed in microseconds, so 1000000 is equivalent
999# to one second. Note that a negative number disables the slow log, while
1000# a value of zero forces the logging of every command.
1001<%- if @conf_slowlog_log_slower_than -%>
1002slowlog-log-slower-than <%= @conf_slowlog_log_slower_than %>
1003<%- end -%>
1004
1005# There is no limit to this length. Just be aware that it will consume memory.
1006# You can reclaim memory used by the slow log with SLOWLOG RESET.
1007<%- if @conf_slowlog_max_len -%>
1008slowlog-max-len <%= @conf_slowlog_max_len %>
1009<%- end -%>
1010
1011################################ VIRTUAL MEMORY ###############################
1012
1013### WARNING! Virtual Memory is deprecated in Redis 2.4
1014### The use of Virtual Memory is strongly discouraged.
1015
1016# Virtual Memory allows Redis to work with datasets bigger than the actual
1017# amount of RAM needed to hold the whole dataset in memory.
1018# In order to do so very used keys are taken in memory while the other keys
1019# are swapped into a swap file, similarly to what operating systems do
1020# with memory pages.
1021#
1022# To enable VM just set 'vm-enabled' to yes, and set the following three
1023# VM parameters accordingly to your needs.
1024
1025<%- if @conf_vm_enabled -%>
1026vm-enabled <%= @conf_vm_enabled %>
1027<%- end -%>
1028# vm-enabled yes
1029
1030# This is the path of the Redis swap file. As you can guess, swap files
1031# can't be shared by different Redis instances, so make sure to use a swap
1032# file for every redis process you are running. Redis will complain if the
1033# swap file is already in use.
1034#
1035# The best kind of storage for the Redis swap file (that's accessed at random)
1036# is a Solid State Disk (SSD).
1037#
1038# *** WARNING *** if you are using a shared hosting the default of putting
1039# the swap file under /tmp is not secure. Create a dir with access granted
1040# only to Redis user and configure Redis to create the swap file there.
1041<%- if @conf_vm_swap_file -%>
1042vm-swap-file <%= @conf_vm_swap_file %>
1043<%- end -%>
1044
1045# vm-max-memory configures the VM to use at max the specified amount of
1046# RAM. Everything that deos not fit will be swapped on disk *if* possible, that
1047# is, if there is still enough contiguous space in the swap file.
1048#
1049# With vm-max-memory 0 the system will swap everything it can. Not a good
1050# default, just specify the max amount of RAM you can in bytes, but it's
1051# better to leave some margin. For instance specify an amount of RAM
1052# that's more or less between 60 and 80% of your free RAM.
1053<%- if @conf_vm_max_memory -%>
1054vm-max-memory <%= @conf_vm_max_memory %>
1055<%- end -%>
1056
1057# Redis swap files is split into pages. An object can be saved using multiple
1058# contiguous pages, but pages can't be shared between different objects.
1059# So if your page is too big, small objects swapped out on disk will waste
1060# a lot of space. If you page is too small, there is less space in the swap
1061# file (assuming you configured the same number of total swap file pages).
1062#
1063# If you use a lot of small objects, use a page size of 64 or 32 bytes.
1064# If you use a lot of big objects, use a bigger page size.
1065# If unsure, use the default :)
1066<%- if @conf_vm_page_size -%>
1067vm-page-size <%= @conf_vm_page_size %>
1068<%- end -%>
1069
1070# Number of total memory pages in the swap file.
1071# Given that the page table (a bitmap of free/used pages) is taken in memory,
1072# every 8 pages on disk will consume 1 byte of RAM.
1073#
1074# The total swap size is vm-page-size * vm-pages
1075#
1076# With the default of 32-bytes memory pages and 134217728 pages Redis will
1077# use a 4 GB swap file, that will use 16 MB of RAM for the page table.
1078#
1079# It's better to use the smallest acceptable value for your application,
1080# but the default is large in order to work in most conditions.
1081<%- if @conf_vm_pages -%>
1082vm-pages <%= @conf_vm_pages %>
1083<%- end -%>
1084
1085# Max number of VM I/O threads running at the same time.
1086# This threads are used to read/write data from/to swap file, since they
1087# also encode and decode objects from disk to memory or the reverse, a bigger
1088# number of threads can help with big objects even if they can't help with
1089# I/O itself as the physical device may not be able to couple with many
1090# reads/writes operations at the same time.
1091#
1092# The special value of 0 turn off threaded I/O and enables the blocking
1093# Virtual Memory implementation.
1094<%- if @conf_vm_max_threads -%>
1095vm-max-threads <%= @conf_vm_max_threads %>
1096<%- end -%>
1097
1098############################### ADVANCED CONFIG ###############################
1099
1100# Hashes are encoded in a special way (much more memory efficient) when they
1101# have at max a given numer of elements, and the biggest element does not
1102# exceed a given threshold. You can configure this limits with the following
1103# configuration directives.
1104<%- if @conf_hash_max_zipmap_entries -%>
1105hash-max-zipmap-entries <%= @conf_hash_max_zipmap_entries %>
1106<%- end -%>
1107<%- if @conf_hash_max_zipmap_value -%>
1108hash-max-zipmap-value <%= @conf_hash_max_zipmap_value %>
1109<%- end -%>
1110
1111# Similarly to hashes, small lists are also encoded in a special way in order
1112# to save a lot of space. The special representation is only used when
1113# you are under the following limits:
1114<%- if @conf_list_max_ziplist_entries -%>
1115list-max-ziplist-entries <%= @conf_list_max_ziplist_entries %>
1116<%- end -%>
1117<%- if @conf_list_max_ziplist_value -%>
1118list-max-ziplist-value <%= @conf_list_max_ziplist_value %>
1119<%- end -%>
1120
1121# Sets have a special encoding in just one case: when a set is composed
1122# of just strings that happens to be integers in radix 10 in the range
1123# of 64 bit signed integers.
1124# The following configuration setting sets the limit in the size of the
1125# set in order to use this special memory saving encoding.
1126<%- if @conf_set_max_intset_entries -%>
1127set-max-intset-entries <%= @conf_set_max_intset_entries %>
1128<%- end -%>
1129
1130# Similarly to hashes and lists, sorted sets are also specially encoded in
1131# order to save a lot of space. This encoding is only used when the length and
1132# elements of a sorted set are below the following limits:
1133<%- if @conf_zset_max_ziplist_entries -%>
1134zset-max-ziplist-entries <%= @conf_zset_max_ziplist_entries %>
1135<%- end -%>
1136<%- if @conf_zset_max_ziplist_value -%>
1137zset-max-ziplist-value <%= @conf_zset_max_ziplist_value %>
1138<%- end -%>
1139
1140# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
1141# order to help rehashing the main Redis hash table (the one mapping top-level
1142# keys to values). The hash table implementation redis uses (see dict.c)
1143# performs a lazy rehashing: the more operation you run into an hash table
1144# that is rhashing, the more rehashing "steps" are performed, so if the
1145# server is idle the rehashing is never complete and some more memory is used
1146# by the hash table.
1147#
1148# The default is to use this millisecond 10 times every second in order to
1149# active rehashing the main dictionaries, freeing memory when possible.
1150#
1151# If unsure:
1152# use "activerehashing no" if you have hard latency requirements and it is
1153# not a good thing in your environment that Redis can reply form time to time
1154# to queries with 2 milliseconds delay.
1155#
1156# use "activerehashing yes" if you don't have such hard requirements but
1157# want to free memory asap when possible.
1158<%- if @conf_activerehashing -%>
1159activerehashing <%= @conf_activerehashing %>
1160<%- end -%>
1161
1162################################## INCLUDES ###################################
1163
1164# Include one or more other config files here. This is useful if you
1165# have a standard template that goes to all redis server but also need
1166# to customize a few per-server settings. Include files can include
1167# other files, so use this wisely.
1168#
1169# include /path/to/local.conf
1170# include /path/to/other.conf
1171<%- if @conf_include -%>
1172<%- @conf_include.each do |include| -%>
1173include <%= include %><%= "\n" -%>
1174<%- end -%>
1175<%- end -%>
1176<%- end -%>
1177<%- if @redis_version_real == "2.6.x" -%>
1178# MANAGED BY PUPPET #
1179#
1180# Redis 2.6 configuration file example
1181
1182# Note on units: when memory size is needed, it is possible to specify
1183# it in the usual form of 1k 5GB 4M and so forth:
1184#
1185# 1k => 1000 bytes
1186# 1kb => 1024 bytes
1187# 1m => 1000000 bytes
1188# 1mb => 1024*1024 bytes
1189# 1g => 1000000000 bytes
1190# 1gb => 1024*1024*1024 bytes
1191#
1192# units are case insensitive so 1GB 1Gb 1gB are all the same.
1193
1194# By default Redis does not run as a daemon. Use 'yes' if you need it.
1195# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
1196<%- if @conf_daemonize -%>
1197daemonize <%= @conf_daemonize %>
1198<%- end -%>
1199
1200# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
1201# default. You can specify a custom pid file location here.
1202pidfile <%= @conf_pidfile_real %>
1203
1204# Accept connections on the specified port, default is 6379.
1205# If port 0 is specified Redis will not listen on a TCP socket.
1206<%- if @conf_port -%>
1207port <%= @conf_port %>
1208<%- end -%>
1209
1210# If you want you can bind a single interface, if the bind option is not
1211# specified all the interfaces will listen for incoming connections.
1212#
1213# bind 127.0.0.1
1214<%- if @conf_bind -%>
1215bind <%= @conf_bind %>
1216<%- end -%>
1217
1218# Specify the path for the unix socket that will be used to listen for
1219# incoming connections. There is no default, so Redis will not listen
1220# on a unix socket when not specified.
1221#
1222# unixsocket /tmp/redis.sock
1223<%- if @conf_unixsocket -%>
1224unixsocket <%= @conf_unixsocket %>
1225<%- end -%>
1226# unixsocketperm 755
1227<%- if @conf_unixsocketperm -%>
1228unixsocketperm <%= @conf_unixsocketperm %>
1229<%- end -%>
1230
1231# Close the connection after a client is idle for N seconds (0 to disable)
1232<%- if @conf_timeout -%>
1233timeout <%= @conf_timeout %>
1234<%- end -%>
1235
1236# TCP keepalive.
1237#
1238# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
1239# of communication. This is useful for two reasons:
1240#
1241# 1) Detect dead peers.
1242# 2) Take the connection alive from the point of view of network
1243# equipment in the middle.
1244#
1245# On Linux, the specified value (in seconds) is the period used to send ACKs.
1246# Note that to close the connection the double of the time is needed.
1247# On other kernels the period depends on the kernel configuration.
1248#
1249# A reasonable value for this option is 60 seconds.
1250<%- if @conf_tcp_keepalive -%>
1251tcp-keepalive <%= @conf_tcp_keepalive %>
1252<%- end -%>
1253
1254# Specify the server verbosity level.
1255# This can be one of:
1256# debug (a lot of information, useful for development/testing)
1257# verbose (many rarely useful info, but not a mess like the debug level)
1258# notice (moderately verbose, what you want in production probably)
1259# warning (only very important / critical messages are logged)
1260<%- if @conf_loglevel -%>
1261loglevel <%= @conf_loglevel %>
1262<%- end -%>
1263
1264# Specify the log file name. Also 'stdout' can be used to force
1265# Redis to log on the standard output. Note that if you use standard
1266# output for logging but daemonize, logs will be sent to /dev/null
1267logfile <%= @conf_logfile_real %>
1268
1269# To enable logging to the system logger, just set 'syslog-enabled' to yes,
1270# and optionally update the other syslog parameters to suit your needs.
1271# syslog-enabled no
1272<%- if @conf_syslog_enabled -%>
1273syslog-enabled <%= @conf_syslog_enabled %>
1274<%- end -%>
1275
1276# Specify the syslog identity.
1277# syslog-ident redis
1278<%- if @conf_syslog_ident -%>
1279syslog-ident <%= @conf_syslog_ident %>
1280<%- end -%>
1281
1282# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
1283# syslog-facility local0
1284<%- if @conf_syslog_facility -%>
1285syslog-facility <%= @conf_syslog_facility %>
1286<%- end -%>
1287
1288# Set the number of databases. The default database is DB 0, you can select
1289# a different one on a per-connection basis using SELECT <dbid> where
1290# dbid is a number between 0 and 'databases'-1
1291<%- if @conf_databases -%>
1292databases <%= @conf_databases %>
1293<%- end -%>
1294
1295################################ SNAPSHOTTING #################################
1296#
1297# Save the DB on disk:
1298#
1299# save <seconds> <changes>
1300#
1301# Will save the DB if both the given number of seconds and the given
1302# number of write operations against the DB occurred.
1303#
1304# In the example below the behaviour will be to save:
1305# after 900 sec (15 min) if at least 1 key changed
1306# after 300 sec (5 min) if at least 10 keys changed
1307# after 60 sec if at least 10000 keys changed
1308#
1309# Note: you can disable saving at all commenting all the "save" lines.
1310#
1311# It is also possible to remove all the previously configured save
1312# points by adding a save directive with a single empty string argument
1313# like in the following example:
1314#
1315# save ""
1316<%- if @conf_nosave -%>
1317# do not persist to disk
1318<%- else -%>
1319<%- @conf_save.sort.each do |seconds, changes| -%>
1320save <%= seconds -%> <%= changes -%> <%= "\n" -%>
1321<%- end -%>
1322<%- end -%>
1323
1324# By default Redis will stop accepting writes if RDB snapshots are enabled
1325# (at least one save point) and the latest background save failed.
1326# This will make the user aware (in an hard way) that data is not persisting
1327# on disk properly, otherwise chances are that no one will notice and some
1328# distater will happen.
1329#
1330# If the background saving process will start working again Redis will
1331# automatically allow writes again.
1332#
1333# However if you have setup your proper monitoring of the Redis server
1334# and persistence, you may want to disable this feature so that Redis will
1335# continue to work as usually even if there are problems with disk,
1336# permissions, and so forth.
1337<%- if @conf_stop_writes_on_bgsave_error -%>
1338stop-writes-on-bgsave-error <%= @conf_stop_writes_on_bgsave_error %>
1339<%- end -%>
1340
1341# Compress string objects using LZF when dump .rdb databases?
1342# For default that's set to 'yes' as it's almost always a win.
1343# If you want to save some CPU in the saving child set it to 'no' but
1344# the dataset will likely be bigger if you have compressible values or keys.
1345<%- if @conf_rdbcompression -%>
1346rdbcompression <%= @conf_rdbcompression %>
1347<%- end -%>
1348
1349# Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
1350# This makes the format more resistant to corruption but there is a performance
1351# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
1352# for maximum performances.
1353#
1354# RDB files created with checksum disabled have a checksum of zero that will
1355# tell the loading code to skip the check.
1356<%- if @conf_rdbchecksum -%>
1357rdbchecksum <%= @conf_rdbchecksum %>
1358<%- end -%>
1359
1360# The filename where to dump the DB
1361<%- if @conf_dbfilename -%>
1362dbfilename <%= @conf_dbfilename %>
1363<%- end -%>
1364
1365# The working directory.
1366#
1367# The DB will be written inside this directory, with the filename specified
1368# above using the 'dbfilename' configuration directive.
1369#
1370# The Append Only File will also be created inside this directory.
1371#
1372# Note that you must specify a directory here, not a file name.
1373<%- if @conf_dir -%>
1374dir <%= @conf_dir %>
1375<%- end -%>
1376
1377################################# REPLICATION #################################
1378
1379# Master-Slave replication. Use slaveof to make a Redis instance a copy of
1380# another Redis server. Note that the configuration is local to the slave
1381# so for example it is possible to configure the slave to save the DB with a
1382# different interval, or to listen to another port, and so on.
1383#
1384# slaveof <masterip> <masterport>
1385<%- if @conf_slaveof -%>
1386slaveof <%= @conf_slaveof %>
1387<%- end -%>
1388
1389# If the master is password protected (using the "requirepass" configuration
1390# directive below) it is possible to tell the slave to authenticate before
1391# starting the replication synchronization process, otherwise the master will
1392# refuse the slave request.
1393#
1394# masterauth <master-password>
1395<%- if @conf_masterauth -%>
1396masterauth <%= @conf_masterauth %>
1397<%- end -%>
1398
1399# When a slave loses its connection with the master, or when the replication
1400# is still in progress, the slave can act in two different ways:
1401#
1402# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
1403# still reply to client requests, possibly with out of date data, or the
1404# data set may just be empty if this is the first synchronization.
1405#
1406# 2) if slave-serve-stale-data is set to 'no' the slave will reply with
1407# an error "SYNC with master in progress" to all the kind of commands
1408# but to INFO and SLAVEOF.
1409#
1410<%- if @conf_slave_serve_stale_data -%>
1411slave-serve-stale-data <%= @conf_slave_serve_stale_data %>
1412<%- end -%>
1413
1414# You can configure a slave instance to accept writes or not. Writing against
1415# a slave instance may be useful to store some ephemeral data (because data
1416# written on a slave will be easily deleted after resync with the master) but
1417# may also cause problems if clients are writing to it because of a
1418# misconfiguration.
1419#
1420# Since Redis 2.6 by default slaves are read-only.
1421#
1422# Note: read only slaves are not designed to be exposed to untrusted clients
1423# on the internet. It's just a protection layer against misuse of the instance.
1424# Still a read only slave exports by default all the administrative commands
1425# such as CONFIG, DEBUG, and so forth. To a limited extend you can improve
1426# security of read only slaves using 'rename-command' to shadow all the
1427# administrative / dangerous commands.
1428<%- if @conf_slave_read_only -%>
1429slave-read-only <%= @conf_slave_read_only %>
1430<%- end -%>
1431
1432# Slaves send PINGs to server in a predefined interval. It's possible to change
1433# this interval with the repl_ping_slave_period option. The default value is 10
1434# seconds.
1435#
1436# repl-ping-slave-period 10
1437<%- if @conf_repl_ping_slave_period -%>
1438repl-ping-slave-period <%= @conf_repl_ping_slave_period %>
1439<%- end -%>
1440
1441# The following option sets a timeout for both Bulk transfer I/O timeout and
1442# master data or ping response timeout. The default value is 60 seconds.
1443#
1444# It is important to make sure that this value is greater than the value
1445# specified for repl-ping-slave-period otherwise a timeout will be detected
1446# every time there is low traffic between the master and the slave.
1447#
1448# repl-timeout 60
1449<%- if @conf_repl_timeout -%>
1450repl-timeout <%= @conf_repl_timeout %>
1451<%- end -%>
1452
1453# Disable TCP_NODELAY on the slave socket after SYNC?
1454#
1455# If you select "yes" Redis will use a smaller number of TCP packets and
1456# less bandwidth to send data to slaves. But this can add a delay for
1457# the data to appear on the slave side, up to 40 milliseconds with
1458# Linux kernels using a default configuration.
1459#
1460# If you select "no" the delay for data to appear on the slave side will
1461# be reduced but more bandwidth will be used for replication.
1462#
1463# By default we optimize for low latency, but in very high traffic conditions
1464# or when the master and slaves are many hops away, turning this to "yes" may
1465# be a good idea.
1466<%- if @conf_repl_disable_tcp_nodelay %>
1467repl-disable-tcp-nodelay <%= @conf_repl_disable_tcp_nodelay %>
1468<%- end -%>
1469
1470# The slave priority is an integer number published by Redis in the INFO output.
1471# It is used by Redis Sentinel in order to select a slave to promote into a
1472# master if the master is no longer working correctly.
1473#
1474# A slave with a low priority number is considered better for promotion, so
1475# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
1476# pick the one wtih priority 10, that is the lowest.
1477#
1478# However a special priority of 0 marks the slave as not able to perform the
1479# role of master, so a slave with priority of 0 will never be selected by
1480# Redis Sentinel for promotion.
1481#
1482# By default the priority is 100.
1483<%- if @conf_slave_priority -%>
1484slave-priority <%= @conf_slave_priority %>
1485<%- end -%>
1486
1487################################## SECURITY ###################################
1488
1489# Require clients to issue AUTH <PASSWORD> before processing any other
1490# commands. This might be useful in environments in which you do not trust
1491# others with access to the host running redis-server.
1492#
1493# This should stay commented out for backward compatibility and because most
1494# people do not need auth (e.g. they run their own servers).
1495#
1496# Warning: since Redis is pretty fast an outside user can try up to
1497# 150k passwords per second against a good box. This means that you should
1498# use a very strong password otherwise it will be very easy to break.
1499#
1500# requirepass foobared
1501<%- if @conf_requirepass -%>
1502requirepass <%= @conf_requirepass %>
1503<%- end -%>
1504
1505# Command renaming.
1506#
1507# It is possible to change the name of dangerous commands in a shared
1508# environment. For instance the CONFIG command may be renamed into something
1509# hard to guess so that it will still be available for internal-use tools
1510# but not available for general clients.
1511#
1512# Example:
1513#
1514# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
1515#
1516# It is also possible to completely kill a command by renaming it into
1517# an empty string:
1518#
1519# rename-command CONFIG ""
1520#
1521# Please note that changing the name of commands that are logged into the
1522# AOF file or transmitted to slaves may cause problems.
1523
1524################################### LIMITS ####################################
1525
1526# Set the max number of connected clients at the same time. By default
1527# this limit is set to 10000 clients, however if the Redis server is not
1528# able to configure the process file limit to allow for the specified limit
1529# the max number of allowed clients is set to the current file limit
1530# minus 32 (as Redis reserves a few file descriptors for internal uses).
1531#
1532# Once the limit is reached Redis will close all the new connections sending
1533# an error 'max number of clients reached'.
1534#
1535# maxclients 10000
1536<%- if @conf_maxclients -%>
1537maxclients <%= @conf_maxclients %>
1538<%- end -%>
1539
1540# Don't use more memory than the specified amount of bytes.
1541# When the memory limit is reached Redis will try to remove keys
1542# accordingly to the eviction policy selected (see maxmemmory-policy).
1543#
1544# If Redis can't remove keys according to the policy, or if the policy is
1545# set to 'noeviction', Redis will start to reply with errors to commands
1546# that would use more memory, like SET, LPUSH, and so on, and will continue
1547# to reply to read-only commands like GET.
1548#
1549# This option is usually useful when using Redis as an LRU cache, or to set
1550# an hard memory limit for an instance (using the 'noeviction' policy).
1551#
1552# WARNING: If you have slaves attached to an instance with maxmemory on,
1553# the size of the output buffers needed to feed the slaves are subtracted
1554# from the used memory count, so that network problems / resyncs will
1555# not trigger a loop where keys are evicted, and in turn the output
1556# buffer of slaves is full with DELs of keys evicted triggering the deletion
1557# of more keys, and so forth until the database is completely emptied.
1558#
1559# In short... if you have slaves attached it is suggested that you set a lower
1560# limit for maxmemory so that there is some free RAM on the system for slave
1561# output buffers (but this is not needed if the policy is 'noeviction').
1562#
1563# maxmemory <bytes>
1564<%- if @conf_maxmemory -%>
1565maxmemory <%= @conf_maxmemory %>
1566<%- end -%>
1567
1568# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
1569# is reached. You can select among five behaviors:
1570#
1571# volatile-lru -> remove the key with an expire set using an LRU algorithm
1572# allkeys-lru -> remove any key accordingly to the LRU algorithm
1573# volatile-random -> remove a random key with an expire set
1574# allkeys-random -> remove a random key, any key
1575# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
1576# noeviction -> don't expire at all, just return an error on write operations
1577#
1578# Note: with any of the above policies, Redis will return an error on write
1579# operations, when there are not suitable keys for eviction.
1580#
1581# At the date of writing this commands are: set setnx setex append
1582# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
1583# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
1584# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
1585# getset mset msetnx exec sort
1586#
1587# The default is:
1588#
1589# maxmemory-policy volatile-lru
1590<%- if @conf_maxmemory_policy -%>
1591maxmemory-policy <%= @conf_maxmemory_policy %>
1592<%- end -%>
1593
1594# LRU and minimal TTL algorithms are not precise algorithms but approximated
1595# algorithms (in order to save memory), so you can select as well the sample
1596# size to check. For instance for default Redis will check three keys and
1597# pick the one that was used less recently, you can change the sample size
1598# using the following configuration directive.
1599#
1600# maxmemory-samples 3
1601<%- if @conf_maxmemory_samples -%>
1602maxmemory-samples <%= @conf_maxmemory_samples %>
1603<%- end -%>
1604
1605############################## APPEND ONLY MODE ###############################
1606
1607# By default Redis asynchronously dumps the dataset on disk. This mode is
1608# good enough in many applications, but an issue with the Redis process or
1609# a power outage may result into a few minutes of writes lost (depending on
1610# the configured save points).
1611#
1612# The Append Only File is an alternative persistence mode that provides
1613# much better durability. For instance using the default data fsync policy
1614# (see later in the config file) Redis can lose just one second of writes in a
1615# dramatic event like a server power outage, or a single write if something
1616# wrong with the Redis process itself happens, but the operating system is
1617# still running correctly.
1618#
1619# AOF and RDB persistence can be enabled at the same time without problems.
1620# If the AOF is enabled on startup Redis will load the AOF, that is the file
1621# with the better durability guarantees.
1622#
1623# Please check http://redis.io/topics/persistence for more information.
1624
1625<%- if @conf_appendonly -%>
1626appendonly <%= @conf_appendonly %>
1627<%- end -%>
1628
1629# The name of the append only file (default: "appendonly.aof")
1630# appendfilename appendonly.aof
1631<%- if @conf_appendfilename -%>
1632appendfilename <%= @conf_appendfilename %>
1633<%- end -%>
1634
1635# The fsync() call tells the Operating System to actually write data on disk
1636# instead to wait for more data in the output buffer. Some OS will really flush
1637# data on disk, some other OS will just try to do it ASAP.
1638#
1639# Redis supports three different modes:
1640#
1641# no: don't fsync, just let the OS flush the data when it wants. Faster.
1642# always: fsync after every write to the append only log . Slow, Safest.
1643# everysec: fsync only one time every second. Compromise.
1644#
1645# The default is "everysec", as that's usually the right compromise between
1646# speed and data safety. It's up to you to understand if you can relax this to
1647# "no" that will let the operating system flush the output buffer when
1648# it wants, for better performances (but if you can live with the idea of
1649# some data loss consider the default persistence mode that's snapshotting),
1650# or on the contrary, use "always" that's very slow but a bit safer than
1651# everysec.
1652#
1653# More details please check the following article:
1654# http://antirez.com/post/redis-persistence-demystified.html
1655#
1656# If unsure, use "everysec".
1657
1658# appendfsync always
1659<%- if @conf_appendfsync -%>
1660appendfsync <%= @conf_appendfsync %>
1661<%- end -%>
1662# appendfsync no
1663
1664# When the AOF fsync policy is set to always or everysec, and a background
1665# saving process (a background save or AOF log background rewriting) is
1666# performing a lot of I/O against the disk, in some Linux configurations
1667# Redis may block too long on the fsync() call. Note that there is no fix for
1668# this currently, as even performing fsync in a different thread will block
1669# our synchronous write(2) call.
1670#
1671# In order to mitigate this problem it's possible to use the following option
1672# that will prevent fsync() from being called in the main process while a
1673# BGSAVE or BGREWRITEAOF is in progress.
1674#
1675# This means that while another child is saving, the durability of Redis is
1676# the same as "appendfsync none". In practical terms, this means that it is
1677# possible to lose up to 30 seconds of log in the worst scenario (with the
1678# default Linux settings).
1679#
1680# If you have latency problems turn this to "yes". Otherwise leave it as
1681# "no" that is the safest pick from the point of view of durability.
1682<%- if @conf_no_appendfsync_on_rewrite -%>
1683no-appendfsync-on-rewrite <%= @conf_no_appendfsync_on_rewrite %>
1684<%- end -%>
1685
1686# Automatic rewrite of the append only file.
1687# Redis is able to automatically rewrite the log file implicitly calling
1688# BGREWRITEAOF when the AOF log size grows by the specified percentage.
1689#
1690# This is how it works: Redis remembers the size of the AOF file after the
1691# latest rewrite (if no rewrite has happened since the restart, the size of
1692# the AOF at startup is used).
1693#
1694# This base size is compared to the current size. If the current size is
1695# bigger than the specified percentage, the rewrite is triggered. Also
1696# you need to specify a minimal size for the AOF file to be rewritten, this
1697# is useful to avoid rewriting the AOF file even if the percentage increase
1698# is reached but it is still pretty small.
1699#
1700# Specify a percentage of zero in order to disable the automatic AOF
1701# rewrite feature.
1702
1703<%- if @conf_auto_aof_rewrite_percentage -%>
1704auto-aof-rewrite-percentage <%= @conf_auto_aof_rewrite_percentage %>
1705<%- end -%>
1706<%- if @conf_auto_aof_rewrite_min_size -%>
1707auto-aof-rewrite-min-size <%= @conf_auto_aof_rewrite_min_size %>
1708<%- end -%>
1709
1710################################ LUA SCRIPTING ###############################
1711
1712# Max execution time of a Lua script in milliseconds.
1713#
1714# If the maximum execution time is reached Redis will log that a script is
1715# still in execution after the maximum allowed time and will start to
1716# reply to queries with an error.
1717#
1718# When a long running script exceed the maximum execution time only the
1719# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be
1720# used to stop a script that did not yet called write commands. The second
1721# is the only way to shut down the server in the case a write commands was
1722# already issue by the script but the user don't want to wait for the natural
1723# termination of the script.
1724#
1725# Set it to 0 or a negative value for unlimited execution without warnings.
1726<%- if @conf_lua_time_limit -%>
1727lua-time-limit <%= @conf_lua_time_limit %>
1728<%- end -%>
1729
1730################################## SLOW LOG ###################################
1731
1732# The Redis Slow Log is a system to log queries that exceeded a specified
1733# execution time. The execution time does not include the I/O operations
1734# like talking with the client, sending the reply and so forth,
1735# but just the time needed to actually execute the command (this is the only
1736# stage of command execution where the thread is blocked and can not serve
1737# other requests in the meantime).
1738#
1739# You can configure the slow log with two parameters: one tells Redis
1740# what is the execution time, in microseconds, to exceed in order for the
1741# command to get logged, and the other parameter is the length of the
1742# slow log. When a new command is logged the oldest one is removed from the
1743# queue of logged commands.
1744
1745# The following time is expressed in microseconds, so 1000000 is equivalent
1746# to one second. Note that a negative number disables the slow log, while
1747# a value of zero forces the logging of every command.
1748<%- if @conf_slowlog_log_slower_than -%>
1749slowlog-log-slower-than <%= @conf_slowlog_log_slower_than %>
1750<%- end -%>
1751
1752# There is no limit to this length. Just be aware that it will consume memory.
1753# You can reclaim memory used by the slow log with SLOWLOG RESET.
1754<%- if @conf_slowlog_max_len -%>
1755slowlog-max-len <%= @conf_slowlog_max_len %>
1756<%- end -%>
1757
1758############################### ADVANCED CONFIG ###############################
1759
1760# Hashes are encoded using a memory efficient data structure when they have a
1761# small number of entries, and the biggest entry does not exceed a given
1762# threshold. These thresholds can be configured using the following directives.
1763<%- if @conf_hash_max_zipmap_entries -%>
1764hash-max-ziplist-entries <%= @conf_hash_max_zipmap_entries %>
1765<%- end -%>
1766<%- if @conf_hash_max_zipmap_value -%>
1767hash-max-ziplist-value <%= @conf_hash_max_zipmap_value %>
1768<%- end -%>
1769
1770# Similarly to hashes, small lists are also encoded in a special way in order
1771# to save a lot of space. The special representation is only used when
1772# you are under the following limits:
1773<%- if @conf_list_max_ziplist_entries -%>
1774list-max-ziplist-entries <%= @conf_list_max_ziplist_entries %>
1775<%- end -%>
1776<%- if @conf_list_max_ziplist_value -%>
1777list-max-ziplist-value <%= @conf_list_max_ziplist_value %>
1778<%- end -%>
1779
1780# Sets have a special encoding in just one case: when a set is composed
1781# of just strings that happens to be integers in radix 10 in the range
1782# of 64 bit signed integers.
1783# The following configuration setting sets the limit in the size of the
1784# set in order to use this special memory saving encoding.
1785<%- if @conf_set_max_intset_entries -%>
1786set-max-intset-entries <%= @conf_set_max_intset_entries %>
1787<%- end -%>
1788
1789# Similarly to hashes and lists, sorted sets are also specially encoded in
1790# order to save a lot of space. This encoding is only used when the length and
1791# elements of a sorted set are below the following limits:
1792<%- if @conf_zset_max_ziplist_entries -%>
1793zset-max-ziplist-entries <%= @conf_zset_max_ziplist_entries %>
1794<%- end -%>
1795<%- if @conf_zset_max_ziplist_value -%>
1796zset-max-ziplist-value <%= @conf_zset_max_ziplist_value %>
1797<%- end -%>
1798
1799# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
1800# order to help rehashing the main Redis hash table (the one mapping top-level
1801# keys to values). The hash table implementation Redis uses (see dict.c)
1802# performs a lazy rehashing: the more operation you run into an hash table
1803# that is rehashing, the more rehashing "steps" are performed, so if the
1804# server is idle the rehashing is never complete and some more memory is used
1805# by the hash table.
1806#
1807# The default is to use this millisecond 10 times every second in order to
1808# active rehashing the main dictionaries, freeing memory when possible.
1809#
1810# If unsure:
1811# use "activerehashing no" if you have hard latency requirements and it is
1812# not a good thing in your environment that Redis can reply form time to time
1813# to queries with 2 milliseconds delay.
1814#
1815# use "activerehashing yes" if you don't have such hard requirements but
1816# want to free memory asap when possible.
1817<%- if @conf_activerehashing -%>
1818activerehashing <%= @conf_activerehashing %>
1819<%- end -%>
1820
1821# The client output buffer limits can be used to force disconnection of clients
1822# that are not reading data from the server fast enough for some reason (a
1823# common reason is that a Pub/Sub client can't consume messages as fast as the
1824# publisher can produce them).
1825#
1826# The limit can be set differently for the three different classes of clients:
1827#
1828# normal -> normal clients
1829# slave -> slave clients and MONITOR clients
1830# pubsub -> clients subcribed to at least one pubsub channel or pattern
1831#
1832# The syntax of every client-output-buffer-limit directive is the following:
1833#
1834# client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
1835#
1836# A client is immediately disconnected once the hard limit is reached, or if
1837# the soft limit is reached and remains reached for the specified number of
1838# seconds (continuously).
1839# So for instance if the hard limit is 32 megabytes and the soft limit is
1840# 16 megabytes / 10 seconds, the client will get disconnected immediately
1841# if the size of the output buffers reach 32 megabytes, but will also get
1842# disconnected if the client reaches 16 megabytes and continuously overcomes
1843# the limit for 10 seconds.
1844#
1845# By default normal clients are not limited because they don't receive data
1846# without asking (in a push way), but just after a request, so only
1847# asynchronous clients may create a scenario where data is requested faster
1848# than it can read.
1849#
1850# Instead there is a default limit for pubsub and slave clients, since
1851# subscribers and slaves receive data in a push fashion.
1852#
1853# Both the hard or the soft limit can be disabled by setting them to zero.
1854<%- if @conf_client_output_buffer_limit_normal -%>
1855client-output-buffer-limit normal <%= @conf_client_output_buffer_limit_normal %>
1856<%- end -%>
1857<%- if @conf_client_output_buffer_limit_slave -%>
1858client-output-buffer-limit slave <%= @conf_client_output_buffer_limit_slave %>
1859<%- end -%>
1860<%- if @conf_client_output_buffer_limit_pubsub -%>
1861client-output-buffer-limit pubsub <%= @conf_client_output_buffer_limit_pubsub %>
1862<%- end -%>
1863
1864# Redis calls an internal function to perform many background tasks, like
1865# closing connections of clients in timeot, purging expired keys that are
1866# never requested, and so forth.
1867#
1868# Not all tasks are perforemd with the same frequency, but Redis checks for
1869# tasks to perform accordingly to the specified "hz" value.
1870#
1871# By default "hz" is set to 10. Raising the value will use more CPU when
1872# Redis is idle, but at the same time will make Redis more responsive when
1873# there are many keys expiring at the same time, and timeouts may be
1874# handled with more precision.
1875#
1876# The range is between 1 and 500, however a value over 100 is usually not
1877# a good idea. Most users should use the default of 10 and raise this up to
1878# 100 only in environments where very low latency is required.
1879<%- if @conf_hz -%>
1880hz <%= @conf_hz %>
1881<%- end -%>
1882
1883# When a child rewrites the AOF file, if the following option is enabled
1884# the file will be fsync-ed every 32 MB of data generated. This is useful
1885# in order to commit the file to the disk more incrementally and avoid
1886# big latency spikes.
1887<%- if @conf_aof_rewrite_incremental_fsync -%>
1888aof-rewrite-incremental-fsync <%= @conf_aof_rewrite_incremental_fsync %>
1889<%- end -%>
1890
1891################################## INCLUDES ###################################
1892
1893# Include one or more other config files here. This is useful if you
1894# have a standard template that goes to all Redis server but also need
1895# to customize a few per-server settings. Include files can include
1896# other files, so use this wisely.
1897#
1898# include /path/to/local.conf
1899# include /path/to/other.conf
1900<%- if @conf_include -%>
1901<%- @conf_include.each do |include| -%>
1902include <%= include %><%= "\n" -%>
1903<%- end -%>
1904<%- end -%>
1905<%- end -%>
1906<%- if @redis_version_real == "2.8.x" -%>
1907# MANAGED BY PUPPET #
1908#
1909# Redis 2.8 configuration file example
1910
1911# Note on units: when memory size is needed, it is possible to specify
1912# it in the usual form of 1k 5GB 4M and so forth:
1913#
1914# 1k => 1000 bytes
1915# 1kb => 1024 bytes
1916# 1m => 1000000 bytes
1917# 1mb => 1024*1024 bytes
1918# 1g => 1000000000 bytes
1919# 1gb => 1024*1024*1024 bytes
1920#
1921# units are case insensitive so 1GB 1Gb 1gB are all the same.
1922
1923################################## INCLUDES ###################################
1924
1925# Include one or more other config files here. This is useful if you
1926# have a standard template that goes to all Redis server but also need
1927# to customize a few per-server settings. Include files can include
1928# other files, so use this wisely.
1929#
1930# Notice option "include" won't be rewritten by command "CONFIG REWRITE"
1931# from admin or Redis Sentinel. Since Redis always uses the last processed
1932# line as value of a configuration directive, you'd better put includes
1933# at the beginning of this file to avoid overwriting config change at runtime.
1934#
1935# If instead you are interested in using includes to override configuration
1936# options, it is better to use include as the last line.
1937#
1938# include /path/to/local.conf
1939# include /path/to/other.conf
1940<%- if @conf_include -%>
1941<%- @conf_include.each do |include| -%>
1942include <%= include %><%= "\n" -%>
1943<%- end -%>
1944<%- end -%>
1945
1946################################ GENERAL #####################################
1947
1948# By default Redis does not run as a daemon. Use 'yes' if you need it.
1949# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
1950<%- if @conf_daemonize -%>
1951daemonize <%= @conf_daemonize %>
1952<%- end -%>
1953
1954# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
1955# default. You can specify a custom pid file location here.