apache / apache/couchdb

Query DNS to automatically discover cluster peers

Open
#1,108 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

We can streamline cluster setup by querying DNS for an SRV record containing the hostnames of other cluster members. Service records are defined in [RFC 2782](https://www.ietf.org/rfc/rfc2782.txt) for this purpose but this is not a strictly academic exercise. As a practical example Kubernetes will create SRV records for members of a StatefulSet. I created a sidecar container that uses those SRV records to automatically join up the members of a StatefulSet here:

https://github.com/kocolosk/couchdb-statefulset-assembler

I think it would be interesting to push that logic down into mem3 directly. I'm envisioning a system that can be configured like so

```
[mem3]
use_dns_service_discovery = true
service_record_name = _couchdb._tcp.example.net
```

If a user omits the `service_record_name` CouchDB would attempt to generate the appropriate record for the query by prepending `_couchdb._tcp.` to the DNS domain name portion of the host / VM / container FQDN.

Contributor guide

Open the contributing guide

Research direction

Start with mem3's cluster-discovery and configuration paths, then review RFC 2782 and the linked StatefulSet assembler for the expected SRV-record behavior. Define how use_dns_service_discovery and service_record_name should work, including generated names, and verify that cluster members can be discovered and joined through DNS.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
databases, distributed-systems, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.