瀏覽代碼

etcdmain: fix that advertise-client-urls is required in proxy mode

etcd proxy doesn't need to set advertise-client-urls because the flag is
not used.
Yicheng Qin 10 年之前
父節點
當前提交
cf7c83b304
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      etcdmain/config.go

+ 6 - 2
etcdmain/config.go

@@ -269,8 +269,12 @@ func (cfg *config) Parse(arguments []string) error {
 	if err != nil {
 		return err
 	}
-	if flags.IsSet(cfg.FlagSet, "listen-client-urls") && !flags.IsSet(cfg.FlagSet, "advertise-client-urls") {
-		return errUnsetAdvertiseClientURLsFlag
+
+	// when etcd runs in member mode user needs to set -advertise-client-urls if -listen-client-urls is set.
+	if cfg.proxy.String() != proxyFlagOn {
+		if flags.IsSet(cfg.FlagSet, "listen-client-urls") && !flags.IsSet(cfg.FlagSet, "advertise-client-urls") {
+			return errUnsetAdvertiseClientURLsFlag
+		}
 	}
 
 	if 5*cfg.TickMs > cfg.ElectionMs {