|
|
1 个月前 | |
|---|---|---|
| .. | ||
| FEATURES.md | 1 个月前 | |
| README.md | 1 个月前 | |
| circuit_breaker.go | 1 个月前 | |
| config.go | 1 个月前 | |
| errors.go | 1 个月前 | |
| example_hooks.go | 1 个月前 | |
| handoff_worker.go | 1 个月前 | |
| hooks.go | 1 个月前 | |
| manager.go | 1 个月前 | |
| pool_hook.go | 1 个月前 | |
| push_notification_handler.go | 1 个月前 | |
| state.go | 1 个月前 | |
Seamless Redis connection handoffs during cluster maintenance operations without dropping connections.
Maintenance notifications are currently supported only in standalone Redis clients. Cluster clients (ClusterClient, FailoverClient, etc.) do not yet support this functionality.
client := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Protocol: 3, // RESP3 required
MaintNotificationsConfig: &maintnotifications.Config{
Mode: maintnotifications.ModeEnabled,
},
})
ModeDisabled - Maintenance notifications disabledModeEnabled - Forcefully enabled (fails if server doesn’t support)ModeAuto - Auto-detect server support (default)&maintnotifications.Config{
Mode: maintnotifications.ModeAuto,
EndpointType: maintnotifications.EndpointTypeAuto,
RelaxedTimeout: 10 * time.Second,
HandoffTimeout: 15 * time.Second,
MaxHandoffRetries: 3,
MaxWorkers: 0, // Auto-calculated
HandoffQueueSize: 0, // Auto-calculated
PostHandoffRelaxedDuration: 0, // 2 * RelaxedTimeout
}
EndpointTypeAuto - Auto-detect based on connection (default)EndpointTypeInternalIP - Internal IP addressEndpointTypeInternalFQDN - Internal FQDNEndpointTypeExternalIP - External IP addressEndpointTypeExternalFQDN - External FQDNEndpointTypeNone - No endpoint (reconnect with current config)Workers: min(PoolSize/2, max(10, PoolSize/3)) when auto-calculated
Queue: max(20×Workers, PoolSize) capped by MaxActiveConns+1 or 5×PoolSize
Examples: