HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Redis remove slave from replication along with sentinel

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
rediswithslavereplicationremovealongfromsentinel

Problem

I have a 3-nodes Redis replication and a 3-nodes Sentinel. I want to remove one slave.

I tried stop slave and remove slaveof 10.128.130.139 6379 from configuration. But it became slave again after I started it. And slaveof was back again in config.

After reading SLAVEOF, I tried invoking SLAVEOF NO ONE. But it became slave again after 1 min.

I guess Sentinel reconfig it to slave. How can I remove one slave in my case where Sentinel exists?

Solution

I should read sentinel doc carefully. It's mentioned in sections Adding or removing Sentinels and Removing the old master or unreachable slaves.

These are steps:

  • Shut down the redis slave to be removed.



-
Remove slaveof statement from conf

# Generated by CONFIG REWRITE
slaveof 10.128.130.139 6379


-
Send a SENTINEL RESET mastername command to all Sentinel instances. One after the other, waiting at least 30 seconds between instances.

Now the redis slave is standalone, and sentinels forget this slave.

Code Snippets

# Generated by CONFIG REWRITE
slaveof 10.128.130.139 6379

Context

StackExchange Database Administrators Q#120583, answer score: 6

Revisions (0)

No revisions yet.