rubber 2.2.4 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +46 -0
  3. data/lib/rubber/commands/config.rb +4 -2
  4. data/lib/rubber/commands/vulcanize.rb +1 -1
  5. data/lib/rubber/dns/base.rb +4 -0
  6. data/lib/rubber/recipes/rubber.rb +3 -3
  7. data/lib/rubber/recipes/rubber/utils.rb +3 -1
  8. data/lib/rubber/version.rb +1 -1
  9. data/rubber.gemspec +1 -1
  10. data/templates/base/config/deploy.rb +1 -0
  11. data/templates/base/config/rubber/rubber-ruby.yml +1 -1
  12. data/templates/base/config/rubber/rubber.yml +1 -1
  13. data/templates/collectd/config/rubber/deploy-collectd.rb +6 -0
  14. data/templates/elasticsearch/config/rubber/deploy-elasticsearch.rb +1 -1
  15. data/templates/graphite/config/rubber/deploy-graphite.rb +20 -5
  16. data/templates/memcached/config/rubber/deploy-memcached.rb +15 -0
  17. data/templates/memcached/config/rubber/role/memcached/crontab +8 -0
  18. data/templates/memcached/config/rubber/role/memcached/memcached.conf +1 -1
  19. data/templates/memcached/config/rubber/rubber-memcached.yml +2 -0
  20. data/templates/mongodb/config/rubber/deploy-mongodb.rb +11 -2
  21. data/templates/mongodb/config/rubber/role/mongodb/crontab +8 -0
  22. data/templates/monit/config/rubber/deploy-monit.rb +8 -1
  23. data/templates/mysql/config/rubber/rubber-mysql.yml +1 -1
  24. data/templates/nginx/config/rubber/deploy-nginx.rb +8 -1
  25. data/templates/nginx/config/rubber/role/nginx/crontab +1 -1
  26. data/templates/nginx/config/rubber/role/nginx/nginx.conf +4 -4
  27. data/templates/nginx/config/rubber/rubber-nginx.yml +2 -0
  28. data/templates/passenger_nginx/config/rubber/role/passenger_nginx/application.conf +1 -1
  29. data/templates/passenger_nginx/config/rubber/role/passenger_nginx/crontab +1 -1
  30. data/templates/passenger_nginx/config/rubber/role/passenger_nginx/nginx.conf +3 -3
  31. data/templates/passenger_nginx/config/rubber/rubber-passenger_nginx.yml +3 -3
  32. data/templates/percona/config/rubber/rubber-percona.yml +1 -1
  33. data/templates/redis/config/rubber/deploy-redis.rb +1 -1
  34. data/templates/redis/config/rubber/role/redis/redis.conf +261 -141
  35. data/templates/redis/config/rubber/rubber-redis.yml +1 -1
  36. data/templates/torquebox/config/rubber/deploy-torquebox.rb +1 -1
  37. data/templates/unicorn/config/rubber/deploy-unicorn.rb +8 -1
  38. metadata +102 -151
  39. data/templates/graphite/config/rubber/role/graphite_server/graphite-collectd-ping.conf +0 -11
@@ -5,4 +5,4 @@
5
5
  %>
6
6
 
7
7
  # Roll the nginx logs at midnight
8
- 0 0 * * * <%= Rubber.root %>/script/rubber cron --task util:rotate_logs --directory=/mnt/nginx/logs
8
+ 0 0 * * * <%= Rubber.root %>/script/rubber cron --task util:rotate_logs --directory=<%= rubber_env.nginx_log_dir %>
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  @path = "/etc/nginx/nginx.conf"
3
- @post = "mkdir -p /mnt/nginx/logs"
3
+ @post = "mkdir -p #{rubber_env.nginx_log_dir}"
4
4
  %>
5
5
 
6
6
  user <%= rubber_env.app_user %>;
@@ -41,8 +41,8 @@ http
41
41
  '"$http_user_agent" "$http_cookie"';
42
42
 
43
43
  # default log files
44
- error_log /mnt/nginx/logs/error.log notice;
45
- access_log /mnt/nginx/logs/access.log main;
44
+ error_log <%= rubber_env.nginx_log_dir %>/error.log notice;
45
+ access_log <%= rubber_env.nginx_log_dir %>/access.log main;
46
46
 
