Redis Master-Slave configuration

Source: Internet
Author: User

First, the Environment preparation

master:192.168.1.203

slave:192.168.1.202

Redis is already installed, firewall and SELinux are turned off

Second, Redis master-slave configuration

Master config file does not move

Add the following on the slave configuration file:

Slaveof 192.168.1.203 6379 (primary server IP and Redis port number)

Masterauth passwd//master server password, if there is no can not add

Start master and slave, respectively

Test master/Slave configuration is successful, create a key on the master server

Set Key1 Fansik

From the server to see if there is this key on the server.

Get Key1

Third, Redis master-slave Other related configuration

Slave-read-only Yes #让从只读

Repl-ping-slave-period #设置slave向master发起ping的频率, launched every 10 seconds

Repl-timeout #设置slave Ping does not pass the master number of S after the timeout

Repl-disable-tcp-nodelay no #是否开启tcp_nodelay, will use less bandwidth when turned on, but there will be a delay, so it is recommended to close

Repl-backlog-size 1MB #同步队列的长度, Backuplog is a buffer of master, master will write the data to the buffer after the master and slave disconnects, and the slave will synchronize the data from the buffer.

Repl-backlog-ttl 3600 #主从断开后, buffer expiration, default 1 hours

Slave-priority #多个slave是可以设置优先级的, the lower the value of the higher priority, applied to the cluster, support slave switch to master, the highest priority will be switched

Min-slaves-to-write 3 #和下面的一起使用, he means that Master has found that more than 3 slave have a delay of more 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

Redis Master-Slave configuration

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.