Redis Master-Slave

Source: Internet
Author: User
Tags install redis

Redis master and slave settings are much simpler than MySQL master and slave, let's take a look.


1.redis Configuration Master-Slave

Two servers: Master (192.168.31.105) and slave (192.168.31.112)

Install Redis and start with the steps described earlier

Master config file does not move

Add a row to the slave configuration file

Slaveof 192.168.31.105 6379

Masterauth passwd//If the Lord sets a password, add this line

Start master and slave, respectively


2. Testing Redis Master

Master on:

Redis-cli
>set K1 v1
>get K1
"V1"

On slave:

Redis-cli
>get K1
"V1"


3.Redis master-slave Other related configuration (can be used selectively)

Slave-read-only Yes//Let read-only, default is Yes

Repl-ping-slave-period 10//Set slave the frequency of pings to master, initiated every 10s

Repl-timeout 60//Set slave ping does not pass the master number of S after the timeout

Repl-disable-tcp-nodelay No//open tcp_nodelay, will use less bandwidth, but there will be delay, so it is recommended to close

Repl-backlog-size 1MB//sync Queue Length, Backuplog is a buffer of master, master will write the data to the buffer, slave will synchronize the data from the buffer after the master disconnects.

Repl-backlog-ttl 3600//Master disconnect, buffer expiration, default 1 hours

Slave-priority 100//Multiple Slave can be set priority, the lower the value of the higher priority, applied to the cluster, support slave switch to master, the highest priority will switch

Min-slaves-to-write 3//and used in conjunction with the following, it means that master found that there are more than 3 slave latency higher than 10s, then master will temporarily stop the write operation. If either of these values is 0, the function is turned off, and the default first value is 0.

Min-slaves-max-lag 10



This article is from the Linux OPS blog, so be sure to keep this source http://zhumy.blog.51cto.com/11647651/1829289

Redis Master-Slave

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.