November 7th: Exploring an 80% lower cost hosted Redis alternative - register

Question: What is Redis replication with multi-master?

Answer

Redis, by default, supports a primary-replica replication model. In this setup, the data from the primary node is copied to one or more replica nodes, which can serve read requests and act as backups. If the primary fails, one of the replicas can be promoted to become the new primary. However, Redis does not natively support a multi-master configuration.

Multi-master replication involves having multiple master nodes that are all able to accept write commands, and these write operations are replicated to all other masters. Multi-master setups can be useful for achieving higher availability and better write performance across geographically distributed systems.

While native Redis doesn't support multi-master replication out-of-the-box, there are third-party solutions that have been developed to provide this capability. One popular solution is Redis Enterprise, offered by Redis Labs, which includes conflict-free replicated data types (CRDTs) that allow active-active geo-distributed deployments.

For those looking for an open-source approach, KeyDB is a fork of Redis that claims to support multi-master replication. Below is an example of how you might configure two KeyDB servers for multi-master replication:

# On the first KeyDB server (server A), edit keydb.conf: port 6379 replicaof <IP_of_server_B> 6379 active-replica yes multi-master yes # On the second KeyDB server (server B), edit keydb.conf: port 6379 replicaof <IP_of_server_A> 6379 active-replica yes multi-master yes

After updating the configurations, restart both KeyDB instances to apply the changes.

Remember, the implementation details and performance characteristics will vary based on the chosen solution, and careful conflict handling mechanisms must be in place when using multi-master replication to avoid issues such as write conflicts and ensure consistency across your dataset.

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