From 7c60e6aa00cfb12fab9b149e3e5fd4845985e845 Mon Sep 17 00:00:00 2001 From: "zhenshan.cao" Date: Fri, 27 Aug 2021 10:13:57 +0800 Subject: [PATCH] Avoid port conflicts between embedded etcd and external etcd (#7320) Signed-off-by: zhenshan.cao --- configs/advanced/etcd.yaml | 12 ++++++------ internal/kv/etcd/embed_etcd_kv_test.go | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/configs/advanced/etcd.yaml b/configs/advanced/etcd.yaml index f7d905341b..dbe33bcce2 100644 --- a/configs/advanced/etcd.yaml +++ b/configs/advanced/etcd.yaml @@ -33,10 +33,10 @@ election-timeout: 1000 quota-backend-bytes: 0 # List of comma separated URLs to listen on for peer traffic. -listen-peer-urls: http://localhost:2380 +listen-peer-urls: http://localhost:2480 # List of comma separated URLs to listen on for client traffic. -listen-client-urls: http://localhost:2379 +listen-client-urls: http://localhost:2479 # Maximum number of snapshot files to retain (0 is unlimited). max-snapshots: 5 @@ -49,11 +49,11 @@ cors: # List of this member's peer URLs to advertise to the rest of the cluster. # The URLs needed to be a comma-separated list. -initial-advertise-peer-urls: http://localhost:2380 +initial-advertise-peer-urls: http://localhost:2480 # List of this member's client URLs to advertise to the public. # The URLs needed to be a comma-separated list. -advertise-client-urls: http://localhost:2379 +advertise-client-urls: http://localhost:2479 # Discovery URL used to bootstrap the cluster. discovery: @@ -68,7 +68,7 @@ discovery-proxy: discovery-srv: # Initial cluster configuration for bootstrapping. -initial-cluster: +initial-cluster: default=http://localhost:2480 # Initial cluster token for the etcd cluster during bootstrap. initial-cluster-token: 'etcd-cluster' @@ -147,4 +147,4 @@ log-outputs: [stderr] force-new-cluster: false auto-compaction-mode: periodic -auto-compaction-retention: "1" \ No newline at end of file +auto-compaction-retention: "1" diff --git a/internal/kv/etcd/embed_etcd_kv_test.go b/internal/kv/etcd/embed_etcd_kv_test.go index 7950582994..91df72380b 100644 --- a/internal/kv/etcd/embed_etcd_kv_test.go +++ b/internal/kv/etcd/embed_etcd_kv_test.go @@ -27,6 +27,7 @@ func TestEmbedEtcd(te *testing.T) { param := new(paramtable.BaseParamTable) param.Init() param.BaseTable.Save("etcd.use.embed", "true") + param.BaseTable.Save("etcd.config.path", "../../../configs/advanced/etcd.yaml") param.BaseTable.Save("etcd.data.dir", "etcd.test.data.dir") param.LoadCfgToMemory() //clean up data