Redis sentinel cluster configuration-master-slave switchover, redissentinel

Source: Internet
Author: User

Redis sentinel cluster configuration-master-slave switchover, redissentinel

1. Configure redis master and redis slave (see the http://www.cnblogs.com/wangchaozhi/p/5140469.html above for specific configuration operations ).

Redis master ip: 127.0.0.1: port 6379 (default configuration file)

Redis slave1 ip: 127.0.0.1: port 6380 (modify the port number to 6380 and configure it as the master slave, # slaveof <masterip> <masterport>, remove # and change it to slaveof 127.0.0.1 6379)

Redis slave1 ip: 127.0.0.1: port 6381 (modify the port number to 6381 and configure it as the master slave, # slaveof <masterip> <masterport>, remove # and change it to slaveof 127.0.0.1 6379)

2. Configure sentinel (you can also configure it as a cluster. Here, configure a demo ).

Sentinel monitor mymaster 127.0.0.1 6379 1
Sentinel down-after-milliseconds MySQL master 5000
Sentinel failover-timeout MySQL master 180000
Sentinel parallel-syncs mymaster 1

3. Run master, slave1, slave2, and sentinel.

Command for starting redisservice redis-server.exe redis. windows. conf

Start sentinelcommand redis-server.exe sentinel. conf -- sentinel

4. Simulate host downtime

Enter the following command

Redis-cli-h 127.0.0.1-p 6379 shutdown

Observe the sentinel service.

We can know that the slave of port 6381 is upgraded to the master. Test whether data can be written

Restart the master's service port 6379.

Observe master and sentinel service prompts

The red line indicates that the original master (6379) becomes the slave of 6381.

At this point, the master-slave automatic switch configuration test is complete.

 

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.