Skip to content

Commit 6d159ad

Browse files
andy-stark-rediskaitlynmichael
authored andcommitted
DOC-4370 corrected info about DNS cache for Java clients
1 parent 888229b commit 6d159ad

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

content/develop/connect/clients/java/jedis.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,13 @@ All the Jedis exceptions are runtime exceptions and in most cases irrecoverable,
468468

469469
### DNS cache and Redis
470470

471-
When you connect to a Redis with multiple endpoints, such as [Redis Enterprise Active-Active](https://redis.com/redis-enterprise/technology/active-active-geo-distribution/), it's recommended to disable the JVM's DNS cache to load-balance requests across multiple endpoints.
471+
When you connect to a Redis server with multiple endpoints, such as [Redis Enterprise Active-Active](https://redis.com/redis-enterprise/technology/active-active-geo-distribution/), you *must*
472+
disable the JVM's DNS cache. If a server node or proxy fails, the IP address for any database
473+
affected by the failure will change. When this happens, your app will keep
474+
trying to use the stale IP address if DNS caching is enabled.
475+
476+
Use the following code to disable the DNS cache:
472477

473-
You can do this in your application's code with the following snippet:
474478
```java
475479
java.security.Security.setProperty("networkaddress.cache.ttl","0");
476480
java.security.Security.setProperty("networkaddress.cache.negative.ttl", "0");

content/develop/connect/clients/java/lettuce.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,12 @@ In this setup, `LettuceConnectionFactory` is a custom class you would need to im
296296

297297
## DNS cache and Redis
298298

299-
When you connect to a Redis database with multiple endpoints, such as Redis Enterprise Active-Active, it's recommended to disable the JVM's DNS cache to load-balance requests across multiple endpoints.
299+
When you connect to a Redis server with multiple endpoints, such as [Redis Enterprise Active-Active](https://redis.com/redis-enterprise/technology/active-active-geo-distribution/), you *must*
300+
disable the JVM's DNS cache. If a server node or proxy fails, the IP address for any database
301+
affected by the failure will change. When this happens, your app will keep
302+
trying to use the stale IP address if DNS caching is enabled.
300303

301-
You can do this in your application's code with the following snippet:
304+
Use the following code to disable the DNS cache:
302305

303306
```java
304307
java.security.Security.setProperty("networkaddress.cache.ttl","0");

0 commit comments

Comments
 (0)