Skip to content

Support SRV discovery #57

Description

@kylev

The etcd clustering guide specifies a discovery mechanism via SRV records. This would allow a client to discover a cluster via domain alone, allowing for centralized listing and distributed discovery.

Proposed design would accept a :domain option to the client constructor. in its presence, the :host and :port would be ignored and DNS would be used to determine those options.

I currently use a factory method like this to generate a client:

require 'resolv'
require 'etcd'

def by_domain(domain)
  srv_query = "_etcd-client._tcp.#{domain}"
  srv_records = Resolv::DNS.new.getresources(srv_query, Resolv::DNS::Resource::IN::SRV)
  chosen = srv_records.sample
  Etcd.client(host: chosen.target, port: chosen.port)
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions