Redis Series-Configuration file summary

Source: Internet
Author: User
Tags allkeys syslog

If you do not specify a profile, Redis can also start, at which point Redis uses the default built-in configuration. However, in a formal environment, Redis is often configured with the configuration file "usually called redis.conf".

The redis.conf configuration format is as follows:

[Plain]View PlainCopy
    1. Keyword argument1 argument2 ... argumentn


redis.conf Configuration parameters:

1) daemonize On|yes

Redis is not run as a daemon by default, and can be modified by this configuration item, enabling the daemon when you use Yes

2) Pidfile/var/run/redis_6379.pid

When Redis is running as a daemon, the system defaults to writing the PID to/var/run/redis.pid, and the PID file can be specified by pidfile

3) Port 6379

Redis Default Listener 6379 port, you can specify the port to listen for Redis via port

4) Bind 127.0.0.1

Bind host Address

5) Unixsocket/tmp/redis.sock

Specify the UNIX socket path for Redis listening

6) Timeout 300

When the client is idle for a period of time, close the connection, unit seconds

7) LogLevel verbose|debug|notice|warning

Specify logging level, default is verbose

8) Logfile/var/log/redis_6379.log

Logging file, default is standard output stdout, if Redis runs as daemon, logfile is configured as stdout, logs will output to/dev/null

9) syslog-enabled No|yes

When configured to Yes, the log is output to the system log and the default is no

) Syslog-ident Redis

Specify the identifier for the syslog

One) syslog-facility local0

Specify the Syslog device (facility), either user or local0 to LOCAL7

) Databases 16

Set the number of databases in Redis, the default database is DB 0, and you can select the database to use with select <dbid>. Dbis is greater than or equal to 0, less than or equal to Databases-1 "here is 16-1"

Save <seconds> <changes>

Specify how long, how many update operations to synchronize data to the database file, you can mate with multiple conditions, the system default configuration is as follows:

[Plain]View PlainCopy
    1. Save 1 #900秒 1 changes
    2. Save #300秒 10 Updates
    3. Save 10000<span style= "White-space:pre" > </span> #60秒 10,000 updates

Note that if you do not persist "do not write data to disk", comment out save.

) Rdbcompression Yes|no

When the data dumps to the data file, the system compresses the string object data, and the system defaults to Yes. If you want to save the CPU, you can set it to no, when the data file is larger than the LZF compression
) Dbfilename Dump.rdb

Specify the database file name, default is Dump.rdb

dir/var/lib/redis/6379)

Specify local Database storage directory

Slaveof <masterip> <masterport>

When this machine is a slave service, set the IP and port of the master service

) Masterauth <master-password>

When the Master service has a password set, the slave service connects to the master password. If the configuration is not correct, the slave service request will be rejected

) Slave-serve-stale-data Yes|no

When the connection between slave and master is disconnected or slave is synchronizing with master, if there is a slave request, slave can request the client when the Slave-serve-stale-data is configured to Yes, and when no, Slave will respond to error, default is yes

) Requirepass foobared

Set up a Redis connection password

) MaxClients 128

Set the maximum number of client connections at the same time, which is unlimited by default. If you set maxclients 0 o'clock, it means that you do not limit

MaxMemory <bytes>

Specifies the Redis maximum memory limit, which, when Redis starts, loads data into memory, and when it reaches the maximum memory, Redis clears the expired or expired key, still reaches the maximum memory setting, and will no longer be able to write, but still be able to read the operation

) Maxmemory-policy Volatile-lru|allkeys-lru|volatile-random|allkeys->random|volatile-ttl|noeviction

What policy to use to remove in-memory data when Redis uses memory to reach maximum

) AppendOnly No|yes

Specifies whether to log after each update operation, the default configuration is no, that is, asynchronously writes data to disk and, if not turned on, may cause partial data loss in the event of a power outage

) Appendfilename appendonly.aof

Specifies the update log file name "AoF log", which defaults to appendonly.aof

) Appendfsync Everysec|no|aways

Specify the update log condition, no indicates that the AoF file (fast) that the operating system synchronizes the data cache to the disk (quick) always represents a aof file (slow, secure) that manually calls Fsync to write data to disk after each update operation

Everysec, indicating synchronization once per second (split, default)

) Slowlog-log-slower-than 10000

Configure the conditions for logging slow logs, the unit is subtle, when a negative value is turned off slow logging, when it is 0 o'clock, all operations are logged

) Slowlog-max-len 1024

Configure the maximum number of records for slow queries

) Hash-max-zipmap-entries 512

Configure the maximum number of elements, Redis uses a special hash algorithm when the configuration data is exceeded

) Hash-max-zipmap-value 64

Configure the maximum element value, using a special hash algorithm when Tsaoko configuration values

) Activerehashing Yes

Specifies whether to activate the reload hash, which is turned on by default

You can use the following command to start the Redis service using the configuration file redis.conf

[Plain]View PlainCopy
    1. /usr/local/redis/bin/redis-server/usr/local/redis/etc/redis.conf


Redis installation can refer to the previous Blog:redis series-Install the Deployment Maintenance Chapter

Redis Series-Configuration file summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.