From f3daa9f677e95f3048a22bd2346c6dcdee1cd79b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 14 Jan 2016 11:21:02 -0800 Subject: [PATCH] etcdmain: proxy should only lookup srv if there is no existing cluster file --- etcdmain/etcd.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/etcdmain/etcd.go b/etcdmain/etcd.go index 7ebf4a3c3..d76bf5998 100644 --- a/etcdmain/etcd.go +++ b/etcdmain/etcd.go @@ -342,11 +342,6 @@ func startEtcd(cfg *config) (<-chan struct{}, error) { // startProxy launches an HTTP proxy for client communication which proxies to other etcd nodes. func startProxy(cfg *config) error { - urlsmap, _, err := getPeerURLsMapAndToken(cfg, "proxy") - if err != nil { - return fmt.Errorf("error setting up initial cluster: %v", err) - } - pt, err := transport.NewTimeoutTransport(cfg.peerTLSInfo, time.Duration(cfg.proxyDialTimeoutMs)*time.Millisecond, time.Duration(cfg.proxyReadTimeoutMs)*time.Millisecond, time.Duration(cfg.proxyWriteTimeoutMs)*time.Millisecond) if err != nil { return err @@ -373,6 +368,9 @@ func startProxy(cfg *config) error { if cfg.durl != "" { plog.Warningf("discovery token ignored since the proxy has already been initialized. Valid cluster file found at %q", clusterfile) } + if cfg.dnsCluster != "" { + plog.Warningf("DNS SRV discovery ignored since the proxy has already been initialized. Valid cluster file found at %q", clusterfile) + } urls := struct{ PeerURLs []string }{} err = json.Unmarshal(b, &urls) if err != nil { @@ -381,6 +379,11 @@ func startProxy(cfg *config) error { peerURLs = urls.PeerURLs plog.Infof("proxy: using peer urls %v from cluster file %q", peerURLs, clusterfile) case os.IsNotExist(err): + urlsmap, _, err := getPeerURLsMapAndToken(cfg, "proxy") + if err != nil { + return fmt.Errorf("error setting up initial cluster: %v", err) + } + if cfg.durl != "" { s, err := discovery.GetCluster(cfg.durl, cfg.dproxy) if err != nil {