Dragonfly Cloud is now available on the AWS Marketplace - Learn More

Question: What is redis replication priority and how is it used?

Answer

In Redis, replication priority is a configurable parameter used by the Sentinel system to decide which replica will be promoted to master when the current master fails. This priority is defined with the slave-priority configuration directive in the Redis configuration file.

The lower the number, the higher the priority. A slave with a priority of zero can never be promoted to master.

Here is an example of setting the replication priority in the Redis configuration file:

slave-priority 100

It's important to mention that if several replicas have the same priority, the one with the smallest replication offset (i.e., the most up-to-date) is selected.

Replication priority can be useful in scenarios where certain replicas are known to have more resources or are more reliable than others, thus should be preferred for promotion to the master role. By tweaking this value on each Redis instance, you can influence the behavior of your distributed Redis system during failovers.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Switch & save up to 80% 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost