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.
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:
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:
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.