Skip to content

Commit 7dfbd99

Browse files
authored
Add dns_cache for server addresses as in pgbouncer (#249)
* Add dns_cache so server addresses are cached and invalidated when DNS changes. Adds a module to deal with dns_cache feature. It's main struct is CachedResolver, which is a simple thread safe hostname <-> Ips cache with the ability to refresh resolutions every `dns_max_ttl` seconds. This way, a client can check whether its ip address has changed. * Allow reloading dns cached * Add documentation for dns_cached
1 parent 3601130 commit 7dfbd99

File tree

10 files changed

+794
-3
lines changed

10 files changed

+794
-3
lines changed

CONFIG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,22 @@ default: "admin_pass"
188188

189189
Password to access the virtual administrative database
190190

191+
### dns_cache_enabled
192+
```
193+
path: general.dns_cache_enabled
194+
default: false
195+
```
196+
When enabled, ip resolutions for server connections specified using hostnames will be cached
197+
and checked for changes every `dns_max_ttl` seconds. If a change in the host resolution is found
198+
old ip connections are closed (gracefully) and new connections will start using new ip.
199+
200+
### dns_max_ttl
201+
```
202+
path: general.dns_max_ttl
203+
default: 30
204+
```
205+
Specifies how often (in seconds) cached ip addresses for servers are rechecked (see `dns_cache_enabled`).
206+
191207
## `pools.<pool_name>` Section
192208

193209
### pool_mode

0 commit comments

Comments
 (0)