~replaceafill/+junk/replication_examples

« back to all changes in this revision

Viewing changes to another_school/etc/schooltool/standard/redis.conf

  • Committer: Douglas Cerna
  • Date: 2014-06-12 18:25:36 UTC
  • Revision ID: douglascerna@yahoo.com-20140612182536-mz9bifeinrfd1ney
Added replication configuration examples for the central server and two sample schools

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 yes
 
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/lib/schooltool/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 7079
 
26
 
 
27
# If you want you can bind a single interface, if the bind option is not
 
28
# specified all the interfaces will listen for incoming connections.
 
29
#
 
30
bind 127.0.0.1
 
31
 
 
32
# Specify the path for the unix socket that will be used to listen for
 
33
# incoming connections. There is no default, so Redis will not listen
 
34
# on a unix socket when not specified.
 
35
#
 
36
#unixsocket /var/lib/schooltool/redis.sock
 
37
 
 
38
# Close the connection after a client is idle for N seconds (0 to disable)
 
39
timeout 300
 
40
 
 
41
# Set server verbosity to 'debug'
 
42
# it can be one of:
 
43
# debug (a lot of information, useful for development/testing)
 
44
# verbose (many rarely useful info, but not a mess like the debug level)
 
45
# notice (moderately verbose, what you want in production probably)
 
46
# warning (only very important / critical messages are logged)
 
47
loglevel notice
 
48
 
 
49
# Specify the log file name. Also 'stdout' can be used to force
 
50
# Redis to log on the standard output. Note that if you use standard
 
51
# output for logging but daemonize, logs will be sent to /dev/null
 
52
logfile /var/log/schooltool/redis.log
 
53
 
 
54
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
 
55
# and optionally update the other syslog parameters to suit your needs.
 
56
# syslog-enabled no
 
57
 
 
58
# Specify the syslog identity.
 
59
# syslog-ident redis
 
60
 
 
61
# Specify the syslog facility.  Must be USER or between LOCAL0-LOCAL7.
 
62
# syslog-facility local0
 
63
 
 
64
# Set the number of databases. The default database is DB 0, you can select
 
65
# a different one on a per-connection basis using SELECT <dbid> where
 
66
# dbid is a number between 0 and 'databases'-1
 
67
databases 4
 
68
 
 
69
################################ SNAPSHOTTING  #################################
 
70
#
 
71
# Save the DB on disk:
 
72
#
 
73
#   save <seconds> <changes>
 
74
#
 
75
#   Will save the DB if both the given number of seconds and the given
 
76
#   number of write operations against the DB occurred.
 
77
#
 
78
#   In the example below the behaviour will be to save:
 
79
#   after 900 sec (15 min) if at least 1 key changed
 
80
#   after 300 sec (5 min) if at least 10 keys changed
 
81
#   after 60 sec if at least 10000 keys changed
 
82
#
 
83
#   Note: you can disable saving at all commenting all the "save" lines.
 
84
 
 
85
save 900 1
 
86
save 300 10
 
87
save 60 10000
 
88
 
 
89
# Compress string objects using LZF when dump .rdb databases?
 
90
# For default that's set to 'yes' as it's almost always a win.
 
91
# If you want to save some CPU in the saving child set it to 'no' but
 
92
# the dataset will likely be bigger if you have compressible values or keys.
 
93
rdbcompression yes
 
94
 
 
95
# The filename where to dump the DB
 
96
dbfilename redis-dump.rdb
 
97
 
 
98
# The working directory.
 
99
#
 
100
# The DB will be written inside this directory, with the filename specified
 
101
# above using the 'dbfilename' configuration directive.
 
102
#
 
103
# Also the Append Only File will be created inside this directory.
 
104
#
 
105
# Note that you must specify a directory here, not a file name.
 
106
dir /var/lib/schooltool
 
107
 
 
108
################################# REPLICATION #################################
 
109
 
 
110
# Master-Slave replication. Use slaveof to make a Redis instance a copy of
 
111
# another Redis server. Note that the configuration is local to the slave
 
112
# so for example it is possible to configure the slave to save the DB with a
 
113
# different interval, or to listen to another port, and so on.
 
114
#
 
115
# slaveof <masterip> <masterport>
 
116
 
 
117
# If the master is password protected (using the "requirepass" configuration
 
118
# directive below) it is possible to tell the slave to authenticate before
 
119
# starting the replication synchronization process, otherwise the master will
 
120
# refuse the slave request.
 
121
#
 
122
# masterauth <master-password>
 
123
 
 
124
# When a slave lost the connection with the master, or when the replication
 
125
# is still in progress, the slave can act in two different ways:
 
126
#
 
127
# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
 
128
#    still reply to client requests, possibly with out of date data, or the
 
129
#    data set may just be empty if this is the first synchronization.
 
