Redis configuration file redis. conf explanation 1. Basic configuration memory unit representation # 1kgt; 1000 bytes #1 kbgt; 1024 bytes # 1mgt; 000000byt
Redis configuration file redis. conf explanation 1. Basic configuration memory unit representation #1 k = gt; 1000 bytes # 1kb = gt; 1024 bytes #1 m = gt; 1000000 byt
Redis. conf
1. Basic Configuration
Memory Unit Representation
#1 k = & gt; 1000 bytes
# 1kb => 1024 bytes
#1 m => 1000000 bytes
#1 mb => 1024*1024 bytes
#1g => 1000000000 bytes
#1 gb => 1024*1024*1024 bytes
The Unit is case insensitive 1 GB 1 Gb 1 GB
Run in the background. yes is run in the background. no is run in the foreground. The output is output to the terminal (default)
Daemonize yes
If the daemonize parameter is yes, a pid file is generated, which is defined in the pid file.
Pidfile/usr/local/redis-master/run/redis. pid
Listening port
Port 6379
IP address bound to the listener
Bind 127.0.0.1
If you call redis locally, you can directly use the sock File
Location of the unixsocket/tmp/redis. sock // sock File
Unixsocketperm 755 // sock File Permission
If a link is idle in N seconds, disable it.
Timeout 0
If the other party is down or the intermediate network is disconnected, the TCP link will be disconnected if the client fails to receive the response from the other party within the specified time (unit: seconds ), this parameter is affected by kernel parameters. We recommend that you set this parameter to 60.
Tcp-keepalive 0
Specify the level of the Output Message
# Debug (debugging level, detailed information, large amount of information)
# Verbose (detailed information, large amount of information)
# Notice (notification, production environment Recommendation)
# Warning (error message warning)
Loglevel notice
Log output file. The default value of this key is stdout output to the terminal when the front-end is running. If the stdout of this key is run by the daemon, the log is input to/dev/null, to record logs, you must specify the logfile location for the logs.
Logfile/var/log/redis. log
Set the syslog recorded in the log.
Syslog-enabled no
ID of the specified syslog
Syslog-ident redis
Specifies the level of syslog, between LOCAL0-LOCAL7
Syslog-facility local0
Set the number of databases
Databases 16
Set the number of databases. The default database is DB 0. You can SELECT a different per-connection The DBID here is between 0 and 'databases'-1
Databases 16
2. snapshot Configuration
Rule definition for saving DB to disk (snapshot)
Format: save
Example: save 900 1 // save if at least one key value changes within 900 seconds (15 minutes)
Save 300 10 // if at least 10 key values change within 300 seconds (6 minutes), save
Save 900 1 // each entry indicates a storage check
Save 300 10
Save 60 10000
If the above snapshot (RDB) is enabled, after a storage check, the disk may be broken or the permission is faulty, and redis will still work normally.
Stop-writes-on-bgsave-error yes
Whether to use LZF to compress the string to the. rdb database. If you want to save CPU resources, you can set it to no, but the space occupied by storing the string on the disk will be large. The default value is yes.
Rdbcompression yes
Rdb File validation. If it is used to verify the file, the file format will be avoided. If it is not used to verify the file, the resource new energy in the verification process will be required during each operation. If this parameter is set to no, the verification will be skipped.
Rdbchecksum yes
File Name of the dump data
Dbfilename dump. rdb
Redis working directory, which stores the dump file to this directory and generates an additional file
Dir/usr/local/redis-master/db
3. Master/Slave Parameters
If the local server is a salve server, configure this item.
# Slaveof
Slaveof 127.0.0.1 65532
Master verification Password
Masterauth
When the slave host is disconnected from the master, if this value is yes, when the client queries the slave, the ECHO should be sent to the client. If it is the first time that the client returns a date data or the null value, if it is set to no, "SYNC with master in SS" is returned to INFO and SLAVEOF
Slave-serve-stale-data yes
Slave server read-only (default)
Slave-read-only yes
Interval (in seconds) from sending ping to master)
Repl-ping-slave-period 10
Batch Transfer I/O timeout and master data or ping response Timeout: The default value is 60 s, which must be greater than the repl-ping-slave-period value.
Repl-timeout 60
If this option is "yes", Redis uses a small number of TCP packets and less bandwidth to send data, with a latency of 40 milliseconds from the host (40 milliseconds in linux kernel). If no is used, the latency will be reduced in slave, but the traffic usage is relatively large. If multiple slave hosts are used, we recommend that you set yes
Repl-disable-tcp-nodelay no
Slave host priority. If the master host is down, a slave host will be selected as another slave host. The first priority is the master, 0 is a special level, and 0 will never become the master. The default value is 100.
Slave-priority 100
For more details, please continue to read the highlights on the next page:
Recommended reading:
Redis cluster details
Install Redis in Ubuntu 12.10 (graphic explanation) + Jedis to connect to Redis
Redis series-installation, deployment, and maintenance
Install Redis in CentOS 6.3
Redis details: click here
Redis: click here