Przeglądaj źródła

*: scrub legacy ports from code and scripts

Anthony Romano 9 lat temu
rodzic
commit
dcb3b7aecf

+ 1 - 1
Dockerfile

@@ -1,2 +1,2 @@
 FROM golang:onbuild
-EXPOSE 4001 7001 2379 2380
+EXPOSE 2379 2380

+ 4 - 4
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: 

+ 2 - 2
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

+ 5 - 5
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 }

+ 5 - 5
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 ''

+ 1 - 1
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 {

+ 1 - 1
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 {

+ 2 - 2
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 )
 

+ 4 - 4
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

+ 4 - 4
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
 

+ 0 - 2
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
 

+ 1 - 1
scripts/build-docker

@@ -12,7 +12,7 @@ cat <<DF > ${IMAGEDIR}/Dockerfile
 FROM scratch
 ADD etcd /
 ADD etcdctl /
-EXPOSE 4001 7001 2379 2380
+EXPOSE 2379 2380
 ENTRYPOINT ["/etcd"]
 DF
 

+ 1 - 1
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 <K> sniffed paths
 ```

+ 1 - 1
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")