Merge pull request #3233 from xiang90/srv_discovery

better dns discovery error and doc
This commit is contained in:
Xiang Li 2015-08-06 14:35:22 -07:00
commit 7314310aed
2 changed files with 9 additions and 0 deletions

View File

@ -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. 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 \ $ etcd -name infra0 \
-discovery-srv example.com \ -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 $ 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 # 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. 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.

View File

@ -422,6 +422,9 @@ func getPeerURLsMapAndToken(cfg *config) (urlsmap types.URLsMap, token string, e
return nil, "", err return nil, "", err
} }
urlsmap, err = types.NewURLsMap(clusterStr) 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: default:
// We're statically configured, and cluster has appropriately been set. // We're statically configured, and cluster has appropriately been set.
urlsmap, err = types.NewURLsMap(cfg.initialCluster) urlsmap, err = types.NewURLsMap(cfg.initialCluster)