Redis.conf configuration file details

  

Redis configuration file example # Note unit: When you need to configure the memory size, you may need to specify common formats like 1k, 5GB, 4M, etc. ## 1k => 1000 bytes# 1kb => 1024 bytes# 1m => 1000000 bytes# 1mb => 1024*1024 bytes# 1g => 1000000000 bytes# 1gb => 1024*1024*1024 bytes## Units are case insensitive 1GB 1Gb 1gB Yes identical. ######### INCLUDES ############## You can include one or more other configuration files here. This feature is useful if you have a standard configuration template for all Redis servers# but also require some custom settings for each server. The included configuration file can also contain other configuration files, # so you need to use this feature with caution. The ## attention"inclue” option cannot be overridden by the admin or Redis sentinel's "CONFIG REWRITE" command. # Because Redis always uses the last parsed configuration line to configure the value of the directive, you'd better configure includes at the beginning of this file to avoid it rewriting the configuration at runtime. # If instead you want to overwrite the original configuration with the includes configuration, you should use include## include /path/to/local.conf# include /path/to/other.conf

######### GENERAL ##########

# The default Rdis does not run as a daemon. Configure it as 'yes' if needed. Note that when configured as a daemon, Redis will write the process number to the file /var/run/redis.piddaemonize no# When running as a daemon, the default Redis will write the process ID to /Var/run/redis.pid. You can modify the path here. Pidfile /var/run/redis.pid# Accepts the specific port of the connection. The default is 6379# If the port is set to 0, Redis will not listen to TCP sockets. Port 6379# TCP listen() backlog.## In high concurrency environments you need a high backlog value to avoid slow client connection issues. Note that the Linux kernel silently reduces this value by # to the value of /proc/sys/net/core/somaxconn, so you need to confirm that you increase the values ​​of somaxconn and tcp_max_syn_backlog# to achieve the desired effect. Tcp-backlog 511# The default Redis listens for connections to all available network interfaces on the server. You can use the "bind" configuration directive with one or more ip addresses to implement #List one or more network interfaces## Example:## bind 192.168.1.100 10.0.0.1# bind 127.0.0.1# Specifies to listen to Unix sets The path to the socket. There is no default value, so Redis will not listen for Unix sockets without specifying ## unixsocket /tmp/redis.sock# unixsocketperm 755# Close the connection after a client is idle for a few seconds. (0 means disable, never turn off) timeout 0# TCP keepalive.## If non-zero, set the SO_KEEPALIVE option to send an ACK to the client of the idle connection, which is useful for two reasons: ## 1) Ability to detect unresponsive peers # 2) Let the network device in the middle of the connection know that the connection is still alive ## On Linux, this specified value (in seconds) is the interval at which the ACK is sent. # Note: It takes twice as long to close this connection. # On other cores this interval is determined by the kernel configuration ## A reasonable value for this option is 60 seconds tcp-keepalive 0# Specify server debug level # Possible values: # debug (large amount of information, useful for development/testing) # verbose (Many streamlined useful information, but not as much as the debug level) # notice (The right amount of information, basically what you need in your production environment) # warning (only very important /serious information will be recorded) loglevel notice# The name of the log file. You can also use "stdout" to force Redis to write log information to standard output. # Note: If Redis runs as a daemon and the log is displayed to standard output, the log will be sent to /dev/nulllogfile ""# To use the system logger, just set "syslog-enabled" to " ;yes" is fine. # Then set some other syslog parameters as needed. # syslog-enabled no# Indicates the syslog identity # syslog-ident redis# Indicates the syslog device. Must be user or one of LOCAL0 ~ LOCAL7. # syslog-facility local0# Set the number of databases. The default database is DB 0,# You can use a different database for each connection by selecting (0 <= dbid <= 'databases' - 1 ). Databases 16########################################################################################################### ############# Put the data on the disk: ## save # # will write the database to disk after the specified number of seconds and data changes. ## The following example will perform the operation of writing data to disk: #900 seconds (15 minutes), and at least 1 change #300 seconds (5 minutes), and at least 10 changes #60 seconds, and At least 10,000 changes ## Note: If you want to not write the disk, comment out all the "save" settings. ## By adding a save command with an empty string parameter, you can also remove all previous save commands. Like the following example: # save "" save 900 1save 300 10save 60 10000# By default, if you open an RDB snapshot (at least A save command) and the latest background save fails, Redis will stop accepting writes # This will let the user know that the data is not properly persisted to the hard drive, otherwise it may be unnoticed and cause some disaster. ## If the background save process can start working again, Redis will automatically allow write operations. ## However, if you have deployed the appropriate Redis server and persistent monitoring, you may want to turn off this feature so that even the # hard disk, permissions Waiting for the problem, Redis can work as usual, stop-writes-on-bgsave-error yes# Is LZF compressed string object used when exporting to .rdb database? # The default setting is "yes", because it is pretty good in almost any situation. # If you want to save CPU, you can set this to "no", but if you have a compressible key and value, #数据数据文件 will be bigger. Rdbcompression yes# Because the version 5 RDB has a checksum of the CRC64 algorithm placed at the end of the file. This will make the file format more reliable but there is a performance penalty (about 10%) when #production and loading RDB files, so you can turn it off for the best performance. ## Generated Closed Checked RDB file has a checksum of 0, it will tell the load code to skip checking rdbchecksum yes# The name of the persistent database file dbfilename dump.rdb# Working directory ## The database will be written to this directory Next, the file name is the value of "dbfilename" above. # # Adding files is also here. # # Note that the directory you specify here must be a directory, not a file name. Dir ./######################################################################################################## ############### Master-slave synchronization. Backup of the Redis instance is implemented by the slaveof directive. # Note that here is the local copy of data from the far end. In other words, the local can have different database files, bind different IPs, and listen to # different ports. ## slaveof # If the master has password protection (configured with the "requirepass" option), then the slave must be authenticated before starting synchronization, otherwise its synchronization request will be rejected. ## masterauth # When a slave loses its connection to the master, or synchronization is in progress, there are two possibilities for slave behavior: ## 1) If slave-serve-stale-data is set to "yes" (default), The slave will continue to respond to client requests, # may be normal data, or it may be null data that has not yet received a value. # 2) If slave-serve-stale-data is set to "no", the slave will reply with "SYNC with master in progress" to handle various requests, except for the INFO and SLAVEOF commands. #slave-serve-stale-data yes# You can configure whether the salve instance accepts writes. A writable slave instance may be useful for storing temporary data (because the data written to salve# will be deleted after synchronization with the master), but it can cause problems if the client is writing due to a configuration error. ## From Redis 2.6, all slaves are read-only ## Note: Read-only slaves are not designed to be exposed to untrusted clients on the Internet. It is just a layer of protection against instance misuse. # A read-only slave supports all management commands such as config, debug, etc. To limit you can use 'rename-command' to hide all administrative and dangerous commands to enhance the security of read-only slaves. Slave-read-only yes# The slave sends a ping request to the master at a specified interval. # Time interval can be set by repl_ping_slave_period. #Default 10 seconds. ## repl-ping-slave-period 10# The following options set the timeout for synchronization ## 1) The slave has a large amount of data transfer during the master SYNC, causing a timeout # 2) In the slave angle, the master times out, including data, ping, etc. # 3) In the master perspective, slave times out when the master sends REPLCONF ACK pings# # Ensure that this value is greater than the specified repl-ping-slave-period, otherwise the timeout will be detected every time the traffic between the master and the slave is not high## repl -timeout 60# Is TCP_NODELAY disabled after the slave socket sends SYNC? ## If you choose “yes” Redis will use less TCP packets and bandwidth to send data to slaves. But this will delay the transfer of data to slave#, the default configuration of the Linux kernel will reach 40 milliseconds ## If you choose "no" the delay of data transfer to salve will be reduced but more bandwidth will be used#

Copyright © Windows knowledge All Rights Reserved