Skip to content

Commit 845398a

Browse files
DOC-5665 applied feedback
1 parent c93b3e0 commit 845398a

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

content/develop/clients/jedis/failover.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,17 @@ and [retries](#retry-configuration) (these are explained in more detail below).
167167
multiConfig
168168
.failureDetector(MultiDbConfig.CircuitBreakerConfig.builder()
169169
.slidingWindowSize(2) // Sliding window size as a duration in seconds.
170-
.failureRateThreshold(10.0f) // percentage of failures to trigger circuit breaker
170+
.failureRateThreshold(10.0f) // Percentage of failures to trigger circuit breaker.
171171
.minNumOfFailures(1000) // Minimum number of failures before circuit breaker is tripped
172172
.build())
173-
.failbackSupported(true) // Enable failback
174-
.failbackCheckInterval(120000) // Check every 2 minutes the unhealthy database to see if it has recovered
175-
.gracePeriod(60000) // Keep database disabled for 60 seconds after it becomes unhealthy
173+
.failbackSupported(true) // Enable failback.
174+
.failbackCheckInterval(120000) // Check every 2 minutes to see if the unhealthy database has recovered
175+
.gracePeriod(60000) // Keep database disabled for 60 seconds after it becomes unhealthy.
176176
// Optional: configure retry settings
177177
.commandRetry(MultiDbConfig.RetryConfig.builder()
178178
.maxAttempts(3) // Maximum number of retry attempts (including the initial call)
179-
.waitDuration(500) // Number of milliseconds to wait between retry attempts
180-
.exponentialBackoffMultiplier(2) // Exponential backoff factor multiplied against wait duration between retries
179+
.waitDuration(500) // Number of milliseconds to wait between retry attempts.
180+
.exponentialBackoffMultiplier(2) // Exponential backoff factor multiplied by the wait duration between retries.
181181
.build())
182182
// Optional: configure fast failover
183183
.fastFailover(true) // Force closing connections to unhealthy database on failover
@@ -297,28 +297,28 @@ builder.
297297

298298
```java
299299
BiFunction<HostAndPort, Supplier<RedisCredentials>, MultiDbConfig.StrategySupplier> healthCheckStrategySupplier =
300-
(HostAndPort dbHostPort, Supplier<RedisCredentials> credentialsSupplier) -> {
301-
LagAwareStrategy.Config lagConfig = LagAwareStrategy.Config.builder(dbHostPort, credentialsSupplier)
302-
.interval(5000) // Check every 5 seconds
303-
.timeout(3000) // 3 second timeout
304-
.extendedCheckEnabled(true)
305-
.build();
306-
307-
return (hostAndPort, jedisClientConfig) -> new LagAwareStrategy(lagConfig);
308-
};
309-
310-
// Configure REST API endpoint and credentials
311-
HostAndPort restEndpoint = new HostAndPort("redis-enterprise-db-fqdn", 9443);
312-
Supplier<RedisCredentials> credentialsSupplier = () ->
313-
new DefaultRedisCredentials("rest-api-user", "pwd");
314-
315-
MultiDbConfig.StrategySupplier lagawareStrategySupplier = healthCheckStrategySupplier.apply(
316-
restEndpoint, credentialsSupplier);
317-
318-
MultiDbConfig.DatabaseConfig dbConfig =
319-
MultiDbConfig.DatabaseConfig.builder(hostAndPort, clientConfig)
320-
.healthCheckStrategySupplier(lagawareStrategySupplier)
300+
(HostAndPort dbHostPort, Supplier<RedisCredentials> credentialsSupplier) -> {
301+
LagAwareStrategy.Config lagConfig = LagAwareStrategy.Config.builder(dbHostPort, credentialsSupplier)
302+
.interval(5000) // Check every 5 seconds
303+
.timeout(3000) // 3 second timeout
304+
.extendedCheckEnabled(true)
321305
.build();
306+
307+
return (hostAndPort, jedisClientConfig) -> new LagAwareStrategy(lagConfig);
308+
};
309+
310+
// Configure REST API endpoint and credentials
311+
HostAndPort restEndpoint = new HostAndPort("redis-enterprise-db-fqdn", 9443);
312+
Supplier<RedisCredentials> credentialsSupplier = () -> new DefaultRedisCredentials("rest-api-user", "pwd");
313+
// Build a single LagAwareStrategy based on REST endpoint and credentials
314+
LagAwareStrategy.Config lagConfig = LagAwareStrategy.Config
315+
.builder(restEndpoint, credentialsSupplier)
316+
.interval(5000) // Check every 5 seconds
317+
.timeout(3000) // 3 second timeout
318+
.extendedCheckEnabled(true)
319+
.build();
320+
MultiDbConfig.StrategySupplier lagAwareStrategySupplier = (hostAndPort,
321+
jedisClientConfig) -> new LagAwareStrategy(lagConfig);
322322
```
323323

324324
### Custom health check strategy

0 commit comments

Comments
 (0)