Skip to content

Commit

Permalink
document update regarding addressResolverGroup settings (#3007)
Browse files Browse the repository at this point in the history
* Update advanced-usage.md

* update doc

* update doc

* pr comments (sorry for getting back late)

* wrap with actual DnsAddressResolverGroup

* use space
  • Loading branch information
winguse authored Oct 18, 2024
1 parent 1de2116 commit 459d4ea
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
30 changes: 29 additions & 1 deletion docs/advanced-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ disabled by setting <code>commandLatencyPublisherOptions(…)</code> to
<td><code>DnsResolvers.JVM_DEFAULT ( or netty if present)</code></td>
</tr>
<tr>
<td colspan="3"><p>Since: 3.5, 4.2</p>
<td colspan="3"><p>Since: 3.5, 4.2. Deprecated: 6.4</p>
<p>Configures a DNS resolver to resolve hostnames to a
<code>java.net.InetAddress</code>. Defaults to the JVM DNS resolution
that uses blocking hostname resolution and caching of lookup results.
Expand All @@ -223,6 +223,34 @@ netty's <code>AddressResolver</code> that resolves DNS names on
<code>Bootstrap.connect()</code> (requires netty 4.1)</p></td>
</tr>
<tr>
<td><strong>Address Resolver Group</strong></td>
<td><code>addressResolverGroup</code></td>
<td><code>DefaultAddressResolverGroup.INSTANCE ( or netty DnsAddressResolverGroup if present)</code></td>
</tr>
<tr>
<td colspan="3"><p>Since: 6.1</p>
<p>Sets the <code>AddressResolverGroup</code> for DNS resolution. This option is only effective if
<code>DnsResolvers#UNRESOLVED</code> is used as <code>DnsResolver</code>. Defaults to
<code>io.netty.resolver.DefaultAddressResolverGroup#INSTANCE</code> if <code>netty-dns-resolver</code>
is not available, otherwise defaults to <code>io.netty.resolver.dns.DnsAddressResolverGroup</code></p>
<p>Users of DNS-based Redis-HA setups (e.g. AWS ElastiCache) might want to configure a different DNS
resolver group. For example:

```java
new DnsAddressResolverGroup(
new DnsNameResolverBuilder(dnsEventLoop)
.channelType(NioDatagramChannel.class)
.resolveCache(NoopDnsCache.INSTANCE)
.cnameCache(NoopDnsCnameCache.INSTANCE)
.authoritativeDnsServerCache(NoopAuthoritativeDnsServerCache.INSTANCE)
.consolidateCacheSize(0)
);
```

</p>
</td>
</tr>
<tr>
<td><strong>Reconnect Delay</strong></td>
<td><code>reconnectDelay</code></td>
<td><code>Delay.exponential()</code></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public Builder computationThreadPoolSize(int computationThreadPoolSize) {

/**
* Sets the {@link DnsResolver} that is used to resolve hostnames to {@link java.net.InetAddress}. Defaults to
* {@link DnsResolvers#JVM_DEFAULT}
* {@link DnsResolvers#UNRESOLVED}
*
* @param dnsResolver the DNS resolver, must not be {@code null}.
* @return {@code this} {@link Builder}.
Expand Down

0 comments on commit 459d4ea

Please sign in to comment.