Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SRV discovery #57

Open
kylev opened this issue May 17, 2016 · 0 comments
Open

Support SRV discovery #57

kylev opened this issue May 17, 2016 · 0 comments

Comments

@kylev
Copy link

kylev commented May 17, 2016

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant