├── README.md ├── conf ├── redis-fpc.conf ├── redis-magento.conf ├── redis-obj.conf └── redis-ses.conf └── init ├── redis-fpc ├── redis-obj └── redis-ses /README.md: -------------------------------------------------------------------------------- 1 | Redis Config/Init 2 | ==================== 3 | 4 | Redis init scripts and config files for running multiple instances for Magento. 5 | 6 | These files were written for CentOS 6.3/4 and have been tested on RHEL as well. 7 | 8 | This is being used so we can create 3 instances for Magento Enterprise - sessions, object cache and full page cache. Each instance (obj, ses, and fpc) have their own init scrip and configuration file. 9 | 10 | 11 | Installing 12 | =================== 13 | Move files from init to /etc/init.d 14 | Move files from conf to /etc/redis 15 | 16 | Ensure the folders have been created for where we are storing the logs and data 17 | 18 | Make the files executable and add to chkconfig so they start on reboot 19 | 20 | sudo chmod 755 /etc/init.d/redis-obj 21 | sudo chkconfig --add redis-obj 22 | sudo chkconfig --level 345 redis-obj on 23 | 24 | sudo chmod 755 /etc/init.d/redis-ses 25 | sudo chkconfig --add redis-ses 26 | sudo chkconfig --level 345 redis-ses on 27 | 28 | sudo chmod 755 /etc/init.d/redis-fpc 29 | sudo chkconfig --add redis-fpc 30 | sudo chkconfig --level 345 redis-fpc on -------------------------------------------------------------------------------- /conf/redis-fpc.conf: -------------------------------------------------------------------------------- 1 | # This config is for a specific instance of a redis server when running multiple servers 2 | # This file is what is used when running the redis server 3 | 4 | # include the main redis config file with common settings 5 | include /etc/redis/redis-magento.conf 6 | 7 | port 6381 8 | pidfile /var/run/redis-fpc.pid 9 | logfile /var/log/redis/fpc.log 10 | dir /var/lib/redis/fpc 11 | 12 | maxmemory 250mb 13 | -------------------------------------------------------------------------------- /conf/redis-magento.conf: -------------------------------------------------------------------------------- 1 | # Redis common configuration file for all Magento instances 2 | # Instance names: ses, obj, and fpc 3 | # Ports, PID, memory, files etc are set in those files 4 | 5 | # Note on units: when memory size is needed, it is possible to specify 6 | # it in the usual form of 1k 5GB 4M and so forth: 7 | # 8 | # 1k => 1000 bytes 9 | # 1kb => 1024 bytes 10 | # 1m => 1000000 bytes 11 | # 1mb => 1024*1024 bytes 12 | # 1g => 1000000000 bytes 13 | # 1gb => 1024*1024*1024 bytes 14 | # 15 | # units are case insensitive so 1GB 1Gb 1gB are all the same. 16 | 17 | # By default Redis does not run as a daemon. Use 'yes' if you need it. 18 | # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. 19 | daemonize yes 20 | 21 | # When running daemonized, Redis writes a pid file in /var/run/redis.pid by 22 | # default. You can specify a custom pid file location here. 23 | # pidfile /var/run/redis-obj.pid - # set in instance file 24 | 25 | # Accept connections on the specified port, default is 6379. 26 | # If port 0 is specified Redis will not listen on a TCP socket. 27 | # ses = 6379, obj = 6380, fpc = 6381 28 | # port 6380 - # set in instance file 29 | 30 | # If you want you can bind a single interface, if the bind option is not 31 | # specified all the interfaces will listen for incoming connections. 32 | # 33 | # bind 127.0.0.1 34 | 35 | # Specify the path for the unix socket that will be used to listen for 36 | # incoming connections. There is no default, so Redis will not listen 37 | # on a unix socket when not specified. 38 | # 39 | # unixsocket /tmp/redis.sock 40 | # unixsocketperm 755 41 | 42 | # Close the connection after a client is idle for N seconds (0 to disable) 43 | timeout 0 44 | 45 | # TCP keepalive. 46 | # 47 | # If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence 48 | # of communication. This is useful for two reasons: 49 | # 50 | # 1) Detect dead peers. 51 | # 2) Take the connection alive from the point of view of network 52 | # equipment in the middle. 53 | # 54 | # On Linux, the specified value (in seconds) is the period used to send ACKs. 55 | # Note that to close the connection the double of the time is needed. 56 | # On other kernels the period depends on the kernel configuration. 57 | # 58 | # A reasonable value for this option is 60 seconds. 59 | tcp-keepalive 0 60 | 61 | # Specify the server verbosity level. 62 | # This can be one of: 63 | # debug (a lot of information, useful for development/testing) 64 | # verbose (many rarely useful info, but not a mess like the debug level) 65 | # notice (moderately verbose, what you want in production probably) 66 | # warning (only very important / critical messages are logged) 67 | loglevel notice 68 | 69 | # Specify the log file name. Also 'stdout' can be used to force 70 | # Redis to log on the standard output. Note that if you use standard 71 | # output for logging but daemonize, logs will be sent to /dev/null 72 | #logfile stdout 73 | # logfile /var/log/redis/obj.log # set in instance file 74 | 75 | # To enable logging to the system logger, just set 'syslog-enabled' to yes, 76 | # and optionally update the other syslog parameters to suit your needs. 77 | # syslog-enabled no 78 | 79 | # Specify the syslog identity. 80 | # syslog-ident redis 81 | 82 | # Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7. 83 | # syslog-facility local0 84 | 85 | # Set the number of databases. The default database is DB 0, you can select 86 | # a different one on a per-connection basis using SELECT where 87 | # dbid is a number between 0 and 'databases'-1 88 | databases 16 89 | 90 | ################################ SNAPSHOTTING ################################# 91 | # 92 | # Save the DB on disk: 93 | # 94 | # save 95 | # 96 | # Will save the DB if both the given number of seconds and the given 97 | # number of write operations against the DB occurred. 98 | # 99 | # In the example below the behaviour will be to save: 100 | # after 900 sec (15 min) if at least 1 key changed 101 | # after 300 sec (5 min) if at least 10 keys changed 102 | # after 60 sec if at least 10000 keys changed 103 | # 104 | # Note: you can disable saving at all commenting all the "save" lines. 105 | # 106 | # It is also possible to remove all the previously configured save 107 | # points by adding a save directive with a single empty string argument 108 | # like in the following example: 109 | # 110 | # save "" 111 | 112 | # Disable snapshotting 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 /var/lib/redis/obj # set in instance file 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 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 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 a timeout for both Bulk transfer I/O timeout and 212 | # master data or ping response timeout. The default value is 60 seconds. 213 | # 214 | # It is important to make sure that this value is greater than the value 215 | # specified for repl-ping-slave-period otherwise a timeout will be detected 216 | # every time there is low traffic between the master and the slave. 217 | # 218 | # repl-timeout 60 219 | 220 | # Disable TCP_NODELAY on the slave socket after SYNC? 221 | # 222 | # If you select "yes" Redis will use a smaller number of TCP packets and 223 | # less bandwidth to send data to slaves. But this can add a delay for 224 | # the data to appear on the slave side, up to 40 milliseconds with 225 | # Linux kernels using a default configuration. 226 | # 227 | # If you select "no" the delay for data to appear on the slave side will 228 | # be reduced but more bandwidth will be used for replication. 229 | # 230 | # By default we optimize for low latency, but in very high traffic conditions 231 | # or when the master and slaves are many hops away, turning this to "yes" may 232 | # be a good idea. 233 | repl-disable-tcp-nodelay no 234 | 235 | # The slave priority is an integer number published by Redis in the INFO output. 236 | # It is used by Redis Sentinel in order to select a slave to promote into a 237 | # master if the master is no longer working correctly. 238 | # 239 | # A slave with a low priority number is considered better for promotion, so 240 | # for instance if there are three slaves with priority 10, 100, 25 Sentinel will 241 | # pick the one wtih priority 10, that is the lowest. 242 | # 243 | # However a special priority of 0 marks the slave as not able to perform the 244 | # role of master, so a slave with priority of 0 will never be selected by 245 | # Redis Sentinel for promotion. 246 | # 247 | # By default the priority is 100. 248 | slave-priority 100 249 | 250 | ################################## SECURITY ################################### 251 | 252 | # Require clients to issue AUTH before processing any other 253 | # commands. This might be useful in environments in which you do not trust 254 | # others with access to the host running redis-server. 255 | # 256 | # This should stay commented out for backward compatibility and because most 257 | # people do not need auth (e.g. they run their own servers). 258 | # 259 | # Warning: since Redis is pretty fast an outside user can try up to 260 | # 150k passwords per second against a good box. This means that you should 261 | # use a very strong password otherwise it will be very easy to break. 262 | # 263 | # requirepass foobared 264 | 265 | # Command renaming. 266 | # 267 | # It is possible to change the name of dangerous commands in a shared 268 | # environment. For instance the CONFIG command may be renamed into something 269 | # hard to guess so that it will still be available for internal-use tools 270 | # but not available for general clients. 271 | # 272 | # Example: 273 | # 274 | # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 275 | # 276 | # It is also possible to completely kill a command by renaming it into 277 | # an empty string: 278 | # 279 | # rename-command CONFIG "" 280 | # 281 | # Please note that changing the name of commands that are logged into the 282 | # AOF file or transmitted to slaves may cause problems. 283 | 284 | ################################### LIMITS #################################### 285 | 286 | # Set the max number of connected clients at the same time. By default 287 | # this limit is set to 10000 clients, however if the Redis server is not 288 | # able to configure the process file limit to allow for the specified limit 289 | # the max number of allowed clients is set to the current file limit 290 | # minus 32 (as Redis reserves a few file descriptors for internal uses). 291 | # 292 | # Once the limit is reached Redis will close all the new connections sending 293 | # an error 'max number of clients reached'. 294 | # 295 | # maxclients 10000 296 | 297 | # Don't use more memory than the specified amount of bytes. 298 | # When the memory limit is reached Redis will try to remove keys 299 | # accordingly to the eviction policy selected (see maxmemmory-policy). 300 | # 301 | # If Redis can't remove keys according to the policy, or if the policy is 302 | # set to 'noeviction', Redis will start to reply with errors to commands 303 | # that would use more memory, like SET, LPUSH, and so on, and will continue 304 | # to reply to read-only commands like GET. 305 | # 306 | # This option is usually useful when using Redis as an LRU cache, or to set 307 | # an hard memory limit for an instance (using the 'noeviction' policy). 308 | # 309 | # WARNING: If you have slaves attached to an instance with maxmemory on, 310 | # the size of the output buffers needed to feed the slaves are subtracted 311 | # from the used memory count, so that network problems / resyncs will 312 | # not trigger a loop where keys are evicted, and in turn the output 313 | # buffer of slaves is full with DELs of keys evicted triggering the deletion 314 | # of more keys, and so forth until the database is completely emptied. 315 | # 316 | # In short... if you have slaves attached it is suggested that you set a lower 317 | # limit for maxmemory so that there is some free RAM on the system for slave 318 | # output buffers (but this is not needed if the policy is 'noeviction'). 319 | # 320 | # maxmemory 100mb - # set in instance file 321 | 322 | # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory 323 | # is reached. You can select among five behaviors: 324 | # 325 | # volatile-lru -> remove the key with an expire set using an LRU algorithm 326 | # allkeys-lru -> remove any key accordingly to the LRU algorithm 327 | # volatile-random -> remove a random key with an expire set 328 | # allkeys-random -> remove a random key, any key 329 | # volatile-ttl -> remove the key with the nearest expire time (minor TTL) 330 | # noeviction -> don't expire at all, just return an error on write operations 331 | # 332 | # Note: with any of the above policies, Redis will return an error on write 333 | # operations, when there are not suitable keys for eviction. 334 | # 335 | # At the date of writing this commands are: set setnx setex append 336 | # incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd 337 | # sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby 338 | # zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby 339 | # getset mset msetnx exec sort 340 | # 341 | # The default is: 342 | # 343 | maxmemory-policy volatile-lru 344 | 345 | # LRU and minimal TTL algorithms are not precise algorithms but approximated 346 | # algorithms (in order to save memory), so you can select as well the sample 347 | # size to check. For instance for default Redis will check three keys and 348 | # pick the one that was used less recently, you can change the sample size 349 | # using the following configuration directive. 350 | # 351 | # maxmemory-samples 3 352 | 353 | ############################## APPEND ONLY MODE ############################### 354 | 355 | # By default Redis asynchronously dumps the dataset on disk. This mode is 356 | # good enough in many applications, but an issue with the Redis process or 357 | # a power outage may result into a few minutes of writes lost (depending on 358 | # the configured save points). 359 | # 360 | # The Append Only File is an alternative persistence mode that provides 361 | # much better durability. For instance using the default data fsync policy 362 | # (see later in the config file) Redis can lose just one second of writes in a 363 | # dramatic event like a server power outage, or a single write if something 364 | # wrong with the Redis process itself happens, but the operating system is 365 | # still running correctly. 366 | # 367 | # AOF and RDB persistence can be enabled at the same time without problems. 368 | # If the AOF is enabled on startup Redis will load the AOF, that is the file 369 | # with the better durability guarantees. 370 | # 371 | # Please check http://redis.io/topics/persistence for more information. 372 | 373 | appendonly no 374 | 375 | # The name of the append only file (default: "appendonly.aof") 376 | # appendfilename appendonly.aof 377 | 378 | # The fsync() call tells the Operating System to actually write data on disk 379 | # instead to wait for more data in the output buffer. Some OS will really flush 380 | # data on disk, some other OS will just try to do it ASAP. 381 | # 382 | # Redis supports three different modes: 383 | # 384 | # no: don't fsync, just let the OS flush the data when it wants. Faster. 385 | # always: fsync after every write to the append only log . Slow, Safest. 386 | # everysec: fsync only one time every second. Compromise. 387 | # 388 | # The default is "everysec", as that's usually the right compromise between 389 | # speed and data safety. It's up to you to understand if you can relax this to 390 | # "no" that will let the operating system flush the output buffer when 391 | # it wants, for better performances (but if you can live with the idea of 392 | # some data loss consider the default persistence mode that's snapshotting), 393 | # or on the contrary, use "always" that's very slow but a bit safer than 394 | # everysec. 395 | # 396 | # More details please check the following article: 397 | # http://antirez.com/post/redis-persistence-demystified.html 398 | # 399 | # If unsure, use "everysec". 400 | 401 | # appendfsync always 402 | appendfsync everysec 403 | # appendfsync no 404 | 405 | # When the AOF fsync policy is set to always or everysec, and a background 406 | # saving process (a background save or AOF log background rewriting) is 407 | # performing a lot of I/O against the disk, in some Linux configurations 408 | # Redis may block too long on the fsync() call. Note that there is no fix for 409 | # this currently, as even performing fsync in a different thread will block 410 | # our synchronous write(2) call. 411 | # 412 | # In order to mitigate this problem it's possible to use the following option 413 | # that will prevent fsync() from being called in the main process while a 414 | # BGSAVE or BGREWRITEAOF is in progress. 415 | # 416 | # This means that while another child is saving, the durability of Redis is 417 | # the same as "appendfsync none". In practical terms, this means that it is 418 | # possible to lose up to 30 seconds of log in the worst scenario (with the 419 | # default Linux settings). 420 | # 421 | # If you have latency problems turn this to "yes". Otherwise leave it as 422 | # "no" that is the safest pick from the point of view of durability. 423 | no-appendfsync-on-rewrite no 424 | 425 | # Automatic rewrite of the append only file. 426 | # Redis is able to automatically rewrite the log file implicitly calling 427 | # BGREWRITEAOF when the AOF log size grows by the specified percentage. 428 | # 429 | # This is how it works: Redis remembers the size of the AOF file after the 430 | # latest rewrite (if no rewrite has happened since the restart, the size of 431 | # the AOF at startup is used). 432 | # 433 | # This base size is compared to the current size. If the current size is 434 | # bigger than the specified percentage, the rewrite is triggered. Also 435 | # you need to specify a minimal size for the AOF file to be rewritten, this 436 | # is useful to avoid rewriting the AOF file even if the percentage increase 437 | # is reached but it is still pretty small. 438 | # 439 | # Specify a percentage of zero in order to disable the automatic AOF 440 | # rewrite feature. 441 | 442 | auto-aof-rewrite-percentage 100 443 | auto-aof-rewrite-min-size 64mb 444 | 445 | ################################ LUA SCRIPTING ############################### 446 | 447 | # Max execution time of a Lua script in milliseconds. 448 | # 449 | # If the maximum execution time is reached Redis will log that a script is 450 | # still in execution after the maximum allowed time and will start to 451 | # reply to queries with an error. 452 | # 453 | # When a long running script exceed the maximum execution time only the 454 | # SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be 455 | # used to stop a script that did not yet called write commands. The second 456 | # is the only way to shut down the server in the case a write commands was 457 | # already issue by the script but the user don't want to wait for the natural 458 | # termination of the script. 459 | # 460 | # Set it to 0 or a negative value for unlimited execution without warnings. 461 | lua-time-limit 5000 462 | 463 | ################################## SLOW LOG ################################### 464 | 465 | # The Redis Slow Log is a system to log queries that exceeded a specified 466 | # execution time. The execution time does not include the I/O operations 467 | # like talking with the client, sending the reply and so forth, 468 | # but just the time needed to actually execute the command (this is the only 469 | # stage of command execution where the thread is blocked and can not serve 470 | # other requests in the meantime). 471 | # 472 | # You can configure the slow log with two parameters: one tells Redis 473 | # what is the execution time, in microseconds, to exceed in order for the 474 | # command to get logged, and the other parameter is the length of the 475 | # slow log. When a new command is logged the oldest one is removed from the 476 | # queue of logged commands. 477 | 478 | # The following time is expressed in microseconds, so 1000000 is equivalent 479 | # to one second. Note that a negative number disables the slow log, while 480 | # a value of zero forces the logging of every command. 481 | slowlog-log-slower-than 10000 482 | 483 | # There is no limit to this length. Just be aware that it will consume memory. 484 | # You can reclaim memory used by the slow log with SLOWLOG RESET. 485 | slowlog-max-len 128 486 | 487 | ############################### ADVANCED CONFIG ############################### 488 | 489 | # Hashes are encoded using a memory efficient data structure when they have a 490 | # small number of entries, and the biggest entry does not exceed a given 491 | # threshold. These thresholds can be configured using the following directives. 492 | hash-max-ziplist-entries 512 493 | hash-max-ziplist-value 64 494 | 495 | # Similarly to hashes, small lists are also encoded in a special way in order 496 | # to save a lot of space. The special representation is only used when 497 | # you are under the following limits: 498 | list-max-ziplist-entries 512 499 | list-max-ziplist-value 64 500 | 501 | # Sets have a special encoding in just one case: when a set is composed 502 | # of just strings that happens to be integers in radix 10 in the range 503 | # of 64 bit signed integers. 504 | # The following configuration setting sets the limit in the size of the 505 | # set in order to use this special memory saving encoding. 506 | set-max-intset-entries 512 507 | 508 | # Similarly to hashes and lists, sorted sets are also specially encoded in 509 | # order to save a lot of space. This encoding is only used when the length and 510 | # elements of a sorted set are below the following limits: 511 | zset-max-ziplist-entries 128 512 | zset-max-ziplist-value 64 513 | 514 | # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in 515 | # order to help rehashing the main Redis hash table (the one mapping top-level 516 | # keys to values). The hash table implementation Redis uses (see dict.c) 517 | # performs a lazy rehashing: the more operation you run into an hash table 518 | # that is rehashing, the more rehashing "steps" are performed, so if the 519 | # server is idle the rehashing is never complete and some more memory is used 520 | # by the hash table. 521 | # 522 | # The default is to use this millisecond 10 times every second in order to 523 | # active rehashing the main dictionaries, freeing memory when possible. 524 | # 525 | # If unsure: 526 | # use "activerehashing no" if you have hard latency requirements and it is 527 | # not a good thing in your environment that Redis can reply form time to time 528 | # to queries with 2 milliseconds delay. 529 | # 530 | # use "activerehashing yes" if you don't have such hard requirements but 531 | # want to free memory asap when possible. 532 | activerehashing yes 533 | 534 | # The client output buffer limits can be used to force disconnection of clients 535 | # that are not reading data from the server fast enough for some reason (a 536 | # common reason is that a Pub/Sub client can't consume messages as fast as the 537 | # publisher can produce them). 538 | # 539 | # The limit can be set differently for the three different classes of clients: 540 | # 541 | # normal -> normal clients 542 | # slave -> slave clients and MONITOR clients 543 | # pubsub -> clients subcribed to at least one pubsub channel or pattern 544 | # 545 | # The syntax of every client-output-buffer-limit directive is the following: 546 | # 547 | # client-output-buffer-limit 548 | # 549 | # A client is immediately disconnected once the hard limit is reached, or if 550 | # the soft limit is reached and remains reached for the specified number of 551 | # seconds (continuously). 552 | # So for instance if the hard limit is 32 megabytes and the soft limit is 553 | # 16 megabytes / 10 seconds, the client will get disconnected immediately 554 | # if the size of the output buffers reach 32 megabytes, but will also get 555 | # disconnected if the client reaches 16 megabytes and continuously overcomes 556 | # the limit for 10 seconds. 557 | # 558 | # By default normal clients are not limited because they don't receive data 559 | # without asking (in a push way), but just after a request, so only 560 | # asynchronous clients may create a scenario where data is requested faster 561 | # than it can read. 562 | # 563 | # Instead there is a default limit for pubsub and slave clients, since 564 | # subscribers and slaves receive data in a push fashion. 565 | # 566 | # Both the hard or the soft limit can be disabled by setting them to zero. 567 | client-output-buffer-limit normal 0 0 0 568 | client-output-buffer-limit slave 256mb 64mb 60 569 | client-output-buffer-limit pubsub 32mb 8mb 60 570 | 571 | # Redis calls an internal function to perform many background tasks, like 572 | # closing connections of clients in timeot, purging expired keys that are 573 | # never requested, and so forth. 574 | # 575 | # Not all tasks are perforemd with the same frequency, but Redis checks for 576 | # tasks to perform accordingly to the specified "hz" value. 577 | # 578 | # By default "hz" is set to 10. Raising the value will use more CPU when 579 | # Redis is idle, but at the same time will make Redis more responsive when 580 | # there are many keys expiring at the same time, and timeouts may be 581 | # handled with more precision. 582 | # 583 | # The range is between 1 and 500, however a value over 100 is usually not 584 | # a good idea. Most users should use the default of 10 and raise this up to 585 | # 100 only in environments where very low latency is required. 586 | hz 10 587 | 588 | # When a child rewrites the AOF file, if the following option is enabled 589 | # the file will be fsync-ed every 32 MB of data generated. This is useful 590 | # in order to commit the file to the disk more incrementally and avoid 591 | # big latency spikes. 592 | aof-rewrite-incremental-fsync yes 593 | 594 | -------------------------------------------------------------------------------- /conf/redis-obj.conf: -------------------------------------------------------------------------------- 1 | # This config is for a specific instance of a redis server when running multiple servers 2 | # This file is what is used when running the redis server 3 | 4 | # include the main redis config file with common settings 5 | include /etc/redis/redis-magento.conf 6 | 7 | port 6380 8 | pidfile /var/run/redis-obj.pid 9 | logfile /var/log/redis/obj.log 10 | dir /var/lib/redis/obj 11 | 12 | maxmemory 100mb -------------------------------------------------------------------------------- /conf/redis-ses.conf: -------------------------------------------------------------------------------- 1 | # This config is for a specific instance of a redis server when running multiple servers 2 | # This file is what is used when running the redis server 3 | 4 | # include the main redis config file with common settings 5 | include /etc/redis/redis-magento.conf 6 | 7 | port 6379 8 | pidfile /var/run/redis-ses.pid 9 | logfile /var/log/redis/ses.log 10 | dir /var/lib/redis/ses 11 | 12 | maxmemory 100mb 13 | -------------------------------------------------------------------------------- /init/redis-fpc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # redis - this script starts and stops the redis-server daemon 4 | # 5 | # chkconfig: - 85 15 6 | # description: Redis is a persistent key-value database 7 | # processname: redis-server 8 | # config: /etc/redis/redis-obj.conf 9 | # pidfile: /var/run/redis-obj 10 | 11 | 12 | # Source function library. 13 | . /etc/rc.d/init.d/functions 14 | 15 | # Source networking configuration. 16 | . /etc/sysconfig/network 17 | 18 | # Check that networking is up. 19 | [ "$NETWORKING" = "no" ] && exit 0 20 | 21 | # Give each instance a unique name - we use obj, ses and fpc for Magento 22 | INSTANCE="fpc" 23 | REDIS_CONF=/etc/redis/redis-$INSTANCE.conf 24 | 25 | REDIS_DAEMON="/usr/local/bin/redis-server" 26 | REDIS_DESC=redis-$INSTANCE 27 | LOCKFILE=/var/lock/subsys/$REDIS_DESC 28 | PIDFILE=/var/run/$REDIS_DESC.pid 29 | 30 | 31 | [ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis 32 | 33 | start() { 34 | [ -x $REDIS_DAEMON ] || exit 5 35 | [ -f $REDIS_CONF ] || exit 6 36 | echo -n $"Starting $REDIS_DESC: " 37 | daemon --pidfile $PIDFILE $REDIS_DAEMON $REDIS_CONF 38 | retval=$? 39 | echo 40 | [ $retval -eq 0 ] && touch $LOCKFILE 41 | return $retval 42 | } 43 | 44 | stop() { 45 | echo -n $"Stopping $REDIS_DESC: " 46 | killproc -p $PIDFILE $REDIS_DESC -QUIT 47 | retval=$? 48 | echo 49 | [ $retval -eq 0 ] && rm -f $LOCKFILE 50 | return $retval 51 | } 52 | 53 | restart() { 54 | stop 55 | start 56 | } 57 | 58 | reload() { 59 | echo -n $"Reloading $REDIS_DESC: " 60 | killproc -p $PIDFILE $REDIS_DAEMON -HUP 61 | RETVAL=$? 62 | echo 63 | } 64 | 65 | force_reload() { 66 | restart 67 | } 68 | 69 | rh_status() { 70 | status $REDIS_DESC 71 | } 72 | 73 | rh_status_q() { 74 | rh_status >/dev/null 2>&1 75 | } 76 | 77 | case "$1" in 78 | start) 79 | rh_status_q && exit 0 80 | $1 81 | ;; 82 | stop) 83 | rh_status_q || exit 0 84 | $1 85 | ;; 86 | restart|configtest) 87 | $1 88 | ;; 89 | reload) 90 | rh_status_q || exit 7 91 | $1 92 | ;; 93 | force-reload) 94 | force_reload 95 | ;; 96 | status) 97 | rh_status 98 | ;; 99 | condrestart|try-restart) 100 | rh_status_q || exit 0 101 | ;; 102 | *) 103 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" 104 | exit 2 105 | esac 106 | -------------------------------------------------------------------------------- /init/redis-obj: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # redis - this script starts and stops the redis-server daemon 4 | # 5 | # chkconfig: - 85 15 6 | # description: Redis is a persistent key-value database 7 | # processname: redis-server 8 | # config: /etc/redis/redis-obj.conf 9 | # pidfile: /var/run/redis-obj 10 | 11 | 12 | # Source function library. 13 | . /etc/rc.d/init.d/functions 14 | 15 | # Source networking configuration. 16 | . /etc/sysconfig/network 17 | 18 | # Check that networking is up. 19 | [ "$NETWORKING" = "no" ] && exit 0 20 | 21 | # Give each instance a unique name - we use obj, ses and fpc for Magento 22 | INSTANCE="obj" 23 | REDIS_CONF=/etc/redis/redis-$INSTANCE.conf 24 | 25 | REDIS_DAEMON="/usr/local/bin/redis-server" 26 | REDIS_DESC=redis-$INSTANCE 27 | LOCKFILE=/var/lock/subsys/$REDIS_DESC 28 | PIDFILE=/var/run/$REDIS_DESC.pid 29 | 30 | 31 | [ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis 32 | 33 | start() { 34 | [ -x $REDIS_DAEMON ] || exit 5 35 | [ -f $REDIS_CONF ] || exit 6 36 | echo -n $"Starting $REDIS_DESC: " 37 | daemon --pidfile $PIDFILE $REDIS_DAEMON $REDIS_CONF 38 | retval=$? 39 | echo 40 | [ $retval -eq 0 ] && touch $LOCKFILE 41 | return $retval 42 | } 43 | 44 | stop() { 45 | echo -n $"Stopping $REDIS_DESC: " 46 | killproc -p $PIDFILE $REDIS_DESC -QUIT 47 | retval=$? 48 | echo 49 | [ $retval -eq 0 ] && rm -f $LOCKFILE 50 | return $retval 51 | } 52 | 53 | restart() { 54 | stop 55 | start 56 | } 57 | 58 | reload() { 59 | echo -n $"Reloading $REDIS_DESC: " 60 | killproc -p $PIDFILE $REDIS_DAEMON -HUP 61 | RETVAL=$? 62 | echo 63 | } 64 | 65 | force_reload() { 66 | restart 67 | } 68 | 69 | rh_status() { 70 | status $REDIS_DESC 71 | } 72 | 73 | rh_status_q() { 74 | rh_status >/dev/null 2>&1 75 | } 76 | 77 | case "$1" in 78 | start) 79 | rh_status_q && exit 0 80 | $1 81 | ;; 82 | stop) 83 | rh_status_q || exit 0 84 | $1 85 | ;; 86 | restart|configtest) 87 | $1 88 | ;; 89 | reload) 90 | rh_status_q || exit 7 91 | $1 92 | ;; 93 | force-reload) 94 | force_reload 95 | ;; 96 | status) 97 | rh_status 98 | ;; 99 | condrestart|try-restart) 100 | rh_status_q || exit 0 101 | ;; 102 | *) 103 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" 104 | exit 2 105 | esac 106 | -------------------------------------------------------------------------------- /init/redis-ses: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # redis - this script starts and stops the redis-server daemon 4 | # 5 | # chkconfig: - 85 15 6 | # description: Redis is a persistent key-value database 7 | # processname: redis-server 8 | # config: /etc/redis/redis-obj.conf 9 | # pidfile: /var/run/redis-obj 10 | 11 | 12 | # Source function library. 13 | . /etc/rc.d/init.d/functions 14 | 15 | # Source networking configuration. 16 | . /etc/sysconfig/network 17 | 18 | # Check that networking is up. 19 | [ "$NETWORKING" = "no" ] && exit 0 20 | 21 | # Give each instance a unique name - we use obj, ses and fpc for Magento 22 | INSTANCE="ses" 23 | REDIS_CONF=/etc/redis/redis-$INSTANCE.conf 24 | 25 | REDIS_DAEMON="/usr/local/bin/redis-server" 26 | REDIS_DESC=redis-$INSTANCE 27 | LOCKFILE=/var/lock/subsys/$REDIS_DESC 28 | PIDFILE=/var/run/$REDIS_DESC.pid 29 | 30 | 31 | [ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis 32 | 33 | start() { 34 | [ -x $REDIS_DAEMON ] || exit 5 35 | [ -f $REDIS_CONF ] || exit 6 36 | echo -n $"Starting $REDIS_DESC: " 37 | daemon --pidfile $PIDFILE $REDIS_DAEMON $REDIS_CONF 38 | retval=$? 39 | echo 40 | [ $retval -eq 0 ] && touch $LOCKFILE 41 | return $retval 42 | } 43 | 44 | stop() { 45 | echo -n $"Stopping $REDIS_DESC: " 46 | killproc -p $PIDFILE $REDIS_DESC -QUIT 47 | retval=$? 48 | echo 49 | [ $retval -eq 0 ] && rm -f $LOCKFILE 50 | return $retval 51 | } 52 | 53 | restart() { 54 | stop 55 | start 56 | } 57 | 58 | reload() { 59 | echo -n $"Reloading $REDIS_DESC: " 60 | killproc -p $PIDFILE $REDIS_DAEMON -HUP 61 | RETVAL=$? 62 | echo 63 | } 64 | 65 | force_reload() { 66 | restart 67 | } 68 | 69 | rh_status() { 70 | status $REDIS_DESC 71 | } 72 | 73 | rh_status_q() { 74 | rh_status >/dev/null 2>&1 75 | } 76 | 77 | case "$1" in 78 | start) 79 | rh_status_q && exit 0 80 | $1 81 | ;; 82 | stop) 83 | rh_status_q || exit 0 84 | $1 85 | ;; 86 | restart|configtest) 87 | $1 88 | ;; 89 | reload) 90 | rh_status_q || exit 7 91 | $1 92 | ;; 93 | force-reload) 94 | force_reload 95 | ;; 96 | status) 97 | rh_status 98 | ;; 99 | condrestart|try-restart) 100 | rh_status_q || exit 0 101 | ;; 102 | *) 103 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" 104 | exit 2 105 | esac 106 | --------------------------------------------------------------------------------