Analysis of configuration files in redis practice

Source: Internet
Author: User
Tags redis cluster redis server

This article original from the http://blog.csdn.net/voipmaker reprint indicate the source.

To understand the usage of apsaradb for redis, you must master the important parameters in the configuration file. The following is my study notes on each parameter and a brief description of the use cases of special parameters.

Include/path/to/other. conf

Explanation: The include and C concepts are similar. redis parameters can be distributed to other files. When multiple redis instances are running, include a common configuration file to share all redis-servers and simplify redis. conf.

Daemonize No

Explanation:

Undoubtedly, this parameter specifies whether redis can be started in a later process mode. The default value is no. the production environment can be changed to yes. In addition, redis is single-threaded.

Pidfile/var/run/redis. PID

Explanation:

When the daemonize parameter is yes, redis will create a process file after the background process is started. This parameter specifies the path of this file.

Port 6379

Explanation: The redistcp listening port through which the client interacts with the redis server. In non-cluster mode, redis only has this listening port

TCP-Back log 511

Explanation: the value of the client connection queue, which is a parameter of the listen function in the socket. If the server caps is very high, you need to increase this parameter.

Bind 127.0.0.1

Description: The listening address. By default, it is used to listen to all network cards. You can also specify one or more listening addresses. Multiple formats:

Bind 192.168.1.1 192.168.1.2

Loglevel notice

Explanation:

Specifies the log level. The default value is notice, including debug, verbose, notice, and warning.

We recommend that you use notice in the production environment. debug or verbose can be used in the test phase. The most logs are debug logs.

Logfile

Explanation:

Specify the log file. The default value is null. Print it to the console. You can specify the path, for example,/var/log/redis. log.

 

Save 900 1

Explanation:

This parameter is supported by redis persistence. Based on the snapshot mechanism, persistent storage is regularly executed to generate an RDB file. The save command is used to enable this configuration. The first parameter specifies how long (in seconds) It will be executed, the second is the number of write operations performed within the time specified by the first parameter before the persistent operation is executed.

Dbfilename dump. RDB

Name of the database file generated by save

Dir ./

The directory path of the database. It is a directory with the server by default.

Slaveof <masterip> <masterport>

Explanation:

Redis master-slave replication function. With this parameter, a redis instance can be used as the slave of a master when it is started,

Slaveof the first parameter is the master's IP address, and the second parameter is the master's port.

You can also run the slaveof command on the redis-cli console to dynamically use a redis instance as the slave of another master.

Requirepass passwd

Explanation:

This redis password. If it is enabled, you need to set a password when connecting the client. Another function is to use redis as the slave. If the master has enabled this parameter, slave needs to set the value of the masterauth parameter to the value of this parameter (requirepass,

Masterauth <master-Password>

Explanation:

This parameter is only used when redis is used as a server Load balancer instance. It is used for authentication between the Server Load balancer instance and the master node. If the master node has enabled the authentication function, masterauth means that this password is used when the slave communicates with the master.

In addition, this parameter is used only when the reqireuth parameter is enabled in the redis. conf file of the master node.

Maxclients 10000

Explanation: Maximum number of concurrent clients. 10000 TCP connections exist simultaneously

Maxmemory

Explanation: The maximum memory size applied by redis, in bytes. The default value is unlimited.

Appendonly Yes

Explanation:

The second method of redis persistence is aof, Which is enabled by default. By default, persistent storage is executed every second. It can also be set to Real-Time persistence, Which is safer than save.

Appendfilename "appendonly. aof"

Explanation: the name of the stored data file in aof mode.

Appendfsync No

Explanation: the execution time of aof can be everysec (Real-Time), always (not manual), and flush (NO) to the operating system)

Cluster-enabled Yes

Explanation: The current redis cluster mode is enabled, which is only available in version 3.0. It is disabled by default.

Cluster-config-file nodes-6379.conf

Explanation:

In cluster mode, each redis node generates its own cluster configuration file, which is maintained by redis without manual modification.

Cluster-node-Timeout 15000

Explanation:

In cluster mode, when the current node is alive with other nodes, it is considered that the other nodes are in the Fail State for a period of 15 seconds.


Analysis of configuration files in redis practice

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.