Redis manual failover

Source: Internet
Author: User
Tags redis version
This article introduces the manual failover operation and troubleshooting process in the redis master-slave environment. When the master instance goes down, the master instance is upgraded from the master instance to the master instance and data is written to the master instance. After the master instance is restored, synchronize the number of original slave instances

This article introduces the manual failover operation and troubleshooting process in the redis master-slave environment. When the master instance goes down, the master instance is upgraded from the master instance to the master instance and data is written to the master instance. After the master instance is restored, synchronize the number of original slave instances

This article introduces the manual failover operation and troubleshooting process in the redis master-slave environment. When the master instance goes down, the master instance is upgraded from the master instance to the master instance and data is written to the master instance. After the master instance is restored, after synchronizing data from the original Instance, restore the initial master-slave instance role!

Environment Introduction
Operating system versions: rhel5.4 64bit
Redis version: 2.6.4
All redis instance ports are: 6379
Redis instance password is: 123
The master instance is server11 (192.168.1.112)
The slave instance is server12 (192.168.1.113)

I. Manual switchover without persistence Configuration
1: Normally, server11 is the master instance, server12 is the slave instance, and data synchronization is normal

2: When the master instance fails, the slave instance can be queried normally, but data cannot be written.

3: upgrade from instance to master instance to write data

4: after the master instance recovers, it tries to obtain the latest data from the server12 instance. The actual test shows that this method is not feasible, resulting in data inconsistency between server11 and server12, if the initial instance role is forcibly restored without record filing space, data will be lost.

Ii. Enable the test for instance snapshot persistence
1: After the original test environment is restored, the snapshot persistence from the instance is enabled. Because it is a test environment, if one data record is changed within 60 seconds, the snapshot is retained once.

2: whether the master-slave environment data is synchronized normally when writing test data

3. Simulate master instance downtime, Hong Kong server, and Hong Kong server. Manually upgrade from Master instance to master instance and continue to write new data.

4: Data Synchronization and role restoration after the original master instance is restored. Data Synchronization here is implemented by copying the snapshot files from the instance to the master instance.

Subsequent Extension: the failover process implemented in this article can be automatically implemented by deploying keepalive, from the instance to the master instance, at last, you can use the shell script to schedule the data synchronization and role recovery of the original master instance. This will be detailed in the next article!

This article is from the "Bo Yue" blog and will not be reproduced!

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.