From dcb3b7aecfa11e408258f5c8e68dd8005d7b5eba Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 11 May 2016 11:15:50 -0700 Subject: [PATCH] *: scrub legacy ports from code and scripts --- Dockerfile | 2 +- etcd.conf.yml.sample | 8 ++++---- etcdctl/ctlv3/command/snapshot_command.go | 4 ++-- etcdmain/config.go | 10 +++++----- etcdmain/help.go | 10 +++++----- etcdserver/raft.go | 2 +- etcdserver/raft_test.go | 2 +- hack/benchmark/bench.sh | 4 ++-- hack/insta-discovery/Procfile | 8 ++++---- hack/tls-setup/Procfile | 8 ++++---- scripts/build-aci | 2 -- scripts/build-docker | 2 +- tools/etcd-top/README.md | 2 +- tools/etcd-top/etcd-top.go | 2 +- 14 files changed, 32 insertions(+), 34 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c648eaa3..000e6067c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,2 @@ FROM golang:onbuild -EXPOSE 4001 7001 2379 2380 +EXPOSE 2379 2380 diff --git a/etcd.conf.yml.sample b/etcd.conf.yml.sample index 4f520d010..d3da5bba9 100644 --- a/etcd.conf.yml.sample +++ b/etcd.conf.yml.sample @@ -23,10 +23,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,http://localhost:7001 +listen-peer-urls: http://localhost:2380 # List of comma separated URLs to listen on for client traffic. -listen-client-urls: http://localhost:2379,http://localhost:4001 +listen-client-urls: http://localhost:2379 # Maximum number of snapshot files to retain (0 is unlimited). max-snapshots: 5 @@ -39,11 +39,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,http://localhost:7001 +initial-advertise-peer-urls: http://localhost:2380 # 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,http://localhost:4001 +advertise-client-urls: http://localhost:2379 # Discovery URL used to bootstrap the cluster. discovery: diff --git a/etcdctl/ctlv3/command/snapshot_command.go b/etcdctl/ctlv3/command/snapshot_command.go index e9d3ce863..12708a980 100644 --- a/etcdctl/ctlv3/command/snapshot_command.go +++ b/etcdctl/ctlv3/command/snapshot_command.go @@ -41,7 +41,7 @@ import ( const ( defaultName = "default" - defaultInitialAdvertisePeerURLs = "http://localhost:2380,http://localhost:7001" + defaultInitialAdvertisePeerURLs = "http://localhost:2380" ) var ( @@ -191,7 +191,7 @@ func initialClusterFromName(name string) string { if name == "" { n = defaultName } - return fmt.Sprintf("%s=http://localhost:2380,%s=http://localhost:7001", n, n) + return fmt.Sprintf("%s=http://localhost:2380", n, n) } // makeWAL creates a WAL for the initial cluster diff --git a/etcdmain/config.go b/etcdmain/config.go index 63028798a..78fa4acc9 100644 --- a/etcdmain/config.go +++ b/etcdmain/config.go @@ -46,10 +46,10 @@ const ( clusterStateFlagExisting = "existing" defaultName = "default" - defaultInitialAdvertisePeerURLs = "http://localhost:2380,http://localhost:7001" - defaultAdvertiseClientURLs = "http://localhost:2379,http://localhost:4001" - defaultListenPeerURLs = "http://localhost:2380,http://localhost:7001" - defaultListenClientURLs = "http://localhost:2379,http://localhost:4001" + defaultInitialAdvertisePeerURLs = "http://localhost:2380" + defaultAdvertiseClientURLs = "http://localhost:2379" + defaultListenPeerURLs = "http://localhost:2380" + defaultListenClientURLs = "http://localhost:2379" // maxElectionMs specifies the maximum value of election timeout. // More details are listed in ../Documentation/tuning.md#time-parameters. @@ -471,7 +471,7 @@ func initialClusterFromName(name string) string { if name == "" { n = defaultName } - return fmt.Sprintf("%s=http://localhost:2380,%s=http://localhost:7001", n, n) + return fmt.Sprintf("%s=http://localhost:2380", n) } func (cfg config) isNewCluster() bool { return cfg.clusterState.String() == clusterStateFlagNew } diff --git a/etcdmain/help.go b/etcdmain/help.go index 75437b37d..92c4fbd14 100644 --- a/etcdmain/help.go +++ b/etcdmain/help.go @@ -44,9 +44,9 @@ member flags: time (in milliseconds) of a heartbeat interval. --election-timeout '1000' time (in milliseconds) for an election to timeout. See tuning documentation for details. - --listen-peer-urls 'http://localhost:2380,http://localhost:7001' + --listen-peer-urls 'http://localhost:2380' list of URLs to listen on for peer traffic. - --listen-client-urls 'http://localhost:2379,http://localhost:4001' + --listen-client-urls 'http://localhost:2379' list of URLs to listen on for client traffic. --max-snapshots '` + strconv.Itoa(defaultMaxSnapshots) + `' maximum number of snapshot files to retain (0 is unlimited). @@ -59,16 +59,16 @@ member flags: clustering flags: - --initial-advertise-peer-urls 'http://localhost:2380,http://localhost:7001' + --initial-advertise-peer-urls 'http://localhost:2380' list of this member's peer URLs to advertise to the rest of the cluster. - --initial-cluster 'default=http://localhost:2380,default=http://localhost:7001' + --initial-cluster 'default=http://localhost:2380' initial cluster configuration for bootstrapping. --initial-cluster-state 'new' initial cluster state ('new' or 'existing'). --initial-cluster-token 'etcd-cluster' initial cluster token for the etcd cluster during bootstrap. Specifying this can protect you from unintended cross-cluster interaction when running multiple clusters. - --advertise-client-urls 'http://localhost:2379,http://localhost:4001' + --advertise-client-urls 'http://localhost:2379' list of this member's client URLs to advertise to the public. The client URLs advertised should be accessible to machines that talk to etcd cluster. etcd client libraries parse these URLs to connect to the cluster. --discovery '' diff --git a/etcdserver/raft.go b/etcdserver/raft.go index 1a9590b21..b3722dd17 100644 --- a/etcdserver/raft.go +++ b/etcdserver/raft.go @@ -484,7 +484,7 @@ func createConfigChangeEnts(ids []uint64, self uint64, term, index uint64) []raf if !found { m := membership.Member{ ID: types.ID(self), - RaftAttributes: membership.RaftAttributes{PeerURLs: []string{"http://localhost:7001", "http://localhost:2380"}}, + RaftAttributes: membership.RaftAttributes{PeerURLs: []string{"http://localhost:2380"}}, } ctx, err := json.Marshal(m) if err != nil { diff --git a/etcdserver/raft_test.go b/etcdserver/raft_test.go index 3bf3eb7d9..4470c0846 100644 --- a/etcdserver/raft_test.go +++ b/etcdserver/raft_test.go @@ -74,7 +74,7 @@ func TestGetIDs(t *testing.T) { func TestCreateConfigChangeEnts(t *testing.T) { m := membership.Member{ ID: types.ID(1), - RaftAttributes: membership.RaftAttributes{PeerURLs: []string{"http://localhost:7001", "http://localhost:2380"}}, + RaftAttributes: membership.RaftAttributes{PeerURLs: []string{"http://localhost:2380"}}, } ctx, err := json.Marshal(m) if err != nil { diff --git a/hack/benchmark/bench.sh b/hack/benchmark/bench.sh index d660824a9..f2f09ae81 100644 --- a/hack/benchmark/bench.sh +++ b/hack/benchmark/bench.sh @@ -1,8 +1,8 @@ #!/bin/bash -e -leader=http://10.240.201.15:4001 +leader=http://10.240.201.15:2379 # assume three servers -servers=( http://10.240.201.15:4001 http://10.240.212.209:4001 http://10.240.95.3:4001 ) +servers=( http://10.240.201.15:2379 http://10.240.212.209:2379 http://10.240.95.3:2379 ) keyarray=( 64 256 ) diff --git a/hack/insta-discovery/Procfile b/hack/insta-discovery/Procfile index 1fb4b6c5a..b35eb4501 100644 --- a/hack/insta-discovery/Procfile +++ b/hack/insta-discovery/Procfile @@ -1,6 +1,6 @@ # Use goreman to run `go get github.com/mattn/goreman` # One of the four etcd members falls back to a proxy -etcd1: ../../bin/etcd --name infra1 --listen-client-urls http://127.0.0.1:4001 --advertise-client-urls http://127.0.0.1:4001 --listen-peer-urls http://127.0.0.1:7001 --initial-advertise-peer-urls http://127.0.0.1:7001 -etcd2: ../../bin/etcd --name infra2 --listen-client-urls http://127.0.0.1:4002 --advertise-client-urls http://127.0.0.1:4002 --listen-peer-urls http://127.0.0.1:7002 --initial-advertise-peer-urls http://127.0.0.1:7002 -etcd3: ../../bin/etcd --name infra3 --listen-client-urls http://127.0.0.1:4003 --advertise-client-urls http://127.0.0.1:4003 --listen-peer-urls http://127.0.0.1:7003 --initial-advertise-peer-urls http://127.0.0.1:7003 -etcd4: ../../bin/etcd --name infra4 --listen-client-urls http://127.0.0.1:4004 --advertise-client-urls http://127.0.0.1:4004 --listen-peer-urls http://127.0.0.1:7004 --initial-advertise-peer-urls http://127.0.0.1:7004 +etcd1: ../../bin/etcd --name infra1 --listen-client-urls http://127.0.0.1:2379 --advertise-client-urls http://127.0.0.1:2379 --listen-peer-urls http://127.0.0.1:2380 --initial-advertise-peer-urls http://127.0.0.1:2380 +etcd2: ../../bin/etcd --name infra2 --listen-client-urls http://127.0.0.1:12379 --advertise-client-urls http://127.0.0.1:12379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 +etcd3: ../../bin/etcd --name infra3 --listen-client-urls http://127.0.0.1:22379 --advertise-client-urls http://127.0.0.1:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls http://127.0.0.1:22380 +etcd4: ../../bin/etcd --name infra4 --listen-client-urls http://127.0.0.1:32379 --advertise-client-urls http://127.0.0.1:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls http://127.0.0.1:32380 diff --git a/hack/tls-setup/Procfile b/hack/tls-setup/Procfile index 828d0086f..f3532ca8b 100644 --- a/hack/tls-setup/Procfile +++ b/hack/tls-setup/Procfile @@ -1,9 +1,9 @@ # Use goreman to run `go get github.com/mattn/goreman` -etcd1: ../../bin/etcd --name infra1 --listen-client-urls https://localhost:4001 --advertise-client-urls https://localhost:4001 --listen-peer-urls https://localhost:7001 --initial-advertise-peer-urls https://localhost:7001 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=https://localhost:7001,infra2=https://localhost:7002,infra3=https://localhost:7003' --initial-cluster-state new --cert-file=certs/etcd1.pem --key-file=certs/etcd1-key.pem --peer-cert-file=certs/etcd1.pem --peer-key-file=certs/etcd1-key.pem --peer-client-cert-auth --peer-trusted-ca-file=certs/ca.pem +etcd1: ../../bin/etcd --name infra1 --listen-client-urls https://localhost:2379 --advertise-client-urls https://localhost:2379 --listen-peer-urls https://localhost:2380 --initial-advertise-peer-urls https://localhost:2380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=https://localhost:2380,infra2=https://localhost:12380,infra3=https://localhost:22380' --initial-cluster-state new --cert-file=certs/etcd1.pem --key-file=certs/etcd1-key.pem --peer-cert-file=certs/etcd1.pem --peer-key-file=certs/etcd1-key.pem --peer-client-cert-auth --peer-trusted-ca-file=certs/ca.pem -etcd2: ../../bin/etcd --name infra2 --listen-client-urls https://localhost:4002 --advertise-client-urls https://localhost:4002 --listen-peer-urls https://localhost:7002 --initial-advertise-peer-urls https://localhost:7002 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=https://localhost:7001,infra2=https://localhost:7002,infra3=https://localhost:7003' --initial-cluster-state new --cert-file=certs/etcd2.pem --key-file=certs/etcd2-key.pem --peer-cert-file=certs/etcd2.pem --peer-key-file=certs/etcd2-key.pem --peer-client-cert-auth --peer-trusted-ca-file=certs/ca.pem +etcd2: ../../bin/etcd --name infra2 --listen-client-urls https://localhost:12379 --advertise-client-urls https://localhost:12379 --listen-peer-urls https://localhost:12380 --initial-advertise-peer-urls https://localhost:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=https://localhost:2380,infra2=https://localhost:12380,infra3=https://localhost:22380' --initial-cluster-state new --cert-file=certs/etcd2.pem --key-file=certs/etcd2-key.pem --peer-cert-file=certs/etcd2.pem --peer-key-file=certs/etcd2-key.pem --peer-client-cert-auth --peer-trusted-ca-file=certs/ca.pem -etcd3: ../../bin/etcd --name infra3 --listen-client-urls https://localhost:4003 --advertise-client-urls https://localhost:4003 --listen-peer-urls https://localhost:7003 --initial-advertise-peer-urls https://localhost:7003 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=https://localhost:7001,infra2=https://localhost:7002,infra3=https://localhost:7003' --initial-cluster-state new --cert-file=certs/etcd3.pem --key-file=certs/etcd3-key.pem --peer-cert-file=certs/etcd3.pem --peer-key-file=certs/etcd3-key.pem --peer-client-cert-auth --peer-trusted-ca-file=certs/ca.pem +etcd3: ../../bin/etcd --name infra3 --listen-client-urls https://localhost:22379 --advertise-client-urls https://localhost:22379 --listen-peer-urls https://localhost:22380 --initial-advertise-peer-urls https://localhost:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=https://localhost:2380,infra2=https://localhost:12380,infra3=https://localhost:22380' --initial-cluster-state new --cert-file=certs/etcd3.pem --key-file=certs/etcd3-key.pem --peer-cert-file=certs/etcd3.pem --peer-key-file=certs/etcd3-key.pem --peer-client-cert-auth --peer-trusted-ca-file=certs/ca.pem -proxy: ../../bin/etcd --name proxy1 --proxy=on --listen-client-urls https://localhost:8080 --initial-cluster 'infra1=https://localhost:7001,infra2=https://localhost:7002,infra3=https://localhost:7003' --cert-file=certs/proxy1.pem --key-file=certs/proxy1-key.pem --trusted-ca-file=certs/ca.pem --peer-cert-file=certs/proxy1.pem --peer-key-file=certs/proxy1-key.pem --peer-client-cert-auth --peer-trusted-ca-file=certs/ca.pem +proxy: ../../bin/etcd --name proxy1 --proxy=on --listen-client-urls https://localhost:8080 --initial-cluster 'infra1=https://localhost:2380,infra2=https://localhost:12380,infra3=https://localhost:22380' --cert-file=certs/proxy1.pem --key-file=certs/proxy1-key.pem --trusted-ca-file=certs/ca.pem --peer-cert-file=certs/proxy1.pem --peer-key-file=certs/proxy1-key.pem --peer-client-cert-auth --peer-trusted-ca-file=certs/ca.pem diff --git a/scripts/build-aci b/scripts/build-aci index ef1109441..6affd4fcd 100755 --- a/scripts/build-aci +++ b/scripts/build-aci @@ -56,8 +56,6 @@ acbuild --debug set-exec -- /etcd acbuild --debug mount add data-dir /data-dir -acbuild --debug port add legacy-client tcp 4001 -acbuild --debug port add legacy-peer tcp 7001 acbuild --debug port add client tcp 2379 acbuild --debug port add peer tcp 2380 diff --git a/scripts/build-docker b/scripts/build-docker index 26d49889b..6b67d1917 100755 --- a/scripts/build-docker +++ b/scripts/build-docker @@ -12,7 +12,7 @@ cat < ${IMAGEDIR}/Dockerfile FROM scratch ADD etcd / ADD etcdctl / -EXPOSE 4001 7001 2379 2380 +EXPOSE 2379 2380 ENTRYPOINT ["/etcd"] DF diff --git a/tools/etcd-top/README.md b/tools/etcd-top/README.md index a50047b7e..794f3062f 100644 --- a/tools/etcd-top/README.md +++ b/tools/etcd-top/README.md @@ -5,7 +5,7 @@ usage: ``` -iface="eth0": interface for sniffing traffic on -period=1: seconds between submissions - -ports="2379,4001": etcd listening ports + -ports="2379": etcd listening ports -promiscuous=true: whether to perform promiscuous sniffing or not. -topk=10: submit stats for the top sniffed paths ``` diff --git a/tools/etcd-top/etcd-top.go b/tools/etcd-top/etcd-top.go index 00f2eb30a..acf0158bc 100644 --- a/tools/etcd-top/etcd-top.go +++ b/tools/etcd-top/etcd-top.go @@ -146,7 +146,7 @@ func streamRouter(ports []uint16, parsedPackets chan *pcap.Packet, processors [] // 4. open the pcap handler // 5. hand off packets from the handler to the decoder func main() { - portsArg := flag.String("ports", "2379,4001", "etcd listening ports") + portsArg := flag.String("ports", "2379", "etcd listening ports") iface := flag.String("iface", "eth0", "interface for sniffing traffic on") promisc := flag.Bool("promiscuous", true, "promiscuous mode") period := flag.Uint("period", 1, "seconds between submissions")