# By default redis does not run as a daemon. Use 'yes' if you need it.
# Note that redis will write a PID file in/var/run/redis. PID when daemonized.
# Redis does not run as a daemon by default. You can modify this configuration item and use yes to enable the daemon.
Daemonize No
# When running daemonized, redis writes a PID file in/var/run/redis. PID
# Default. You can specify a custom PID file location here.
# When redis runs as a daemon, redis puts the PID file in/var/run/redis. PID by default. You can configure it to another address. When running multiple redis services, you must specify different PID files and ports.
Pidfile/var/run/redis. PID
# Accept connections on the specified port, default is 6379.
# If Port 0 is specified redis will not listen on a TCP socket.
# There is nothing to say about the port
Port 6379
# If you want you can bind a single interface, if the BIND option is not
# Specified all the interfaces will listen for incoming connections.
# Specify the IP address that redis can receive requests. If this parameter is not set, all requests are processed. We recommend that you set this parameter in the production environment.
# Bind 127.0.0.1
# Close the connection after a client is idle for n seconds (0 to disable)
# Timeout time for client connection, in seconds. connection will be closed after timeout
Timeout 0
# Specify the log file name. Also 'stdout' can be used to force
# Redis to log on the standard output. Note that if you use standard
# Output for logging but daemonize, logs will be sent to/dev/null
# Configure the log file address, which is printed in the command line terminal window by default
Logfile stdout
# Set the number of databases. The default database is db 0, you can select
# A different one on a per-connection basis using select <dbid> where
# Dbid is a number between 0 and 'databases'-1
# Set the number of databases. You can use the select <dbid> command to switch databases. The default database is 0.
Databases 16
#
# Save the DB on disk:
#
# Save <seconds> <changes>
#
# Will Save the DB if both the given number of seconds and the given
# Number of write operations against the DB occurred.
#
# In the example below the behaviour will be to save:
# After 900 Sec (15 min) if at least 1 key changed
# After 300 Sec (5 min) if at least 10 keys changed
# After 60 sec if at least 10000 keys changed
#
# Note: you can disable saving at all commenting all the "save" lines.
# Set the frequency of redis database mirroring.
# When one keys changes within 900 seconds
# When 10 keys change within 30 seconds
# When 10000 keys change within 60 seconds
Save 900 1
Save 300 10
Save 60 10000
# Compress string objects using lzf when dump. RDB databases?
# For default that's set to 'yes' as it's almost always a win.
# If you want to save some CPU in the saving child set it to 'no'
# The dataset will likely be bigger if you have compressible values or keys.
# Whether to perform compression during image backup
Rdbcompression Yes
# The filename where to dump the DB
# Image backup file name
Dbfilename dump. RDB
# The working directory.
#
# The dB will be written inside this directory, with the filename specified
# Above using the 'dbfilename' configuration ctive ve.
#
# Also the append only file will be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
# Path of the database image backup file. The path and file name must be configured separately because redis first writes the status of the current database to a temporary file during Backup. When the backup is complete, replace the temporary file with the file specified above,
# The temporary files and the backup files configured above are stored in the specified path.
Dir ./
# Master-slave replication. Use slaveof to make a redis instance a copy
# Another redis server. Note that the configuration is local to the slave
# So for example it is possible to configure the slave to save the DB with
# Different interval, or to listen to another port, and so on.
# Set the database as a slave database of another database
# Slaveof <masterip> <masterport>
# If the master is password protected (using the "requirepass" configuration
# Directive below) it is possible to tell the slave to authenticate before
# Starting the replication synchronization process, otherwise the master will
# Refuse the slave request.
# Password verification required for connection to the primary database
# Masterauth <master-Password>
# Require clients to issue auth <password> before processing any other
# Commands. This might be useful in environments in which you do not trust
# Others with access to the host running redis-server.
#
# This shoshould stay commented out for backward compatibility and because most
# People do not need auth (e.g. They run their own servers ).
#
# Warning: Since redis is pretty fast an outside user can try up
#150 K passwords per second against a good box. This means that you should
# Use a very strong password otherwise it will be very easy to break.
# Set the password required to specify any other before connecting the client.
Warning redis is quite fast. An external user can perform K password attempts in one second. You need to specify a very powerful password to prevent brute force cracking.
# Requirepass foobared
# Set the Max number of connected clients at the same time. By default there
# Is no limit, and it's up to the number of file descriptors The redis Process
# Is able to open. The special value '0' means no limits.
# Once the limit is reached redis will close all the new connections sending
# An error 'max number of clients reached '.
# Limit the number of customers connected at the same time. When the number of connections exceeds this value, redis will no longer receive other connection requests, and the client will receive an error message when trying to connect.
# Maxclients 128
# Don't use more memory than the specified amount of bytes.
# When the memory limit is reached redis will try to remove keys
# Accordingly to the eviction policy selected (see maxmemmory-policy ).
#
# If redis can't remove keys according to the policy, or if the policy is
# Set to 'noeviction ', redis will start to reply with errors to commands
# That wocould use more memory, like set, lpush, and so on, and will continue
# To reply to read-only commands like get.
#
# This option is usually useful when using redis as an LRU cache, or to set
# An hard memory limit for an instance (using the 'noeviction 'policy ).
#
# Warning: If you have slaves attached to an instance with maxmemory on,
# The size of the output buffers needed to feed the slaves are subtracted
# From the used memory count, so that network problems/resyncs will
# Not trigger a loop where keys are evicted, and in turn the output
# Buffer of slaves is full with dels of keys evicted triggering the deletion
# Of more keys, and so forth until the database is completely emptied.
#
# In short... if you have slaves attached it is suggested that you set a lower
# Limit for maxmemory so that there is some free RAM on the system for slave
# Output buffers (but this is not needed if the policy is 'noeviction ').
# Set the maximum memory available for redis. When the memory is full, if you still receive the SET command, redis will first try to remove the key with expire information, regardless of whether the key expires.
# When deleting a key, it will be deleted according to the expiration time. The key to be expired will be deleted first. If all keys with expire information are deleted, an error is returned.
# In this way, redis will not receive write requests, but only get requests. Maxmemory settings are suitable for using redis as a cache similar to memcached.
# Maxmemory <bytes>
# By default redis asynchronously dumps the dataset on disk. If you can live
# With the idea that the latest records will be lost if something like a crash
# Happens this is the preferred way to run redis. If instead you care a lot
# About your data and don't want to that a single record can get lost you shoshould
# Enable the append only mode: When this mode is enabled redis will append
# Every write operation completed ed in the file appendonly. Aof. This file will
# Be read on startup in order to rebuild the full dataset in memory.
#
# Note that you can have both the async dumps and the append only file if you
# Like (You have to comment the "save" statements above to disable the dumps ).
# Still if append only mode is enabled redis will load the data from
# Log file at startup ignoring the dump. RDB file.
#
# Important: Check the bgrewriteaof to check how to rewrite the append
# Log file in background when it gets too big.
# By default, redis asynchronously backs up database images to disks in the background, but this backup is time-consuming and cannot be performed frequently, if a fault occurs, such as power limit or power limit, it may cause a wide range of data loss.
# Redis provides another more efficient database backup and disaster recovery method.
# After the append only mode is enabled, redis will append each write operation request received to appendonly. in the aof file, when redis is restarted, the previous state will be restored from the file.
# However, this will cause the appendonly. aof file to be too large, so redis also supports the bgrewriteaof command to reorganize appendonly. aof
Appendonly No
# The fsync () call tells the operating system to actually write data on disk
# Instead to wait for more data in the output buffer. Some OS will really flush
# Data on disk, some other OS will just try to do it ASAP.
#
# Redis supports three different modes:
#
# No: Don't fsync, just let the OS flush the data when it wants. Faster.
# Always: fsync after every write to the append only log. Slow, safest.
# Everysec: fsync only if one second passed since the last fsync. Compromise.
#
# The default is "everysec" that's usually the right compromise
# Speed and data safety. It's up to you to understand if you can relax this
# "No" that will let the operating system flush the output buffer when
# It wants, for better performances (but if you can live with the idea
# Some data loss consider the default persistence mode that's snapshoence ),
# Or on the contrary, use "always" that's very slow but a bit safer
# Everysec.
#
# If unsure, use "everysec ".
# Set the synchronization frequency of the appendonly. aof file. Always indicates that the write operation is synchronized every time, while everysec indicates that the write operation is accumulated and synchronized every second.
# Appendfsync always
Appendfsync everysec
# Appendfsync No
# Virtual memory allows redis to work with datasets bigger than the actual
# Amount of Ram needed to hold the whole dataset in memory.
# In order to do so very used keys are taken in memory while the other keys
# Are swapped into a swap file, similarly to what operating systems do
# With memory pages.
#
# To enable VM just set 'vm-enabled' to yes, and set the following three
# VM parameters accordingly to your needs.
# Whether to enable virtual memory support. Because redis is a memory database and cannot receive new write requests when the memory is full, it provides support for Virtual Memory in redis2.0.
# However, in redis, all keys are stored in the memory. When the memory is insufficient, only the value is placed in the SWAp zone.
# This ensures that although the virtual memory is used, the performance is basically unaffected. At the same time, you need to note that you should set VM-max-memory to enough to put down all your keys.
VM-enabled No
# VM-enabled Yes
# This is the path of the redis swap file. as you can guess, swap files
# Can't be shared by different redis instances, so make sure to use a swap
# File for every redis process you are running. redis will complain if
# Swap file is already in use.
#
# The best kind of storage for the redis swap file (that's accessed at random)
# Is a solid state disk (SSD ).
#
# *** Warning *** if you are using a shared hosting the default of putting
# The swap file under/tmp is not secure. Create a dir with access granted
# Only to redis user and configure redis to create the swap file there.
# Set the swap file path for the virtual memory
VM-Swap-file/tmp/redis. Swap
# VM-max-memory configures the VM to use at Max the specified amount
# Ram. Everything that deos not fit will be swapped on disk * If * possible, that
# Is, if there is still enough contiguous space in the swap file.
#
# With VM-max-memory 0 the system will swap everything it can. Not a good
# Default, just specify the max amount of ram you can in bytes, But it's
# Better to leave some margin. For instance specify an amount of RAM
# That's more or less between 60 and 80% of your free RAM.
# Set the maximum physical memory size that redis will use after enabling virtual memory. The default value is 0. redis will put all of its swap files into swap files to use as little physical memory as possible.
# In the production environment, you need to set this value according to the actual situation. It is best not to use the default 0
VM-max-memory 0
# Redis swap files is split into pages. An object can be saved using multiple
# Contiguous pages, but pages can't be shared between different objects.
# So if your page is too big, small objects swapped out on disk will waste
# A Lot Of space. If you page is too small, there is less space in the SWAp
# File (assuming you configured the same number of total swap file pages ).
#
# If you use a lot of small objects, use a page size of 64 or 32 bytes.
# If you use a lot of big objects, use a bigger page size.
# If unsure, use the default
# Set the page size of the virtual memory. If your value is relatively large, for example, you need to place all the articles such as blogs and news in the value, set it to a larger value, if you want to store small content, set it to a smaller value.
VM-page-size 32
# Number of total memory pages in the swap file.
# Given that the page table (a bitmap of free/used pages) is taken in memory,
# Every 8 pages on disk will consume 1 byte of RAM.
#
# The total swap size is VM-page-size * VM-pages
#
# With the default of 32-bytes memory pages and 134217728 pages redis will
# Use A 4 GB swap file, that will use 16 MB of RAM for the page table.
#
# It's better to use the smallest acceptable value for your application,
# But the default is large in order to work in most conditions.
# Set the total number of pages for the swap file. Note that the page table information is stored in the physical memory, and each 8 pages occupies one byte in Ram.
# Total virtual memory size = VM-page-size * VM-pages
VM-pages 134217728
# Max number of vm I/O threads running at the same time.
# This threads are used to read/write data from/to swap file, since they
# Also encode and decode objects from disk to memory or the reverse, a bigger
# Number of threads can help with big objects even if they can't help
# I/O itself as the physical device may not be able to couple with role
# Reads/writes operations at the same time.
#
# The special value of 0 turn off threaded I/O and enables the blocking
# Virtual memory implementation.
# Set the number of threads simultaneously used by VM Io.
VM-max-threads 4
# Hashes are encoded in a special way (much more memory efficient) when they
# Have at Max a given numer of elements, and the biggest element does not
# Exceed a given threshold. you can configure this limits with the following
# Configuration ctictives.
# The hash data structure is introduced in redis 2.0.
# When the hash contains more than the specified number of elements and the maximum number of elements does not exceed the critical value, hash will be stored with zipmap (also known as small hash, which greatly reduces memory usage, the two thresholds can be set here.
Hhash-max-zipmap-entries 512
Hash-max-zipmap-value 64
# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
# Order to help rehashing the main redis hash table (the one mapping top-level
# Keys to values). The Hash Table Implementation redis uses (see dict. c)
# Performs a lazy rehashing: the more operation you run into an hash table
# That is rhashing, the more rehashing "Steps" are saved med, so if
# Server is idle the rehashing is never complete and some more memory is used
# By the hash table.
#
# The default is to use this millisecond 10 times every second in order
# Active rehashing the main dictionaries, freeing memory when possible.
#
# If unsure:
# Use "activerehashing no" if you have hard latency requirements and it is
# Not a good thing in your environment that redis can reply form time to time
# To queries with 2 milliseconds delay.
#
# Use "activerehashing yes" if you don't have such hard requirements
# Want To free memory ASAP when possible.
# After it is enabled, redis uses a CPU time of 1 ms every 100 milliseconds to re-hash the redis hash table, which can reduce the memory usage.
# When your application scenario requires strict real-time performance and redis cannot accept a latency of 2 milliseconds from time to time for requests, set this parameter to No.
# If you do not have such strict real-time requirements, you can set it to yes to release the memory as quickly as possible.
Activerehashing Yes