4, redis.conf in the replication configuration item description

Source: Internet
Author: User
Tags password protection

Note:In Master-slave deployment mode,just slave instance configuration peplication related items, the meanings are described below.
1) slaveof <masterip> <masterport>
The slave instance needs to be configured to point to the master (IP, Port).
2) Masterauth <master-password>
If the master instance has password protection enabled, the configuration entry requires a master startup password, and if Master does not enable the password, the configuration item needs to be commented out
3) Slave-serve-stale-data
Specifies the action of the slave when the connection to master is interrupted. The default is yes, which indicates that slave will continue to answer requests from the client, but the data may have expired (because of a connection interruption that cannot be synchronized from master). If configured as no, the rest of the request commands from the client will be answered by "SYNC with Master in progress" except for the "INFO" and "slaveof" commands that are normally answered by slave. Until the connection between the slave and master is rebuilt successfully or the slave is promoted to master.
4) Slave-read-only
Specifies whether slave is read-only and the default is yes. If configured as no, this means that slave is writable, but the written content is deleted after the master-slave synchronization is complete.
5) Repl-ping-slave-period
After Redis is deployed as replication mode, slave will ping the package to master with a predetermined period (default 10s), which can change this default cycle.
6) Repl-timeout
There are 2 scenarios in which the timeout is specified by this configuration: 1) Bulk transfer I/O timeout; 2) master data or ping response timeout.
 special attention is paid to the following:If you modify the default value, the user must enter a value that is greater than the Repl-ping-slave-period configuration value, or the timeout is frequent when the master-slave link is delayed.
7) Repl-disable-tcp-nodelay
Specifies whether to disable the No_delay option for the socket when synchronizing data to slave. When configured to Yes, No_delay is disabled, and the TCP stack consolidates packet unification, which reduces the number of packets between master and slave nodes and saves bandwidth, but increases the time that data is synchronized to slave. If configured as no, the TCP stack does not delay the timing of packets when the No_delay is enabled, which reduces the latency of data synchronization, but requires greater bandwidth. Typically, you should configure No to reduce the synchronization delay, but you can configure yes if the network load between master and slave nodes is already high.
Note: The No_delay option of the socket involves the congestion control algorithm of the TCP protocol stack-nagle ' s algorithm.
8) slave-priority
specifies the priority of the slave. In a deployment environment where more than 1 slave exist, Redis Sentinel promotes the slave with the lowest priority value to master when Master is down. Note that if the configuration item is 0, the corresponding slave will never be automatically promoted to master by Redis Sentinel.

There are a few things to be clear about replication (the following are mainly summarized here):
A. The replication of Redis is different from the concept of cluster. If S is the slave of M, then M cannot set itself as the slave of S. If S is hung up, then M is working normally; conversely, if M hangs, then s may stop working properly, "possible" because s is determined by the Slave-serve-stale-data in its configuration file.
B Assuming a total of 2 nodes, M is master,s for slave, if M hangs, then the reasonable way is to promote S to master (by slave NO one command). When the original master M is restored, the M is set to the slave of S. Of course, the actual approach is not limited to the recommendations here.
c. Assuming a total of 3 nodes, M is master,s1 and S2 are all slave, if M hangs, the reasonable way is to promote the 1 slave to master, while the other slave master must be reset to the new master instance.

       &NBSP; know that M is dead?
        This involves the monitoring of redis, but fortunately, we can use Redis's official tool, Redis Sentinel, to complete monitoring tasks.

The next note explains the usage of Sentinel and discusses the pits that may be used in the actual use.


4, redis.conf in the replication configuration item description

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.