diff --git a/CHANGELOG.md b/CHANGELOG.md index 4caeec7..eb3636f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v0.10.0 - unreleased + +- Add support for discovering hosts using DNS `SRV` records. #133 #131 +- Add support for reading DNS configuration from system `/etc/resolv.conf` + files. #134 +- Use a shorter TTL for entries written via `mc bench`. #130 + ## v0.9.0 - 2024-02-12 - Change host selection in `mtop` to allow more host tabs than fit on the diff --git a/README.md b/README.md index 0c92bb6..4a172cd 100644 --- a/README.md +++ b/README.md @@ -116,10 +116,12 @@ mtop cache01.example.com:11211 cache02.example.com:11211 cache03.example.com:112 ### Connecting to multiple servers with a single DNS name -In this example, a DNS lookup for `memcached.local` returns three DNS `A` records. +#### A or AAAA + +In this example, a DNS `A` lookup for `memcached.local` returns three DNS `A` records. ``` -dig memcached.local +dig -t A memcached.local ;; QUESTION SECTION: ;memcached.local. IN A @@ -129,10 +131,36 @@ memcached.local. 0 IN A 127.0.0.2 memcached.local. 0 IN A 127.0.0.1 ``` +`mtop` will connect to all three servers: `127.0.0.1`, `127.0.0.2`, and `127.0.0.3`. + ``` mtop dns+memcached.local:11211 ``` +#### SRV + +In this example, a DNS `SRV` lookup for `_memcached._tcp.example.com` returns three DNS `SRV` records. + +``` +dig -t SRV _memcached._tcp.example.com +;; QUESTION SECTION: +;_memcached._tcp.example.com. IN SRV + +;; ANSWER SECTION: +_memcached._tcp.example.com. 300 IN SRV 100 100 11211 memcached01.example.com. +_memcached._tcp.example.com. 300 IN SRV 100 100 11211 memcached02.example.com. +_memcached._tcp.example.com. 300 IN SRV 100 100 11211 memcached03.example.com. +``` + +`mtop` will connect to all three servers, resolving their names to `A` or `AAAA` records +when connections are established: `memcached01.example.com.`, `memcached02.example.com.`, +and `memcached03.example.com.`. Note that the port number from the `SRV` records are ignored, +only the port from the command line argument is used. + +``` +mtop dnssrv+_memcached._tcp.example.com:11211 +``` + ### Connecting to a port-forwarded Kubernetes pod ``` diff --git a/mtop-client/src/dns/mod.rs b/mtop-client/src/dns/mod.rs index e1d4d3a..1f48ed3 100644 --- a/mtop-client/src/dns/mod.rs +++ b/mtop-client/src/dns/mod.rs @@ -13,4 +13,4 @@ pub use crate::dns::rdata::{ RecordData, RecordDataA, RecordDataAAAA, RecordDataCNAME, RecordDataNS, RecordDataSOA, RecordDataSRV, RecordDataTXT, RecordDataUnknown, }; -pub use resolv::{config, ResolvConf, ResolvConfOptions}; +pub use crate::dns::resolv::{config, ResolvConf, ResolvConfOptions};