Question: What is the difference between a Redis slave and a replica?

Answer

In Redis, the terms "slave" and "replica" essentially refer to the same concept but are used in different versions of the software. With the release of Redis 5.0, the term "slave" was replaced with "replica", but it's important to note that their functional roles remain the same.

Both terms refer to the mechanism by which Redis achieves data replication - an essential feature for data redundancy and failover support. When "replicaof" command is issued from a Redis instance, it turns that instance into a replica (or slave in older versions) of the specified master instance. All write operations performed on the master are propagated to its replicas.

Here's a simple example of how to make one Redis instance a replica of another:

redis-cli replicaof <master_host> <master_port>

Remember, there's no difference in functionality or performance between "slave" and "replica". The change in terminology was made purely for more inclusive language use in the software industry.

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

Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.