47
47
  passenger_root <%= rubber_env.passenger_root %>;
48
48
  passenger_ruby <%= rubber_env.passenger_ruby %>;
@@ -1,5 +1,5 @@
1
- passenger_version: 3.0.11
2
- nginx_version: 1.0.11
1
+ passenger_version: 3.0.19
2
+ nginx_version: 1.2.8
3
3
  passenger_root: "#{`bash -l -c 'find #{ruby_path} -name passenger-#{passenger_version}'`.strip}"
4
4
  passenger_ruby: "#{ruby_path}/bin/ruby"
5
5
  passenger_lib: "#{passenger_root}/ext/nginx"
@@ -11,7 +11,7 @@ use_ssl_key: false
11
11
  #if you use an ssl key, put your cert and key
12
12
  # in
13
13
  # #{Rubber.root}/config/#{rubber_env.domain} .crt and .key
14
- #otherwise defaults to key included with linux
14
+ #otherwise defaults to key included with linux
15
15
 
16
16
 
17
17
  roles:
@@ -39,5 +39,5 @@ roles:
39
39
  percona:
40
40
  packages: [
41
41
  percona-server-server,
42
- maatkit # useful mysql tools for replication
42
+ percona-tools # useful mysql tools for replication
43
43
  ]
@@ -60,7 +60,7 @@ namespace :rubber do
60
60
 
61
61
  desc "Starts the redis server"
62
62
  task :start, :roles => :redis do
63
- rsudo "service redis-server status || service redis-server start"
63
+ rsudo "service redis-server start"
64
64
  end
65
65
 
66
66
  desc "Restarts the redis server"
@@ -8,7 +8,7 @@
8
8
 
9
9
  # Redis configuration file example
10
10
 
11
- # Note on units: when memory size is needed, it is possible to specifiy
11
+ # Note on units: when memory size is needed, it is possible to specify
12
12
  # it in the usual form of 1k 5GB 4M and so forth:
13
13
  #
14
14
  # 1k => 1000 bytes
@@ -47,8 +47,24 @@ port <%= rubber_env.redis_server_port %>
47
47
  # Close the connection after a client is idle for N seconds (0 to disable)
48
48
  timeout 300
49
49
 
50
- # Set server verbosity to 'debug'
51
- # it can be one of:
50
+ # TCP keepalive.
51
+ #
52
+ # If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
53
+ # of communication. This is useful for two reasons:
54
+ #
55
+ # 1) Detect dead peers.
56
+ # 2) Take the connection alive from the point of view of network
57
+ # equipment in the middle.
58
+ #
59
+ # On Linux, the specified value (in seconds) is the period used to send ACKs.
60
+ # Note that to close the connection the double of the time is needed.
61
+ # On other kernels the period depends on the kernel configuration.
62
+ #
63
+ # A reasonable value for this option is 60 seconds.
64
+ tcp-keepalive 60
65
+
66
+ # Specify the server verbosity level.
67
+ # This can be one of:
52
68
  # debug (a lot of information, useful for development/testing)
53
69
  # verbose (many rarely useful info, but not a mess like the debug level)
54
70
  # notice (moderately verbose, what you want in production probably)
@@ -67,7 +83,7 @@ logfile <%= rubber_env.redis_server_log_file %>
67
83
  # Specify the syslog identity.
68
84
  # syslog-ident redis
69
85
 
70
- # Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
86
+ # Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
71
87
  # syslog-facility local0
72
88
 
73
89
  # Set the number of databases. The default database is DB 0, you can select
@@ -90,17 +106,47 @@ databases 16
90
106
  # after 60 sec if at least 10000 keys changed
91
107
  #
92
108
  # Note: you can disable saving at all commenting all the "save" lines.
109
+ #
110
+ # It is also possible to remove all the previously configured save
111
+ # points by adding a save directive with a single empty string argument
112
+ # like in the following example:
113
+ #
114
+ # save ""
93
115
 
94
116
  save 900 1
95
117
  save 300 10
96
118
  save 60 10000
97
119
 
120
+ # By default Redis will stop accepting writes if RDB snapshots are enabled
121
+ # (at least one save point) and the latest background save failed.
122
+ # This will make the user aware (in an hard way) that data is not persisting
123
+ # on disk properly, otherwise chances are that no one will notice and some
124
+ # distater will happen.
125
+ #
126
+ # If the background saving process will start working again Redis will
127
+ # automatically allow writes again.
128
+ #
129
+ # However if you have setup your proper monitoring of the Redis server
130
+ # and persistence, you may want to disable this feature so that Redis will
131
+ # continue to work as usually even if there are problems with disk,
132
+ # permissions, and so forth.
133
+ stop-writes-on-bgsave-error yes
134
+
98
135
  # Compress string objects using LZF when dump .rdb databases?
99
136
  # For default that's set to 'yes' as it's almost always a win.
100
137
  # If you want to save some CPU in the saving child set it to 'no' but
101
138
  # the dataset will likely be bigger if you have compressible values or keys.
102
139
  rdbcompression yes
103
140
 
141
+ # Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
142
+ # This makes the format more resistant to corruption but there is a performance
143
+ # hit to pay (around 10%) when saving and loading RDB files, so you can disable it
144
+ # for maximum performances.
145
+ #
146
+ # RDB files created with checksum disabled have a checksum of zero that will
147
+ # tell the loading code to skip the check.
148
+ rdbchecksum yes
149
+
104
150
  # The filename where to dump the DB
105
151
  dbfilename dump.rdb
106
152
 
@@ -109,7 +155,7 @@ dbfilename dump.rdb
109
155
  # The DB will be written inside this directory, with the filename specified
110
156
  # above using the 'dbfilename' configuration directive.
111
157
  #
112
- # Also the Append Only File will be created inside this directory.
158
+ # The Append Only File will also be created inside this directory.
113
159
  #
114
160
  # Note that you must specify a directory here, not a file name.
115
161
  dir <%= rubber_env.redis_db_dir %>
@@ -137,18 +183,79 @@ slaveof <%= redis_master.name %> 6379
137
183
  #
138
184
  # masterauth <master-password>
139
185
 
140
- # When a slave lost the connection with the master, or when the replication
186
+ # When a slave loses its connection with the master, or when the replication
141
187
  # is still in progress, the slave can act in two different ways:
142
188
  #
143
189
  # 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
144
- # still reply to client requests, possibly with out of data data, or the
190
+ # still reply to client requests, possibly with out of date data, or the
145
191
  # data set may just be empty if this is the first synchronization.
146
192
  #
147
- # 2) if slave-serve-stale data is set to 'no' the slave will reply with
193
+ # 2) if slave-serve-stale-data is set to 'no' the slave will reply with
148
194
  # an error "SYNC with master in progress" to all the kind of commands
149
195
  # but to INFO and SLAVEOF.
150
196
  #
151
197
  slave-serve-stale-data yes
198
+
199
+ # You can configure a slave instance to accept writes or not. Writing against
200
+ # a slave instance may be useful to store some ephemeral data (because data
201
+ # written on a slave will be easily deleted after resync with the master) but
202
+ # may also cause problems if clients are writing to it because of a
203
+ # misconfiguration.
204
+ #
205
+ # Since Redis 2.6 by default slaves are read-only.
206
+ #
207
+ # Note: read only slaves are not designed to be exposed to untrusted clients
208
+ # on the internet. It's just a protection layer against misuse of the instance.
209
+ # Still a read only slave exports by default all the administrative commands
210
+ # such as CONFIG, DEBUG, and so forth. To a limited extend you can improve
211
+ # security of read only slaves using 'rename-command' to shadow all the
212
+ # administrative / dangerous commands.
213
+ slave-read-only yes
214
+
215
+ # Slaves send PINGs to server in a predefined interval. It's possible to change
216
+ # this interval with the repl_ping_slave_period option. The default value is 10
217
+ # seconds.
218
+ #
219
+ # repl-ping-slave-period 10
220
+
221
+ # The following option sets a timeout for both Bulk transfer I/O timeout and
222
+ # master data or ping response timeout. The default value is 60 seconds.
223
+ #
224
+ # It is important to make sure that this value is greater than the value
225
+ # specified for repl-ping-slave-period otherwise a timeout will be detected
226
+ # every time there is low traffic between the master and the slave.
227
+ #
228
+ # repl-timeout 60
229
+
230
+ # Disable TCP_NODELAY on the slave socket after SYNC?
231
+ #
232
+ # If you select "yes" Redis will use a smaller number of TCP packets and
233
+ # less bandwidth to send data to slaves. But this can add a delay for
234
+ # the data to appear on the slave side, up to 40 milliseconds with
235
+ # Linux kernels using a default configuration.
236
+ #
237
+ # If you select "no" the delay for data to appear on the slave side will
238
+ # be reduced but more bandwidth will be used for replication.
239
+ #
240
+ # By default we optimize for low latency, but in very high traffic conditions
241
+ # or when the master and slaves are many hops away, turning this to "yes" may
242
+ # be a good idea.
243
+ repl-disable-tcp-nodelay no
244
+
245
+ # The slave priority is an integer number published by Redis in the INFO output.
246
+ # It is used by Redis Sentinel in order to select a slave to promote into a
247
+ # master if the master is no longer working correctly.
248
+ #
249
+ # A slave with a low priority number is considered better for promotion, so
250
+ # for instance if there are three slaves with priority 10, 100, 25 Sentinel will
251
+ # pick the one wtih priority 10, that is the lowest.
252
+ #
253
+ # However a special priority of 0 marks the slave as not able to perform the
254
+ # role of master, so a slave with priority of 0 will never be selected by
255
+ # Redis Sentinel for promotion.
256
+ #
257
+ # By default the priority is 100.
258
+ slave-priority 100
152
259
  <%- end %>
