Dragonfly Cloud is now available in the AWS Marketplace - learn more

Question: What is the Redis replication timeout and how can it be set?

Answer

Redis replication timeout sets the maximum amount of time the master waits for a ping response from its slave before dropping the connection. This configuration is critical to prevent potential data loss or stale reads in case of network issues or unresponsive slaves.

The repl-timeout setting in the Redis configuration file controls this value, and it's specified in seconds. By default, it's set to 60 seconds. You can change it as follows:

# In your redis.conf file repl-timeout 120

This sets the replication timeout to 120 seconds. Save and exit the file, then restart the Redis server for the changes to take effect.

You can also modify this setting at runtime using the CONFIG SET command:

# Via Redis CLI redis-cli CONFIG SET repl-timeout 120

Be cautious when adjusting this value. Setting it too low may lead to unnecessary disconnections due to transient network issues, while setting it too high may delay the detection of genuine problems with slave nodes.

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