130
#
 
131
# 2) if slave-serve-stale data is set to 'no' the slave will reply with
 
132
#    an error "SYNC with master in progress" to all the kind of commands
 
133
#    but to INFO and SLAVEOF.
 
134
#
 
135
slave-serve-stale-data yes
 
136
 
 
137
################################## SECURITY ###################################
 
138
 
 
139
# Require clients to issue AUTH <PASSWORD> before processing any other
 
140
# commands.  This might be useful in environments in which you do not trust
 
141
# others with access to the host running redis-server.
 
142
#
 
143
# This should stay commented out for backward compatibility and because most
 
144
# people do not need auth (e.g. they run their own servers).
 
145
#
 
146
# Warning: since Redis is pretty fast an outside user can try up to
 
147
# 150k passwords per second against a good box. This means that you should
 
148
# use a very strong password otherwise it will be very easy to break.
 
149
#
 
150
# requirepass foobared
 
151
 
 
152
# Command renaming.
 
153
#
 
154
# It is possible to change the name of dangerous commands in a shared
 
155
# environment. For instance the CONFIG command may be renamed into something
 
156
# of hard to guess so that it will be still available for internal-use
 
157
# tools but not available for general clients.
 
158
#
 
159
# Example:
 
160
#
 
161
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
 
162
#
 
163
# It is also possible to completely kill a command renaming it into
 
164
# an empty string:
 
165
#
 
166
# rename-command CONFIG ""
 
167
 
 
168
################################### LIMITS ####################################
 
169
 
 
170
# Set the max number of connected clients at the same time. By default
 
171
# this limit is set to 10000 clients, however if the Redis server is not
 
172
# able ot configure the process file limit to allow for the specified limit
 
173
# the max number of allowed clients is set to the current file limit
 
174
# minus 32 (as Redis reserves a few file descriptors for internal uses).
 
175
#
 
176
# Once the limit is reached Redis will close all the new connections sending
 
177
# an error 'max number of clients reached'.
 
178
#
 
179
# maxclients 10000
 
180
 
 
181
# Don't use more memory than the specified amount of bytes.
 
182
# When the memory limit is reached Redis will try to remove keys
 
183
# accordingly to the eviction policy selected (see maxmemmory-policy).
 
184
#
 
185
# If Redis can't remove keys according to the policy, or if the policy is
 
186
# set to 'noeviction', Redis will start to reply with errors to commands
 
187
# that would use more memory, like SET, LPUSH, and so on, and will continue
 
188
# to reply to read-only commands like GET.
 
189
#
 
190
# This option is usually useful when using Redis as an LRU cache, or to set
 
191
# an hard memory limit for an instance (using the 'noeviction' policy).
 
192
#
 
193
# WARNING: If you have slaves attached to an instance with maxmemory on,
 
194
# the size of the output buffers needed to feed the slaves are subtracted
 
195
# from the used memory count, so that network problems / resyncs will
 
196
# not trigger a loop where keys are evicted, and in turn the output
 
197
# buffer of slaves is full with DELs of keys evicted triggering the deletion
 
198
# of more keys, and so forth until the database is completely emptied.
 
199
#
 
200
# In short... if you have slaves attached it is suggested that you set a lower
 
201
# limit for maxmemory so that there is some free RAM on the system for slave
 
202
# output buffers (but this is not needed if the policy is 'noeviction').
 
203
#
 
204
# maxmemory <bytes>
 
205
 
 
206
# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
 
207
# is reached? You can select among five behavior:
 
208
#
 
209
# volatile-lru -> remove the key with an expire set using an LRU algorithm
 
210
# allkeys-lru -> remove any key accordingly to the LRU algorithm
 
211
# volatile-random -> remove a random key with an expire set
 
212
# allkeys-random -> remove a random key, any key
 
213
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
 
214
# noeviction -> don't expire at all, just return an error on write operations
 
215
#
 
216
# Note: with all the kind of policies, Redis will return an error on write
 
217
#       operations, when there are not suitable keys for eviction.
 
218
#
 
219
#       At the date of writing this commands are: set setnx setex append
 
220
#       incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
 
221
#       sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
 
222
#       zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
 
223
#       getset mset msetnx exec sort
 
224
#
 
225
# The default is:
 
226
#
 
227
# maxmemory-policy volatile-lru
 
228
 
 
229
# LRU and minimal TTL algorithms are not precise algorithms but approximated
 
230
# algorithms (in order to save memory), so you can select as well the sample
 
231
# size to check. For instance for default Redis will check three keys and
 
232
# pick the one that was used less recently, you can change the sample size
 
233
# using the following configuration directive.
 
234
#
 
235
# maxmemory-samples 3
 
236
 
 
237
############################## APPEND ONLY MODE ###############################
 
238
 
 
239
# By default Redis asynchronously dumps the dataset on disk. This mode is
 
240
# good enough in many applications, but an issue with the Redis process or
 
241
# a power outage may result into a few minutes of writes lost (depending on
 
242
# the configured save points).
 
243
#
 
244
# The Append Only File is an alternative persistence mode that provides
 
245
# much better durability. For instance using the default data fsync policy
 
246
# (see later in the config file) Redis can lose just one second of writes in a
 
247
# dramatic event like a server power outage, or a single write if something
 
248
# wrong with the Redis process itself happens, but the operating system is
 
249
# still running correctly.
 
250
#
 
251
# AOF and RDB persistence can be enabled at the same time without problems.
 
252
# If the AOF is enabled on startup Redis will load the AOF, that is the file
 
253
# with the better durability guarantees.
 
254
#
 
255
# Please check http://redis.io/topics/persistence for more information.
 
256
 
 
257
appendonly no
 
258
 
 
259
# The name of the append only file (default: "appendonly.aof")
 
260
# appendfilename appendonly.aof
 
261
 
 
262
# The fsync() call tells the Operating System to actually write data on disk
 
263
# instead to wait for more data in the output buffer. Some OS will really flush
 
264
# data on disk, some other OS will just try to do it ASAP.
 
265
#
 
266
# Redis supports three different modes:
 
267
#
 
268
# no: don't fsync, just let the OS flush the data when it wants. Faster.
 
269
# always: fsync after every write to the append only log . Slow, Safest.
 
270
# everysec: fsync only one time every second. Compromise.
 
271
#
 
272
# The default is "everysec" that's usually the right compromise between
 
273
# speed and data safety. It's up to you to understand if you can relax this to
 
274
# "no" that will let the operating system flush the output buffer when
 
275
# it wants, for better performances (but if you can live with the idea of
 
276
# some data loss consider the default persistence mode that's snapshotting),
 
277
# or on the contrary, use "always" that's very slow but a bit safer than
 
278
# everysec.
 
279
#
 
280
# More details please check the following article:
 
281
# http://antirez.com/post/redis-persistence-demystified.html
 
282
#
 
283
# If unsure, use "everysec".
 
284
 
 
285
# appendfsync always
 
286
appendfsync everysec
 
287
# appendfsync no
 
288
 
 
289
# When the AOF fsync policy is set to always or everysec, and a background
 
290
# saving process (a background save or AOF log background rewriting) is
 
291
# performing a lot of I/O against the disk, in some Linux configurations
 
292
# Redis may block too long on the fsync() call. Note that there is no fix for
 
293
# this currently, as even performing fsync in a different thread will block
 
294
# our synchronous write(2) call.
 
295
#
 
296
# In order to mitigate this problem it's possible to use the following option
 
297
# that will prevent fsync() from being called in the main process while a
 
298
# BGSAVE or BGREWRITEAOF is in progress.
 
299
#
 
300
# This means that while another child is saving the durability of Redis is
 
301
# the same as "appendfsync none", that in practical terms means that it is
 
302
# possible to lost up to 30 seconds of log in the worst scenario (with the
 
303
# default Linux settings).
 
304
#
 
305
# If you have latency problems turn this to "yes". Otherwise leave it as
 
306
# "no" that is the safest pick from the point of view of durability.
 
307
no-appendfsync-on-rewrite no
 
308
 
 
309
############################### ADVANCED CONFIG ###############################
 
310
 
 
311
# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
 
312
# order to help rehashing the main Redis hash table (the one mapping top-level
 
313
# keys to values). The hash table implementation Redis uses (see dict.c)
 
314
# performs a lazy rehashing: the more operation you run into an hash table
 
315
# that is rehashing, the more rehashing "steps" are performed, so if the
 
316
# server is idle the rehashing is never complete and some more memory is used
 
317
# by the hash table.
 
318
#
 
319
# The default is to use this millisecond 10 times every second in order to
 
320
# active rehashing the main dictionaries, freeing memory when possible.
 
321
#
 
322
# If unsure:
 
323
# use "activerehashing no" if you have hard latency requirements and it is
 
324
# not a good thing in your environment that Redis can reply form time to time
 
325
# to queries with 2 milliseconds delay.
 
326
#
 
327
# use "activerehashing yes" if you don't have such hard requirements but
 
328
# want to free memory asap when possible.
 
329
activerehashing yes
 
330
 
 
331
################################## INCLUDES ###################################
 
332
 
 
333
# Include one or more other config files here.  This is useful if you
 
334
# have a standard template that goes to all Redis server but also need
 
335
# to customize a few per-server settings.  Include files can include
 
336
# other files, so use this wisely.
 
337
#
 
338
# include /path/to/local.conf
 
339
# include /path/to/other.conf