153
260
 
154
261
  ################################## SECURITY ###################################
@@ -168,60 +275,72 @@ slave-serve-stale-data yes
168
275
 
169
276
  # Command renaming.
170
277
  #
171
- # It is possilbe to change the name of dangerous commands in a shared
278
+ # It is possible to change the name of dangerous commands in a shared
172
279
  # environment. For instance the CONFIG command may be renamed into something
173
- # of hard to guess so that it will be still available for internal-use
174
- # tools but not available for general clients.
280
+ # hard to guess so that it will still be available for internal-use tools
281
+ # but not available for general clients.
175
282
  #
176
283
  # Example:
177
284
  #
178
285
  # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
179
286
  #
180
- # It is also possilbe to completely kill a command renaming it into
287
+ # It is also possible to completely kill a command by renaming it into
181
288
  # an empty string:
182
289
  #
183
290
  # rename-command CONFIG ""
291
+ #
292
+ # Please note that changing the name of commands that are logged into the
293
+ # AOF file or transmitted to slaves may cause problems.
184
294
 
185
295
  ################################### LIMITS ####################################
186
296
 
187
- # Set the max number of connected clients at the same time. By default there
188
- # is no limit, and it's up to the number of file descriptors the Redis process
189
- # is able to open. The special value '0' means no limits.
297
+ # Set the max number of connected clients at the same time. By default
298
+ # this limit is set to 10000 clients, however if the Redis server is not
299
+ # able to configure the process file limit to allow for the specified limit
300
+ # the max number of allowed clients is set to the current file limit
301
+ # minus 32 (as Redis reserves a few file descriptors for internal uses).
302
+ #
190
303
  # Once the limit is reached Redis will close all the new connections sending
191
304
  # an error 'max number of clients reached'.
192
305
  #
193
- # maxclients 128
306
+ # maxclients 10000
194
307
 
195
308
  # Don't use more memory than the specified amount of bytes.
196
- # When the memory limit is reached Redis will try to remove keys with an
197
- # EXPIRE set. It will try to start freeing keys that are going to expire
198
- # in little time and preserve keys with a longer time to live.
199
- # Redis will also try to remove objects from free lists if possible.
200
- #
201
- # If all this fails, Redis will start to reply with errors to commands
202
- # that will use more memory, like SET, LPUSH, and so on, and will continue
203
- # to reply to most read-only commands like GET.
204
- #
205
- # WARNING: maxmemory can be a good idea mainly if you want to use Redis as a
206
- # 'state' server or cache, not as a real DB. When Redis is used as a real
207
- # database the memory usage will grow over the weeks, it will be obvious if
208
- # it is going to use too much memory in the long run, and you'll have the time
209
- # to upgrade. With maxmemory after the limit is reached you'll start to get
210
- # errors for write operations, and this may even lead to DB inconsistency.
309
+ # When the memory limit is reached Redis will try to remove keys
310
+ # accordingly to the eviction policy selected (see maxmemmory-policy).
311
+ #
312
+ # If Redis can't remove keys according to the policy, or if the policy is
313
+ # set to 'noeviction', Redis will start to reply with errors to commands
314
+ # that would use more memory, like SET, LPUSH, and so on, and will continue
315
+ # to reply to read-only commands like GET.
316
+ #
317
+ # This option is usually useful when using Redis as an LRU cache, or to set
318
+ # an hard memory limit for an instance (using the 'noeviction' policy).
319
+ #
320
+ # WARNING: If you have slaves attached to an instance with maxmemory on,
321
+ # the size of the output buffers needed to feed the slaves are subtracted
322
+ # from the used memory count, so that network problems / resyncs will
323
+ # not trigger a loop where keys are evicted, and in turn the output
324
+ # buffer of slaves is full with DELs of keys evicted triggering the deletion
325
+ # of more keys, and so forth until the database is completely emptied.
326
+ #
327
+ # In short... if you have slaves attached it is suggested that you set a lower
328
+ # limit for maxmemory so that there is some free RAM on the system for slave
329
+ # output buffers (but this is not needed if the policy is 'noeviction').
211
330
  #
212
331
  # maxmemory <bytes>
213
332
 
214
333
  # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
215
- # is reached? You can select among five behavior:
334
+ # is reached. You can select among five behaviors:
216
335
  #
217
336
  # volatile-lru -> remove the key with an expire set using an LRU algorithm
218
337
  # allkeys-lru -> remove any key accordingly to the LRU algorithm
219
338
  # volatile-random -> remove a random key with an expire set
220
- # allkeys->random -> remove a random key, any key
339
+ # allkeys-random -> remove a random key, any key
221
340
  # volatile-ttl -> remove the key with the nearest expire time (minor TTL)
222
341
  # noeviction -> don't expire at all, just return an error on write operations
223
342
  #
224
- # Note: with all the kind of policies, Redis will return an error on write
343
+ # Note: with any of the above policies, Redis will return an error on write
225
344
  # operations, when there are not suitable keys for eviction.
226
345
  #
227
346
  # At the date of writing this commands are: set setnx setex append
@@ -244,21 +363,23 @@ slave-serve-stale-data yes
244
363
 
245
364
  ############################## APPEND ONLY MODE ###############################
246
365
 
247
- # By default Redis asynchronously dumps the dataset on disk. If you can live
248
- # with the idea that the latest records will be lost if something like a crash
249
- # happens this is the preferred way to run Redis. If instead you care a lot
250
- # about your data and don't want to that a single record can get lost you should
251
- # enable the append only mode: when this mode is enabled Redis will append
252
- # every write operation received in the file appendonly.aof. This file will
253
- # be read on startup in order to rebuild the full dataset in memory.
366
+ # By default Redis asynchronously dumps the dataset on disk. This mode is
367
+ # good enough in many applications, but an issue with the Redis process or
368
+ # a power outage may result into a few minutes of writes lost (depending on
369
+ # the configured save points).
254
370
  #
255
- # Note that you can have both the async dumps and the append only file if you
256
- # like (you have to comment the "save" statements above to disable the dumps).
257
- # Still if append only mode is enabled Redis will load the data from the
258
- # log file at startup ignoring the dump.rdb file.
371
+ # The Append Only File is an alternative persistence mode that provides
372
+ # much better durability. For instance using the default data fsync policy
373
+ # (see later in the config file) Redis can lose just one second of writes in a
374
+ # dramatic event like a server power outage, or a single write if something
375
+ # wrong with the Redis process itself happens, but the operating system is
376
+ # still running correctly.
259
377
  #
260
- # IMPORTANT: Check the BGREWRITEAOF to check how to rewrite the append
261
- # log file in background when it gets too big.
378
+ # AOF and RDB persistence can be enabled at the same time without problems.
379
+ # If the AOF is enabled on startup Redis will load the AOF, that is the file
380
+ # with the better durability guarantees.
381
+ #
382
+ # Please check http://redis.io/topics/persistence for more information.
262
383
 
263
384
  appendonly no
264
385
 
@@ -273,16 +394,19 @@ appendonly no
273
394
  #
274
395
  # no: don't fsync, just let the OS flush the data when it wants. Faster.
275
396
  # always: fsync after every write to the append only log . Slow, Safest.
276
- # everysec: fsync only if one second passed since the last fsync. Compromise.
397
+ # everysec: fsync only one time every second. Compromise.
277
398
  #
278
- # The default is "everysec" that's usually the right compromise between
399
+ # The default is "everysec", as that's usually the right compromise between
279
400
  # speed and data safety. It's up to you to understand if you can relax this to
280
- # "no" that will will let the operating system flush the output buffer when
401
+ # "no" that will let the operating system flush the output buffer when
281
402
  # it wants, for better performances (but if you can live with the idea of
282
403
  # some data loss consider the default persistence mode that's snapshotting),
283
404
  # or on the contrary, use "always" that's very slow but a bit safer than
284
405
  # everysec.
285
406
  #
407
+ # More details please check the following article:
408
+ # http://antirez.com/post/redis-persistence-demystified.html
409
+ #
286
410
  # If unsure, use "everysec".
287
411
 
288
412
  # appendfsync always
@@ -300,9 +424,9 @@ appendfsync everysec
300
424
  # that will prevent fsync() from being called in the main process while a
301
425
  # BGSAVE or BGREWRITEAOF is in progress.
302
426
  #
303
- # This means that while another child is saving the durability of Redis is
304
- # the same as "appendfsync none", that in pratical terms means that it is
305
- # possible to lost up to 30 seconds of log in the worst scenario (with the
427
+ # This means that while another child is saving, the durability of Redis is
428
+ # the same as "appendfsync none". In practical terms, this means that it is
429
+ # possible to lose up to 30 seconds of log in the worst scenario (with the
306
430
  # default Linux settings).
307
431
  #
308
432
  # If you have latency problems turn this to "yes". Otherwise leave it as
@@ -311,10 +435,10 @@ no-appendfsync-on-rewrite no
311
435
 
312
436
  # Automatic rewrite of the append only file.
313
437
  # Redis is able to automatically rewrite the log file implicitly calling
314
- # BGREWRITEAOF when the AOF log size will growth by the specified percentage.
438
+ # BGREWRITEAOF when the AOF log size grows by the specified percentage.
315
439
  #
316
440
  # This is how it works: Redis remembers the size of the AOF file after the
317
- # latest rewrite (or if no rewrite happened since the restart, the size of
441
+ # latest rewrite (if no rewrite has happened since the restart, the size of
318
442
  # the AOF at startup is used).
319
443
  #
320
444
  # This base size is compared to the current size. If the current size is
@@ -323,12 +447,30 @@ no-appendfsync-on-rewrite no
323
447
  # is useful to avoid rewriting the AOF file even if the percentage increase
324
448
  # is reached but it is still pretty small.
325
449
  #
326
- # Specify a precentage of zero in order to disable the automatic AOF
450
+ # Specify a percentage of zero in order to disable the automatic AOF
327
451
  # rewrite feature.
328
452
 
329
453
  auto-aof-rewrite-percentage 100
330
454
  auto-aof-rewrite-min-size 64mb
331
455
 
456
+ ################################ LUA SCRIPTING ###############################
457
+
458
+ # Max execution time of a Lua script in milliseconds.
459
+ #
460
+ # If the maximum execution time is reached Redis will log that a script is
461
+ # still in execution after the maximum allowed time and will start to
462
+ # reply to queries with an error.
463
+ #
464
+ # When a long running script exceed the maximum execution time only the
465
+ # SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be
466
+ # used to stop a script that did not yet called write commands. The second
467
+ # is the only way to shut down the server in the case a write commands was
468
+ # already issue by the script but the user don't want to wait for the natural
469
+ # termination of the script.
470
+ #
471
+ # Set it to 0 or a negative value for unlimited execution without warnings.
472
+ lua-time-limit 5000
473
+
332
474
  ################################## SLOW LOG ###################################
333
475
 
334
476
  # The Redis Slow Log is a system to log queries that exceeded a specified
@@ -353,89 +495,13 @@ slowlog-log-slower-than 10000
353
495
  # You can reclaim memory used by the slow log with SLOWLOG RESET.
