From 203e0f178b0f89df1ceacdc9f0b8b98a88c0fbd6 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 6 Aug 2015 11:38:53 -0700 Subject: [PATCH 1/2] etcdmian: better error for srv discovery failure --- etcdmain/etcd.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etcdmain/etcd.go b/etcdmain/etcd.go index 7ed33167c..a9017d122 100644 --- a/etcdmain/etcd.go +++ b/etcdmain/etcd.go @@ -403,6 +403,9 @@ func getPeerURLsMapAndToken(cfg *config) (urlsmap types.URLsMap, token string, e return nil, "", err } urlsmap, err = types.NewURLsMap(clusterStr) + if _, ok := urlsmap[cfg.name]; !ok { + return nil, "", fmt.Errorf("cannot find local etcd member %q in SRV records", cfg.name) + } default: // We're statically configured, and cluster has appropriately been set. urlsmap, err = types.NewURLsMap(cfg.initialCluster) From e9f05e8959523601a08d819a781cf6913314cf23 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 6 Aug 2015 11:39:14 -0700 Subject: [PATCH 2/2] doc: explain srv error --- Documentation/clustering.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/clustering.md b/Documentation/clustering.md index f928b3d8b..caf81290a 100644 --- a/Documentation/clustering.md +++ b/Documentation/clustering.md @@ -300,6 +300,8 @@ infra2.example.com. 300 IN A 10.0.1.12 etcd cluster members can listen on domain names or IP address, the bootstrap process will resolve DNS A records. +The resolved address in `-initial-advertise-peer-urls` *must match* one of the resolved addresses in the SRV targets. The etcd member reads the resolved address to find out if it belongs to the cluster defined in the SRV records. + ``` $ etcd -name infra0 \ -discovery-srv example.com \ @@ -376,6 +378,10 @@ DNS SRV records can also be used to configure the list of peers for an etcd serv $ etcd --proxy on -discovery-srv example.com ``` +#### Error Cases + +You might see the an error like `cannot find local etcd $name from SRV records.`. That means the etcd member fails to find itself from the cluster defined in SRV records. The resolved address in `-initial-advertise-peer-urls` *must match* one of the resolved addresses in the SRV targets. + # 0.4 to 2.0+ Migration Guide In etcd 2.0 we introduced the ability to listen on more than one address and to advertise multiple addresses. This makes using etcd easier when you have complex networking, such as private and public networks on various cloud providers.