maintnotifications/FEATURES.md
The Maintenance Notifications feature enables seamless Redis connection handoffs during cluster maintenance operations without dropping active connections. This feature leverages Redis RESP3 push notifications to provide zero-downtime maintenance for Redis Enterprise and compatible Redis deployments.
Using Maintenance Notifications may affect the read and write timeouts by relaxing them during maintenance operations. This is necessary to prevent false failures due to increased latency during handoffs. The relaxed timeouts are automatically applied and removed as needed.
Supports all Redis Enterprise maintenance notification types:
ModeDisabled: Maintenance notifications completely disabledModeEnabled: Forcefully enabled (fails if server doesn't support)ModeAuto: Auto-detect server support (recommended default)EndpointTypeAuto: Auto-detect based on current connectionEndpointTypeInternalIP: Use internal IP addressesEndpointTypeInternalFQDN: Use internal fully qualified domain namesEndpointTypeExternalIP: Use external IP addressesEndpointTypeExternalFQDN: Use external fully qualified domain namesEndpointTypeNone: No endpoint (reconnect with current configuration)RelaxedTimeout: Extended timeout during maintenance operations (default: 10s)HandoffTimeout: Maximum time for handoff completion (default: 15s)PostHandoffRelaxedDuration: Relaxed period after handoff (default: 2×RelaxedTimeout)MaxWorkers: Maximum concurrent handoff workers (auto-calculated if 0)HandoffQueueSize: Handoff queue capacity (auto-calculated if 0)MaxHandoffRetries: Maximum retry attempts for failed handoffs (default: 3)CircuitBreakerFailureThreshold: Failures before opening circuit (default: 5)CircuitBreakerResetTimeout: Time before testing recovery (default: 60s)CircuitBreakerMaxRequests: Max requests in half-open state (default: 3)When MaxWorkers = 0 (auto-calculate):
MaxWorkers = min(PoolSize/2, max(10, PoolSize/3))
When HandoffQueueSize = 0 (auto-calculate):
QueueSize = max(20 × MaxWorkers, PoolSize)
Capped by: min(MaxActiveConns + 1, 5 × PoolSize)
redis.NewClient) - Full support for MOVING, MIGRATING, MIGRATED, FAILING_OVER, FAILED_OVER notificationsredis.NewClusterClient) - Support for SMIGRATING and SMIGRATED notifications for hitless slot migrationsBefore:
client := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Protocol: 2, // RESP2
})
After:
client := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Protocol: 3, // RESP3 required
MaintNotificationsConfig: &maintnotifications.Config{
Mode: maintnotifications.ModeAuto,
},
})
For Redis Cluster with hitless slot migration support:
client := redis.NewClusterClient(&redis.ClusterOptions{
Addrs: []string{"localhost:7000", "localhost:7001", "localhost:7002"},
Protocol: 3, // RESP3 required for push notifications
MaintNotificationsConfig: &maintnotifications.Config{
Mode: maintnotifications.ModeAuto,
RelaxedTimeout: 10 * time.Second, // Extended timeout during slot migrations
},
})
The cluster client automatically handles:
// Get the manager from the client
manager := client.GetMaintNotificationsManager()
if manager != nil {
// Add logging hook
loggingHook := maintnotifications.NewLoggingHook(2) // Info level
manager.AddNotificationHook(loggingHook)
// Add metrics hook
metricsHook := maintnotifications.NewMetricsHook()
manager.AddNotificationHook(metricsHook)
}