354
496
  slowlog-max-len 1024
355
497
 
356
- ################################ VIRTUAL MEMORY ###############################
357
-
358
- ### WARNING! Virtual Memory is deprecated in Redis 2.4
359
- ### The use of Virtual Memory is strongly discouraged.
360
-
361
- # Virtual Memory allows Redis to work with datasets bigger than the actual
362
- # amount of RAM needed to hold the whole dataset in memory.
363
- # In order to do so very used keys are taken in memory while the other keys
364
- # are swapped into a swap file, similarly to what operating systems do
365
- # with memory pages.
366
- #
367
- # To enable VM just set 'vm-enabled' to yes, and set the following three
368
- # VM parameters accordingly to your needs.
369
-
370
- vm-enabled no
371
- # vm-enabled yes
372
-
373
- # This is the path of the Redis swap file. As you can guess, swap files
374
- # can't be shared by different Redis instances, so make sure to use a swap
375
- # file for every redis process you are running. Redis will complain if the
376
- # swap file is already in use.
377
- #
378
- # The best kind of storage for the Redis swap file (that's accessed at random)
379
- # is a Solid State Disk (SSD).
380
- #
381
- # *** WARNING *** if you are using a shared hosting the default of putting
382
- # the swap file under /tmp is not secure. Create a dir with access granted
383
- # only to Redis user and configure Redis to create the swap file there.
384
- vm-swap-file <%= rubber_env.redis_db_dir %>/redis.swap
385
-
386
- # vm-max-memory configures the VM to use at max the specified amount of
387
- # RAM. Everything that deos not fit will be swapped on disk *if* possible, that
388
- # is, if there is still enough contiguous space in the swap file.
389
- #
390
- # With vm-max-memory 0 the system will swap everything it can. Not a good
391
- # default, just specify the max amount of RAM you can in bytes, but it's
392
- # better to leave some margin. For instance specify an amount of RAM
393
- # that's more or less between 60 and 80% of your free RAM.
394
- vm-max-memory 0
395
-
396
- # Redis swap files is split into pages. An object can be saved using multiple
397
- # contiguous pages, but pages can't be shared between different objects.
398
- # So if your page is too big, small objects swapped out on disk will waste
399
- # a lot of space. If you page is too small, there is less space in the swap
400
- # file (assuming you configured the same number of total swap file pages).
401
- #
402
- # If you use a lot of small objects, use a page size of 64 or 32 bytes.
403
- # If you use a lot of big objects, use a bigger page size.
404
- # If unsure, use the default :)
405
- vm-page-size 32
406
-
407
- # Number of total memory pages in the swap file.
408
- # Given that the page table (a bitmap of free/used pages) is taken in memory,
409
- # every 8 pages on disk will consume 1 byte of RAM.
410
- #
411
- # The total swap size is vm-page-size * vm-pages
412
- #
413
- # With the default of 32-bytes memory pages and 134217728 pages Redis will
414
- # use a 4 GB swap file, that will use 16 MB of RAM for the page table.
415
- #
416
- # It's better to use the smallest acceptable value for your application,
417
- # but the default is large in order to work in most conditions.
418
- vm-pages 134217728
419
-
420
- # Max number of VM I/O threads running at the same time.
421
- # This threads are used to read/write data from/to swap file, since they
422
- # also encode and decode objects from disk to memory or the reverse, a bigger
423
- # number of threads can help with big objects even if they can't help with
424
- # I/O itself as the physical device may not be able to couple with many
425
- # reads/writes operations at the same time.
426
- #
427
- # The special value of 0 turn off threaded I/O and enables the blocking
428
- # Virtual Memory implementation.
429
- vm-max-threads 4
430
-
431
498
  ############################### ADVANCED CONFIG ###############################
432
499
 
433
- # Hashes are encoded in a special way (much more memory efficient) when they
434
- # have at max a given numer of elements, and the biggest element does not
435
- # exceed a given threshold. You can configure this limits with the following
436
- # configuration directives.
437
- hash-max-zipmap-entries 512
438
- hash-max-zipmap-value 64
500
+ # Hashes are encoded using a memory efficient data structure when they have a
501
+ # small number of entries, and the biggest entry does not exceed a given
502
+ # threshold. These thresholds can be configured using the following directives.
503
+ hash-max-ziplist-entries 512
504
+ hash-max-ziplist-value 64
439
505
 
