activecollab / etcd

PHP client for etcd, a distributed configuration system
https://labs.activecollab.com
MIT License
13 stars 6 forks source link

Add a class implementing DNS Discovery #5

Open legoktm opened 7 years ago

legoktm commented 7 years ago

etcd supports using SRV records to help clients discover the etcd cluster: https://coreos.com/etcd/docs/latest/v2/clustering.html#dns-discovery.

This implements a basic class to get a list of servers in the cluster, and a helper function to pick one in accordance with RFC 2782.

I tried to follow the existing code style, but might have missed something. We are currently evaluating and planning to use etcd for configuring parts of MediaWiki on Wikimedia wikis, and one of our requirements is being able to discover individual etcd servers using the DNS discovery. And while this doesn't need to be part of this library, I think it would make a nice addition.