Commit aefadd7cfffc0aee6553e2d33f7bf376f7e677de
Exists in
master
and in
17 other branches
Merge branch 'redis' into 'master'
Redis
Showing
9 changed files
with
799 additions
and
0 deletions
Show diff stats
config/projects/gitlab.rb
files/gitlab-cookbooks/gitlab/attributes/default.rb
... | ... | @@ -57,3 +57,17 @@ default['gitlab']['postgresql']['checkpoint_segments'] = 10 |
57 | 57 | default['gitlab']['postgresql']['checkpoint_timeout'] = "5min" |
58 | 58 | default['gitlab']['postgresql']['checkpoint_completion_target'] = 0.9 |
59 | 59 | default['gitlab']['postgresql']['checkpoint_warning'] = "30s" |
60 | + | |
61 | +### | |
62 | +# Redis | |
63 | +### | |
64 | +default['gitlab']['redis']['enable'] = true | |
65 | +default['gitlab']['redis']['ha'] = false | |
66 | +default['gitlab']['redis']['dir'] = "/var/opt/gitlab/redis" | |
67 | +default['gitlab']['redis']['log_directory'] = "/var/log/gitlab/redis" | |
68 | +default['gitlab']['redis']['svlogd_size'] = 1000000 | |
69 | +default['gitlab']['redis']['svlogd_num'] = 10 | |
70 | +default['gitlab']['redis']['username'] = "gitlab-redis" | |
71 | +default['gitlab']['redis']['shell'] = "/bin/nologin" | |
72 | +default['gitlab']['redis']['home'] = "/var/opt/gitlab/redis" | |
73 | +default['gitlab']['redis']['port'] = 6379 | ... | ... |
files/gitlab-cookbooks/gitlab/libraries/chef_server.rb
files/gitlab-cookbooks/gitlab/recipes/default.rb
... | ... | @@ -0,0 +1,61 @@ |
1 | +# | |
2 | +# Copyright:: Copyright (c) 2012 Opscode, Inc. | |
3 | +# License:: Apache License, Version 2.0 | |
4 | +# | |
5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | +# you may not use this file except in compliance with the License. | |
7 | +# You may obtain a copy of the License at | |
8 | +# | |
9 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
10 | +# | |
11 | +# Unless required by applicable law or agreed to in writing, software | |
12 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | +# See the License for the specific language governing permissions and | |
15 | +# limitations under the License. | |
16 | +# | |
17 | + | |
18 | +redis_dir = node['gitlab']['redis']['dir'] | |
19 | +redis_data_dir = node['gitlab']['redis']['data_dir'] | |
20 | +redis_log_dir = node['gitlab']['redis']['log_directory'] | |
21 | + | |
22 | +user node['gitlab']['redis']['username'] do | |
23 | + system true | |
24 | + shell node['gitlab']['redis']['shell'] | |
25 | + home node['gitlab']['redis']['home'] | |
26 | +end | |
27 | + | |
28 | +directory redis_log_dir do | |
29 | + owner node['gitlab']['redis']['username'] | |
30 | + recursive true | |
31 | +end | |
32 | + | |
33 | +directory redis_dir do | |
34 | + owner node['gitlab']['redis']['username'] | |
35 | + mode "0700" | |
36 | +end | |
37 | + | |
38 | +redis_config = File.join(redis_dir, "redis.conf") | |
39 | + | |
40 | +template redis_config do | |
41 | + source "redis.conf.erb" | |
42 | + owner node['gitlab']['redis']['username'] | |
43 | + mode "0644" | |
44 | + variables(node['gitlab']['redis'].to_hash) | |
45 | + notifies :restart, 'service[redis]' if OmnibusHelper.should_notify?("redis") | |
46 | +end | |
47 | + | |
48 | +runit_service "redis" do | |
49 | + down node['gitlab']['redis']['ha'] | |
50 | + options({ | |
51 | + :log_directory => redis_log_dir, | |
52 | + :svlogd_size => node['gitlab']['redis']['svlogd_size'], | |
53 | + :svlogd_num => node['gitlab']['redis']['svlogd_num'] | |
54 | + }.merge(params)) | |
55 | +end | |
56 | + | |
57 | +if node['gitlab']['bootstrap']['enable'] | |
58 | + execute "/opt/gitlab/bin/gitlab-ctl start redis" do | |
59 | + retries 20 | |
60 | + end | |
61 | +end | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +# | |
2 | +# Copyright:: Copyright (c) 2012 Opscode, Inc. | |
3 | +# License:: Apache License, Version 2.0 | |
4 | +# | |
5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | +# you may not use this file except in compliance with the License. | |
7 | +# You may obtain a copy of the License at | |
8 | +# | |
9 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
10 | +# | |
11 | +# Unless required by applicable law or agreed to in writing, software | |
12 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | +# See the License for the specific language governing permissions and | |
15 | +# limitations under the License. | |
16 | +# | |
17 | + | |
18 | +runit_service "postgresql" do | |
19 | + action :disable | |
20 | +end | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/redis.conf.erb
0 → 100644
... | ... | @@ -0,0 +1,695 @@ |
1 | +# Redis configuration file example | |
2 | + | |
3 | +# Note on units: when memory size is needed, it is possible to specify | |
4 | +# it in the usual form of 1k 5GB 4M and so forth: | |
5 | +# | |
6 | +# 1k => 1000 bytes | |
7 | +# 1kb => 1024 bytes | |
8 | +# 1m => 1000000 bytes | |
9 | +# 1mb => 1024*1024 bytes | |
10 | +# 1g => 1000000000 bytes | |
11 | +# 1gb => 1024*1024*1024 bytes | |
12 | +# | |
13 | +# units are case insensitive so 1GB 1Gb 1gB are all the same. | |
14 | + | |
15 | +# By default Redis does not run as a daemon. Use 'yes' if you need it. | |
16 | +# Note that Redis will write a pid file in /var/run/redis.pid when daemonized. | |
17 | +daemonize no | |
18 | + | |
19 | +# When running daemonized, Redis writes a pid file in /var/run/redis.pid by | |
20 | +# default. You can specify a custom pid file location here. | |
21 | +pidfile /var/run/redis.pid | |
22 | + | |
23 | +# Accept connections on the specified port, default is 6379. | |
24 | +# If port 0 is specified Redis will not listen on a TCP socket. | |
25 | +port <%= node['gitlab']['redis']['port'] %> | |
26 | + | |
27 | +# By default Redis listens for connections from all the network interfaces | |
28 | +# available on the server. It is possible to listen to just one or multiple | |
29 | +# interfaces using the "bind" configuration directive, followed by one or | |
30 | +# more IP addresses. | |
31 | +# | |
32 | +# Examples: | |
33 | +# | |
34 | +# bind 192.168.1.100 10.0.0.1 | |
35 | +bind 127.0.0.1 | |
36 | + | |
37 | +# Specify the path for the unix socket that will be used to listen for | |
38 | +# incoming connections. There is no default, so Redis will not listen | |
39 | +# on a unix socket when not specified. | |
40 | +# | |
41 | +# unixsocket /tmp/redis.sock | |
42 | +# unixsocketperm 755 | |
43 | + | |
44 | +# Close the connection after a client is idle for N seconds (0 to disable) | |
45 | +timeout 0 | |
46 | + | |
47 | +# TCP keepalive. | |
48 | +# | |
49 | +# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence | |
50 | +# of communication. This is useful for two reasons: | |
51 | +# | |
52 | +# 1) Detect dead peers. | |
53 | +# 2) Take the connection alive from the point of view of network | |
54 | +# equipment in the middle. | |
55 | +# | |
56 | +# On Linux, the specified value (in seconds) is the period used to send ACKs. | |
57 | +# Note that to close the connection the double of the time is needed. | |
58 | +# On other kernels the period depends on the kernel configuration. | |
59 | +# | |
60 | +# A reasonable value for this option is 60 seconds. | |
61 | +tcp-keepalive 0 | |
62 | + | |
63 | +# Specify the server verbosity level. | |
64 | +# This can be one of: | |
65 | +# debug (a lot of information, useful for development/testing) | |
66 | +# verbose (many rarely useful info, but not a mess like the debug level) | |
67 | +# notice (moderately verbose, what you want in production probably) | |
68 | +# warning (only very important / critical messages are logged) | |
69 | +loglevel notice | |
70 | + | |
71 | +# Specify the log file name. Also the emptry string can be used to force | |
72 | +# Redis to log on the standard output. Note that if you use standard | |
73 | +# output for logging but daemonize, logs will be sent to /dev/null | |
74 | +logfile "" | |
75 | + | |
76 | +# To enable logging to the system logger, just set 'syslog-enabled' to yes, | |
77 | +# and optionally update the other syslog parameters to suit your needs. | |
78 | +# syslog-enabled no | |
79 | + | |
80 | +# Specify the syslog identity. | |
81 | +# syslog-ident redis | |
82 | + | |
83 | +# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7. | |
84 | +# syslog-facility local0 | |
85 | + | |
86 | +# Set the number of databases. The default database is DB 0, you can select | |
87 | +# a different one on a per-connection basis using SELECT <dbid> where | |
88 | +# dbid is a number between 0 and 'databases'-1 | |
89 | +databases 16 | |
90 | + | |
91 | +################################ SNAPSHOTTING ################################# | |
92 | +# | |
93 | +# Save the DB on disk: | |
94 | +# | |
95 | +# save <seconds> <changes> | |
96 | +# | |
97 | +# Will save the DB if both the given number of seconds and the given | |
98 | +# number of write operations against the DB occurred. | |
99 | +# | |
100 | +# In the example below the behaviour will be to save: | |
101 | +# after 900 sec (15 min) if at least 1 key changed | |
102 | +# after 300 sec (5 min) if at least 10 keys changed | |
103 | +# after 60 sec if at least 10000 keys changed | |
104 | +# | |
105 | +# Note: you can disable saving at all commenting all the "save" lines. | |
106 | +# | |
107 | +# It is also possible to remove all the previously configured save | |
108 | +# points by adding a save directive with a single empty string argument | |
109 | +# like in the following example: | |
110 | +# | |
111 | +# save "" | |
112 | + | |
113 | +save 900 1 | |
114 | +save 300 10 | |
115 | +save 60 10000 | |
116 | + | |
117 | +# By default Redis will stop accepting writes if RDB snapshots are enabled | |
118 | +# (at least one save point) and the latest background save failed. | |
119 | +# This will make the user aware (in an hard way) that data is not persisting | |
120 | +# on disk properly, otherwise chances are that no one will notice and some | |
121 | +# distater will happen. | |
122 | +# | |
123 | +# If the background saving process will start working again Redis will | |
124 | +# automatically allow writes again. | |
125 | +# | |
126 | +# However if you have setup your proper monitoring of the Redis server | |
127 | +# and persistence, you may want to disable this feature so that Redis will | |
128 | +# continue to work as usually even if there are problems with disk, | |
129 | +# permissions, and so forth. | |
130 | +stop-writes-on-bgsave-error yes | |
131 | + | |
132 | +# Compress string objects using LZF when dump .rdb databases? | |
133 | +# For default that's set to 'yes' as it's almost always a win. | |
134 | +# If you want to save some CPU in the saving child set it to 'no' but | |
135 | +# the dataset will likely be bigger if you have compressible values or keys. | |
136 | +rdbcompression yes | |
137 | + | |
138 | +# Since version 5 of RDB a CRC64 checksum is placed at the end of the file. | |
139 | +# This makes the format more resistant to corruption but there is a performance | |
140 | +# hit to pay (around 10%) when saving and loading RDB files, so you can disable it | |
141 | +# for maximum performances. | |
142 | +# | |
143 | +# RDB files created with checksum disabled have a checksum of zero that will | |
144 | +# tell the loading code to skip the check. | |
145 | +rdbchecksum yes | |
146 | + | |
147 | +# The filename where to dump the DB | |
148 | +dbfilename dump.rdb | |
149 | + | |
150 | +# The working directory. | |
151 | +# | |
152 | +# The DB will be written inside this directory, with the filename specified | |
153 | +# above using the 'dbfilename' configuration directive. | |
154 | +# | |
155 | +# The Append Only File will also be created inside this directory. | |
156 | +# | |
157 | +# Note that you must specify a directory here, not a file name. | |
158 | +dir <%= node['gitlab']['redis']['dir'] %> | |
159 | + | |
160 | +################################# REPLICATION ################################# | |
161 | + | |
162 | +# Master-Slave replication. Use slaveof to make a Redis instance a copy of | |
163 | +# another Redis server. Note that the configuration is local to the slave | |
164 | +# so for example it is possible to configure the slave to save the DB with a | |
165 | +# different interval, or to listen to another port, and so on. | |
166 | +# | |
167 | +# slaveof <masterip> <masterport> | |
168 | + | |
169 | +# If the master is password protected (using the "requirepass" configuration | |
170 | +# directive below) it is possible to tell the slave to authenticate before | |
171 | +# starting the replication synchronization process, otherwise the master will | |
172 | +# refuse the slave request. | |
173 | +# | |
174 | +# masterauth <master-password> | |
175 | + | |
176 | +# When a slave loses its connection with the master, or when the replication | |
177 | +# is still in progress, the slave can act in two different ways: | |
178 | +# | |
179 | +# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will | |
180 | +# still reply to client requests, possibly with out of date data, or the | |
181 | +# data set may just be empty if this is the first synchronization. | |
182 | +# | |
183 | +# 2) if slave-serve-stale-data is set to 'no' the slave will reply with | |
184 | +# an error "SYNC with master in progress" to all the kind of commands | |
185 | +# but to INFO and SLAVEOF. | |
186 | +# | |
187 | +slave-serve-stale-data yes | |
188 | + | |
189 | +# You can configure a slave instance to accept writes or not. Writing against | |
190 | +# a slave instance may be useful to store some ephemeral data (because data | |
191 | +# written on a slave will be easily deleted after resync with the master) but | |
192 | +# may also cause problems if clients are writing to it because of a | |
193 | +# misconfiguration. | |
194 | +# | |
195 | +# Since Redis 2.6 by default slaves are read-only. | |
196 | +# | |
197 | +# Note: read only slaves are not designed to be exposed to untrusted clients | |
198 | +# on the internet. It's just a protection layer against misuse of the instance. | |
199 | +# Still a read only slave exports by default all the administrative commands | |
200 | +# such as CONFIG, DEBUG, and so forth. To a limited extend you can improve | |
201 | +# security of read only slaves using 'rename-command' to shadow all the | |
202 | +# administrative / dangerous commands. | |
203 | +slave-read-only yes | |
204 | + | |
205 | +# Slaves send PINGs to server in a predefined interval. It's possible to change | |
206 | +# this interval with the repl_ping_slave_period option. The default value is 10 | |
207 | +# seconds. | |
208 | +# | |
209 | +# repl-ping-slave-period 10 | |
210 | + | |
211 | +# The following option sets the replication timeout for: | |
212 | +# | |
213 | +# 1) Bulk transfer I/O during SYNC, from the point of view of slave. | |
214 | +# 2) Master timeout from the point of view of slaves (data, pings). | |
215 | +# 3) Slave timeout from the point of view of masters (REPLCONF ACK pings). | |
216 | +# | |
217 | +# It is important to make sure that this value is greater than the value | |
218 | +# specified for repl-ping-slave-period otherwise a timeout will be detected | |
219 | +# every time there is low traffic between the master and the slave. | |
220 | +# | |
221 | +# repl-timeout 60 | |
222 | + | |
223 | +# Disable TCP_NODELAY on the slave socket after SYNC? | |
224 | +# | |
225 | +# If you select "yes" Redis will use a smaller number of TCP packets and | |
226 | +# less bandwidth to send data to slaves. But this can add a delay for | |
227 | +# the data to appear on the slave side, up to 40 milliseconds with | |
228 | +# Linux kernels using a default configuration. | |
229 | +# | |
230 | +# If you select "no" the delay for data to appear on the slave side will | |
231 | +# be reduced but more bandwidth will be used for replication. | |
232 | +# | |
233 | +# By default we optimize for low latency, but in very high traffic conditions | |
234 | +# or when the master and slaves are many hops away, turning this to "yes" may | |
235 | +# be a good idea. | |
236 | +repl-disable-tcp-nodelay no | |
237 | + | |
238 | +# Set the replication backlog size. The backlog is a buffer that accumulates | |
239 | +# slave data when slaves are disconnected for some time, so that when a slave | |
240 | +# wants to reconnect again, often a full resync is not needed, but a partial | |
241 | +# resync is enough, just passing the portion of data the slave missed while | |
242 | +# disconnected. | |
243 | +# | |
244 | +# The biggest the replication backlog, the longer the time the slave can be | |
245 | +# disconnected and later be able to perform a partial resynchronization. | |
246 | +# | |
247 | +# The backlog is only allocated once there is at least a slave connected. | |
248 | +# | |
249 | +# repl-backlog-size 1mb | |
250 | + | |
251 | +# After a master has no longer connected slaves for some time, the backlog | |
252 | +# will be freed. The following option configures the amount of seconds that | |
253 | +# need to elapse, starting from the time the last slave disconnected, for | |
254 | +# the backlog buffer to be freed. | |
255 | +# | |
256 | +# A value of 0 means to never release the backlog. | |
257 | +# | |
258 | +# repl-backlog-ttl 3600 | |
259 | + | |
260 | +# The slave priority is an integer number published by Redis in the INFO output. | |
261 | +# It is used by Redis Sentinel in order to select a slave to promote into a | |
262 | +# master if the master is no longer working correctly. | |
263 | +# | |
264 | +# A slave with a low priority number is considered better for promotion, so | |
265 | +# for instance if there are three slaves with priority 10, 100, 25 Sentinel will | |
266 | +# pick the one wtih priority 10, that is the lowest. | |
267 | +# | |
268 | +# However a special priority of 0 marks the slave as not able to perform the | |
269 | +# role of master, so a slave with priority of 0 will never be selected by | |
270 | +# Redis Sentinel for promotion. | |
271 | +# | |
272 | +# By default the priority is 100. | |
273 | +slave-priority 100 | |
274 | + | |
275 | +# It is possible for a master to stop accepting writes if there are less than | |
276 | +# N slaves connected, having a lag less or equal than M seconds. | |
277 | +# | |
278 | +# The N slaves need to be in "online" state. | |
279 | +# | |
280 | +# The lag in seconds, that must be <= the specified value, is calculated from | |
281 | +# the last ping received from the slave, that is usually sent every second. | |
282 | +# | |
283 | +# This option does not GUARANTEES that N replicas will accept the write, but | |
284 | +# will limit the window of exposure for lost writes in case not enough slaves | |
285 | +# are available, to the specified number of seconds. | |
286 | +# | |
287 | +# For example to require at least 3 slaves with a lag <= 10 seconds use: | |
288 | +# | |
289 | +# min-slaves-to-write 3 | |
290 | +# min-slaves-max-lag 10 | |
291 | +# | |
292 | +# Setting one or the other to 0 disables the feature. | |
293 | +# | |
294 | +# By default min-slaves-to-write is set to 0 (feature disabled) and | |
295 | +# min-slaves-max-lag is set to 10. | |
296 | + | |
297 | +################################## SECURITY ################################### | |
298 | + | |
299 | +# Require clients to issue AUTH <PASSWORD> before processing any other | |
300 | +# commands. This might be useful in environments in which you do not trust | |
301 | +# others with access to the host running redis-server. | |
302 | +# | |
303 | +# This should stay commented out for backward compatibility and because most | |
304 | +# people do not need auth (e.g. they run their own servers). | |
305 | +# | |
306 | +# Warning: since Redis is pretty fast an outside user can try up to | |
307 | +# 150k passwords per second against a good box. This means that you should | |
308 | +# use a very strong password otherwise it will be very easy to break. | |
309 | +# | |
310 | +# requirepass foobared | |
311 | + | |
312 | +# Command renaming. | |
313 | +# | |
314 | +# It is possible to change the name of dangerous commands in a shared | |
315 | +# environment. For instance the CONFIG command may be renamed into something | |
316 | +# hard to guess so that it will still be available for internal-use tools | |
317 | +# but not available for general clients. | |
318 | +# | |
319 | +# Example: | |
320 | +# | |
321 | +# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 | |
322 | +# | |
323 | +# It is also possible to completely kill a command by renaming it into | |
324 | +# an empty string: | |
325 | +# | |
326 | +# rename-command CONFIG "" | |
327 | +# | |
328 | +# Please note that changing the name of commands that are logged into the | |
329 | +# AOF file or transmitted to slaves may cause problems. | |
330 | + | |
331 | +################################### LIMITS #################################### | |
332 | + | |
333 | +# Set the max number of connected clients at the same time. By default | |
334 | +# this limit is set to 10000 clients, however if the Redis server is not | |
335 | +# able to configure the process file limit to allow for the specified limit | |
336 | +# the max number of allowed clients is set to the current file limit | |
337 | +# minus 32 (as Redis reserves a few file descriptors for internal uses). | |
338 | +# | |
339 | +# Once the limit is reached Redis will close all the new connections sending | |
340 | +# an error 'max number of clients reached'. | |
341 | +# | |
342 | +# maxclients 10000 | |
343 | + | |
344 | +# Don't use more memory than the specified amount of bytes. | |
345 | +# When the memory limit is reached Redis will try to remove keys | |
346 | +# accordingly to the eviction policy selected (see maxmemmory-policy). | |
347 | +# | |
348 | +# If Redis can't remove keys according to the policy, or if the policy is | |
349 | +# set to 'noeviction', Redis will start to reply with errors to commands | |
350 | +# that would use more memory, like SET, LPUSH, and so on, and will continue | |
351 | +# to reply to read-only commands like GET. | |
352 | +# | |
353 | +# This option is usually useful when using Redis as an LRU cache, or to set | |
354 | +# an hard memory limit for an instance (using the 'noeviction' policy). | |
355 | +# | |
356 | +# WARNING: If you have slaves attached to an instance with maxmemory on, | |
357 | +# the size of the output buffers needed to feed the slaves are subtracted | |
358 | +# from the used memory count, so that network problems / resyncs will | |
359 | +# not trigger a loop where keys are evicted, and in turn the output | |
360 | +# buffer of slaves is full with DELs of keys evicted triggering the deletion | |
361 | +# of more keys, and so forth until the database is completely emptied. | |
362 | +# | |
363 | +# In short... if you have slaves attached it is suggested that you set a lower | |
364 | +# limit for maxmemory so that there is some free RAM on the system for slave | |
365 | +# output buffers (but this is not needed if the policy is 'noeviction'). | |
366 | +# | |
367 | +# maxmemory <bytes> | |
368 | + | |
369 | +# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory | |
370 | +# is reached. You can select among five behaviors: | |
371 | +# | |
372 | +# volatile-lru -> remove the key with an expire set using an LRU algorithm | |
373 | +# allkeys-lru -> remove any key accordingly to the LRU algorithm | |
374 | +# volatile-random -> remove a random key with an expire set | |
375 | +# allkeys-random -> remove a random key, any key | |
376 | +# volatile-ttl -> remove the key with the nearest expire time (minor TTL) | |
377 | +# noeviction -> don't expire at all, just return an error on write operations | |
378 | +# | |
379 | +# Note: with any of the above policies, Redis will return an error on write | |
380 | +# operations, when there are not suitable keys for eviction. | |
381 | +# | |
382 | +# At the date of writing this commands are: set setnx setex append | |
383 | +# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd | |
384 | +# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby | |
385 | +# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby | |
386 | +# getset mset msetnx exec sort | |
387 | +# | |
388 | +# The default is: | |
389 | +# | |
390 | +# maxmemory-policy volatile-lru | |
391 | + | |
392 | +# LRU and minimal TTL algorithms are not precise algorithms but approximated | |
393 | +# algorithms (in order to save memory), so you can select as well the sample | |
394 | +# size to check. For instance for default Redis will check three keys and | |
395 | +# pick the one that was used less recently, you can change the sample size | |
396 | +# using the following configuration directive. | |
397 | +# | |
398 | +# maxmemory-samples 3 | |
399 | + | |
400 | +############################## APPEND ONLY MODE ############################### | |
401 | + | |
402 | +# By default Redis asynchronously dumps the dataset on disk. This mode is | |
403 | +# good enough in many applications, but an issue with the Redis process or | |
404 | +# a power outage may result into a few minutes of writes lost (depending on | |
405 | +# the configured save points). | |
406 | +# | |
407 | +# The Append Only File is an alternative persistence mode that provides | |
408 | +# much better durability. For instance using the default data fsync policy | |
409 | +# (see later in the config file) Redis can lose just one second of writes in a | |
410 | +# dramatic event like a server power outage, or a single write if something | |
411 | +# wrong with the Redis process itself happens, but the operating system is | |
412 | +# still running correctly. | |
413 | +# | |
414 | +# AOF and RDB persistence can be enabled at the same time without problems. | |
415 | +# If the AOF is enabled on startup Redis will load the AOF, that is the file | |
416 | +# with the better durability guarantees. | |
417 | +# | |
418 | +# Please check http://redis.io/topics/persistence for more information. | |
419 | + | |
420 | +appendonly no | |
421 | + | |
422 | +# The name of the append only file (default: "appendonly.aof") | |
423 | +# appendfilename appendonly.aof | |
424 | + | |
425 | +# The fsync() call tells the Operating System to actually write data on disk | |
426 | +# instead to wait for more data in the output buffer. Some OS will really flush | |
427 | +# data on disk, some other OS will just try to do it ASAP. | |
428 | +# | |
429 | +# Redis supports three different modes: | |
430 | +# | |
431 | +# no: don't fsync, just let the OS flush the data when it wants. Faster. | |
432 | +# always: fsync after every write to the append only log . Slow, Safest. | |
433 | +# everysec: fsync only one time every second. Compromise. | |
434 | +# | |
435 | +# The default is "everysec", as that's usually the right compromise between | |
436 | +# speed and data safety. It's up to you to understand if you can relax this to | |
437 | +# "no" that will let the operating system flush the output buffer when | |
438 | +# it wants, for better performances (but if you can live with the idea of | |
439 | +# some data loss consider the default persistence mode that's snapshotting), | |
440 | +# or on the contrary, use "always" that's very slow but a bit safer than | |
441 | +# everysec. | |
442 | +# | |
443 | +# More details please check the following article: | |
444 | +# http://antirez.com/post/redis-persistence-demystified.html | |
445 | +# | |
446 | +# If unsure, use "everysec". | |
447 | + | |
448 | +# appendfsync always | |
449 | +appendfsync everysec | |
450 | +# appendfsync no | |
451 | + | |
452 | +# When the AOF fsync policy is set to always or everysec, and a background | |
453 | +# saving process (a background save or AOF log background rewriting) is | |
454 | +# performing a lot of I/O against the disk, in some Linux configurations | |
455 | +# Redis may block too long on the fsync() call. Note that there is no fix for | |
456 | +# this currently, as even performing fsync in a different thread will block | |
457 | +# our synchronous write(2) call. | |
458 | +# | |
459 | +# In order to mitigate this problem it's possible to use the following option | |
460 | +# that will prevent fsync() from being called in the main process while a | |
461 | +# BGSAVE or BGREWRITEAOF is in progress. | |
462 | +# | |
463 | +# This means that while another child is saving, the durability of Redis is | |
464 | +# the same as "appendfsync none". In practical terms, this means that it is | |
465 | +# possible to lose up to 30 seconds of log in the worst scenario (with the | |
466 | +# default Linux settings). | |
467 | +# | |
468 | +# If you have latency problems turn this to "yes". Otherwise leave it as | |
469 | +# "no" that is the safest pick from the point of view of durability. | |
470 | +no-appendfsync-on-rewrite no | |
471 | + | |
472 | +# Automatic rewrite of the append only file. | |
473 | +# Redis is able to automatically rewrite the log file implicitly calling | |
474 | +# BGREWRITEAOF when the AOF log size grows by the specified percentage. | |
475 | +# | |
476 | +# This is how it works: Redis remembers the size of the AOF file after the | |
477 | +# latest rewrite (if no rewrite has happened since the restart, the size of | |
478 | +# the AOF at startup is used). | |
479 | +# | |
480 | +# This base size is compared to the current size. If the current size is | |
481 | +# bigger than the specified percentage, the rewrite is triggered. Also | |
482 | +# you need to specify a minimal size for the AOF file to be rewritten, this | |
483 | +# is useful to avoid rewriting the AOF file even if the percentage increase | |
484 | +# is reached but it is still pretty small. | |
485 | +# | |
486 | +# Specify a percentage of zero in order to disable the automatic AOF | |
487 | +# rewrite feature. | |
488 | + | |
489 | +auto-aof-rewrite-percentage 100 | |
490 | +auto-aof-rewrite-min-size 64mb | |
491 | + | |
492 | +################################ LUA SCRIPTING ############################### | |
493 | + | |
494 | +# Max execution time of a Lua script in milliseconds. | |
495 | +# | |
496 | +# If the maximum execution time is reached Redis will log that a script is | |
497 | +# still in execution after the maximum allowed time and will start to | |
498 | +# reply to queries with an error. | |
499 | +# | |
500 | +# When a long running script exceed the maximum execution time only the | |
501 | +# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be | |
502 | +# used to stop a script that did not yet called write commands. The second | |
503 | +# is the only way to shut down the server in the case a write commands was | |
504 | +# already issue by the script but the user don't want to wait for the natural | |
505 | +# termination of the script. | |
506 | +# | |
507 | +# Set it to 0 or a negative value for unlimited execution without warnings. | |
508 | +lua-time-limit 5000 | |
509 | + | |
510 | +################################## SLOW LOG ################################### | |
511 | + | |
512 | +# The Redis Slow Log is a system to log queries that exceeded a specified | |
513 | +# execution time. The execution time does not include the I/O operations | |
514 | +# like talking with the client, sending the reply and so forth, | |
515 | +# but just the time needed to actually execute the command (this is the only | |
516 | +# stage of command execution where the thread is blocked and can not serve | |
517 | +# other requests in the meantime). | |
518 | +# | |
519 | +# You can configure the slow log with two parameters: one tells Redis | |
520 | +# what is the execution time, in microseconds, to exceed in order for the | |
521 | +# command to get logged, and the other parameter is the length of the | |
522 | +# slow log. When a new command is logged the oldest one is removed from the | |
523 | +# queue of logged commands. | |
524 | + | |
525 | +# The following time is expressed in microseconds, so 1000000 is equivalent | |
526 | +# to one second. Note that a negative number disables the slow log, while | |
527 | +# a value of zero forces the logging of every command. | |
528 | +slowlog-log-slower-than 10000 | |
529 | + | |
530 | +# There is no limit to this length. Just be aware that it will consume memory. | |
531 | +# You can reclaim memory used by the slow log with SLOWLOG RESET. | |
532 | +slowlog-max-len 128 | |
533 | + | |
534 | +############################# Event notification ############################## | |
535 | + | |
536 | +# Redis can notify Pub/Sub clients about events happening in the key space. | |
537 | +# This feature is documented at http://redis.io/topics/keyspace-events | |
538 | +# | |
539 | +# For instance if keyspace events notification is enabled, and a client | |
540 | +# performs a DEL operation on key "foo" stored in the Database 0, two | |
541 | +# messages will be published via Pub/Sub: | |
542 | +# | |
543 | +# PUBLISH __keyspace@0__:foo del | |
544 | +# PUBLISH __keyevent@0__:del foo | |
545 | +# | |
546 | +# It is possible to select the events that Redis will notify among a set | |
547 | +# of classes. Every class is identified by a single character: | |
548 | +# | |
549 | +# K Keyspace events, published with __keyspace@<db>__ prefix. | |
550 | +# E Keyevent events, published with __keyevent@<db>__ prefix. | |
551 | +# g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ... | |
552 | +# $ String commands | |
553 | +# l List commands | |
554 | +# s Set commands | |
555 | +# h Hash commands | |
556 | +# z Sorted set commands | |
557 | +# x Expired events (events generated every time a key expires) | |
558 | +# e Evicted events (events generated when a key is evicted for maxmemory) | |
559 | +# A Alias for g$lshzxe, so that the "AKE" string means all the events. | |
560 | +# | |
561 | +# The "notify-keyspace-events" takes as argument a string that is composed | |
562 | +# by zero or multiple characters. The empty string means that notifications | |
563 | +# are disabled at all. | |
564 | +# | |
565 | +# Example: to enable list and generic events, from the point of view of the | |
566 | +# event name, use: | |
567 | +# | |
568 | +# notify-keyspace-events Elg | |
569 | +# | |
570 | +# Example 2: to get the stream of the expired keys subscribing to channel | |
571 | +# name __keyevent@0__:expired use: | |
572 | +# | |
573 | +# notify-keyspace-events Ex | |
574 | +# | |
575 | +# By default all notifications are disabled because most users don't need | |
576 | +# this feature and the feature has some overhead. Note that if you don't | |
577 | +# specify at least one of K or E, no events will be delivered. | |
578 | +notify-keyspace-events "" | |
579 | + | |
580 | +############################### ADVANCED CONFIG ############################### | |
581 | + | |
582 | +# Hashes are encoded using a memory efficient data structure when they have a | |
583 | +# small number of entries, and the biggest entry does not exceed a given | |
584 | +# threshold. These thresholds can be configured using the following directives. | |
585 | +hash-max-ziplist-entries 512 | |
586 | +hash-max-ziplist-value 64 | |
587 | + | |
588 | +# Similarly to hashes, small lists are also encoded in a special way in order | |
589 | +# to save a lot of space. The special representation is only used when | |
590 | +# you are under the following limits: | |
591 | +list-max-ziplist-entries 512 | |
592 | +list-max-ziplist-value 64 | |
593 | + | |
594 | +# Sets have a special encoding in just one case: when a set is composed | |
595 | +# of just strings that happens to be integers in radix 10 in the range | |
596 | +# of 64 bit signed integers. | |
597 | +# The following configuration setting sets the limit in the size of the | |
598 | +# set in order to use this special memory saving encoding. | |
599 | +set-max-intset-entries 512 | |
600 | + | |
601 | +# Similarly to hashes and lists, sorted sets are also specially encoded in | |
602 | +# order to save a lot of space. This encoding is only used when the length and | |
603 | +# elements of a sorted set are below the following limits: | |
604 | +zset-max-ziplist-entries 128 | |
605 | +zset-max-ziplist-value 64 | |
606 | + | |
607 | +# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in | |
608 | +# order to help rehashing the main Redis hash table (the one mapping top-level | |
609 | +# keys to values). The hash table implementation Redis uses (see dict.c) | |
610 | +# performs a lazy rehashing: the more operation you run into an hash table | |
611 | +# that is rehashing, the more rehashing "steps" are performed, so if the | |
612 | +# server is idle the rehashing is never complete and some more memory is used | |
613 | +# by the hash table. | |
614 | +# | |
615 | +# The default is to use this millisecond 10 times every second in order to | |
616 | +# active rehashing the main dictionaries, freeing memory when possible. | |
617 | +# | |
618 | +# If unsure: | |
619 | +# use "activerehashing no" if you have hard latency requirements and it is | |
620 | +# not a good thing in your environment that Redis can reply form time to time | |
621 | +# to queries with 2 milliseconds delay. | |
622 | +# | |
623 | +# use "activerehashing yes" if you don't have such hard requirements but | |
624 | +# want to free memory asap when possible. | |
625 | +activerehashing yes | |
626 | + | |
627 | +# The client output buffer limits can be used to force disconnection of clients | |
628 | +# that are not reading data from the server fast enough for some reason (a | |
629 | +# common reason is that a Pub/Sub client can't consume messages as fast as the | |
630 | +# publisher can produce them). | |
631 | +# | |
632 | +# The limit can be set differently for the three different classes of clients: | |
633 | +# | |
634 | +# normal -> normal clients | |
635 | +# slave -> slave clients and MONITOR clients | |
636 | +# pubsub -> clients subcribed to at least one pubsub channel or pattern | |
637 | +# | |
638 | +# The syntax of every client-output-buffer-limit directive is the following: | |
639 | +# | |
640 | +# client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds> | |
641 | +# | |
642 | +# A client is immediately disconnected once the hard limit is reached, or if | |
643 | +# the soft limit is reached and remains reached for the specified number of | |
644 | +# seconds (continuously). | |
645 | +# So for instance if the hard limit is 32 megabytes and the soft limit is | |
646 | +# 16 megabytes / 10 seconds, the client will get disconnected immediately | |
647 | +# if the size of the output buffers reach 32 megabytes, but will also get | |
648 | +# disconnected if the client reaches 16 megabytes and continuously overcomes | |
649 | +# the limit for 10 seconds. | |
650 | +# | |
651 | +# By default normal clients are not limited because they don't receive data | |
652 | +# without asking (in a push way), but just after a request, so only | |
653 | +# asynchronous clients may create a scenario where data is requested faster | |
654 | +# than it can read. | |
655 | +# | |
656 | +# Instead there is a default limit for pubsub and slave clients, since | |
657 | +# subscribers and slaves receive data in a push fashion. | |
658 | +# | |
659 | +# Both the hard or the soft limit can be disabled by setting them to zero. | |
660 | +client-output-buffer-limit normal 0 0 0 | |
661 | +client-output-buffer-limit slave 256mb 64mb 60 | |
662 | +client-output-buffer-limit pubsub 32mb 8mb 60 | |
663 | + | |
664 | +# Redis calls an internal function to perform many background tasks, like | |
665 | +# closing connections of clients in timeot, purging expired keys that are | |
666 | +# never requested, and so forth. | |
667 | +# | |
668 | +# Not all tasks are performed with the same frequency, but Redis checks for | |
669 | +# tasks to perform accordingly to the specified "hz" value. | |
670 | +# | |
671 | +# By default "hz" is set to 10. Raising the value will use more CPU when | |
672 | +# Redis is idle, but at the same time will make Redis more responsive when | |
673 | +# there are many keys expiring at the same time, and timeouts may be | |
674 | +# handled with more precision. | |
675 | +# | |
676 | +# The range is between 1 and 500, however a value over 100 is usually not | |
677 | +# a good idea. Most users should use the default of 10 and raise this up to | |
678 | +# 100 only in environments where very low latency is required. | |
679 | +hz 10 | |
680 | + | |
681 | +# When a child rewrites the AOF file, if the following option is enabled | |
682 | +# the file will be fsync-ed every 32 MB of data generated. This is useful | |
683 | +# in order to commit the file to the disk more incrementally and avoid | |
684 | +# big latency spikes. | |
685 | +aof-rewrite-incremental-fsync yes | |
686 | + | |
687 | +################################## INCLUDES ################################### | |
688 | + | |
689 | +# Include one or more other config files here. This is useful if you | |
690 | +# have a standard template that goes to all Redis server but also need | |
691 | +# to customize a few per-server settings. Include files can include | |
692 | +# other files, so use this wisely. | |
693 | +# | |
694 | +# include /path/to/local.conf | |
695 | +# include /path/to/other.conf | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/sv-redis-log-run.erb
0 → 100644
files/gitlab-cookbooks/gitlab/templates/default/sv-redis-run.erb
0 → 100644