440
506
  # Similarly to hashes, small lists are also encoded in a special way in order
441
507
  # to save a lot of space. The special representation is only used when
@@ -458,9 +524,9 @@ zset-max-ziplist-value 64
458
524
 
459
525
  # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
460
526
  # order to help rehashing the main Redis hash table (the one mapping top-level
461
- # keys to values). The hash table implementation redis uses (see dict.c)
527
+ # keys to values). The hash table implementation Redis uses (see dict.c)
462
528
  # performs a lazy rehashing: the more operation you run into an hash table
463
- # that is rhashing, the more rehashing "steps" are performed, so if the
529
+ # that is rehashing, the more rehashing "steps" are performed, so if the
464
530
  # server is idle the rehashing is never complete and some more memory is used
465
531
  # by the hash table.
466
532
  #
@@ -476,12 +542,66 @@ zset-max-ziplist-value 64
476
542
  # want to free memory asap when possible.
477
543
  activerehashing yes
478
544
 
545
+ # The client output buffer limits can be used to force disconnection of clients
546
+ # that are not reading data from the server fast enough for some reason (a
547
+ # common reason is that a Pub/Sub client can't consume messages as fast as the
548
+ # publisher can produce them).
549
+ #
550
+ # The limit can be set differently for the three different classes of clients:
551
+ #
552
+ # normal -> normal clients
553
+ # slave -> slave clients and MONITOR clients
554
+ # pubsub -> clients subcribed to at least one pubsub channel or pattern
555
+ #
556
+ # The syntax of every client-output-buffer-limit directive is the following:
557
+ #
558
+ # client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
559
+ #
560
+ # A client is immediately disconnected once the hard limit is reached, or if
561
+ # the soft limit is reached and remains reached for the specified number of
562
+ # seconds (continuously).
563
+ # So for instance if the hard limit is 32 megabytes and the soft limit is
564
+ # 16 megabytes / 10 seconds, the client will get disconnected immediately
565
+ # if the size of the output buffers reach 32 megabytes, but will also get
566
+ # disconnected if the client reaches 16 megabytes and continuously overcomes
567
+ # the limit for 10 seconds.
568
+ #
569
+ # By default normal clients are not limited because they don't receive data
570
+ # without asking (in a push way), but just after a request, so only
571
+ # asynchronous clients may create a scenario where data is requested faster
572
+ # than it can read.
573
+ #
574
+ # Instead there is a default limit for pubsub and slave clients, since
575
+ # subscribers and slaves receive data in a push fashion.
576
+ #
577
+ # Both the hard or the soft limit can be disabled by setting them to zero.
578
+ client-output-buffer-limit normal 0 0 0
579
+ client-output-buffer-limit slave 256mb 64mb 60
580
+ client-output-buffer-limit pubsub 32mb 8mb 60
581
+
582
+ # Redis calls an internal function to perform many background tasks, like
583
+ # closing connections of clients in timeot, purging expired keys that are
584
+ # never requested, and so forth.
585
+ #
586
+ # Not all tasks are perforemd with the same frequency, but Redis checks for
587
+ # tasks to perform accordingly to the specified "hz" value.
588
+ #
589
+ # By default "hz" is set to 10. Raising the value will use more CPU when
590
+ # Redis is idle, but at the same time will make Redis more responsive when
591
+ # there are many keys expiring at the same time, and timeouts may be
592
+ # handled with more precision.
593
+ #
594
+ # The range is between 1 and 500, however a value over 100 is usually not
595
+ # a good idea. Most users should use the default of 10 and raise this up to
596
+ # 100 only in environments where very low latency is required.
597
+ hz 10
598
+
479
599
  ################################## INCLUDES ###################################
480
600
 
481
601
  # Include one or more other config files here. This is useful if you
482
- # have a standard template that goes to all redis server but also need
602
+ # have a standard template that goes to all Redis server but also need
483
603
  # to customize a few per-server settings. Include files can include
484
604
  # other files, so use this wisely.
485
605
  #
486
606
  # include /path/to/local.conf
487
- # include /path/to/other.conf
607
+ # include /path/to/other.conf