返回总目录页

docker flannel网络

部署etcd

github部署访问链接:https://github.com/etcd-io/etcd/releases/

ETCD_VER=v3.5.1

# choose either URL
GOOGLE_URL=https://storage.googleapis.com/etcd
GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
DOWNLOAD_URL=${GOOGLE_URL}

rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test

curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz

/tmp/etcd-download-test/etcd --version
/tmp/etcd-download-test/etcdctl version
/tmp/etcd-download-test/etcdutl version




[root@mcw4 ~]$ ETCD_VER=v3.5.1
[root@mcw4 ~]$ 
[root@mcw4 ~]$ # choose either URL
[root@mcw4 ~]$ GOOGLE_URL=https://storage.googleapis.com/etcd
[root@mcw4 ~]$ GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
[root@mcw4 ~]$ DOWNLOAD_URL=${GOOGLE_URL}
[root@mcw4 ~]$ 
[root@mcw4 ~]$ rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
dir -p /tmp/etcd-download-test

curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1
rm -f /tmp[root@mcw4 ~]$ rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test
[root@mcw4 ~]$ 
[root@mcw4 ~]$ curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
/etcd-${ETCD_VER}-linux-amd64.tar.gz

/tmp/etcd-download-test/etcd --version
/tmp/etcd-download-test/etcdctl version
/tmp/etcd-download-test/etcdutl version  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 18.5M  100 18.5M    0     0  1798k      0  0:00:10  0:00:10 --:--:-- 3705k
[root@mcw4 ~]$ tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1
etcd-v3.5.1-linux-amd64/Documentation/
etcd-v3.5.1-linux-amd64/Documentation/dev-guide/
etcd-v3.5.1-linux-amd64/Documentation/dev-guide/apispec/
etcd-v3.5.1-linux-amd64/Documentation/dev-guide/apispec/swagger/
etcd-v3.5.1-linux-amd64/Documentation/dev-guide/apispec/swagger/v3lock.swagger.json
etcd-v3.5.1-linux-amd64/Documentation/dev-guide/apispec/swagger/v3election.swagger.json
etcd-v3.5.1-linux-amd64/Documentation/dev-guide/apispec/swagger/rpc.swagger.json
etcd-v3.5.1-linux-amd64/Documentation/README.md
etcd-v3.5.1-linux-amd64/README-etcdutl.md
etcd-v3.5.1-linux-amd64/READMEv2-etcdctl.md
etcd-v3.5.1-linux-amd64/README-etcdctl.md
etcd-v3.5.1-linux-amd64/README.md
etcd-v3.5.1-linux-amd64/etcdutl
etcd-v3.5.1-linux-amd64/etcdctl
etcd-v3.5.1-linux-amd64/etcd
[root@mcw4 ~]$ rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
[root@mcw4 ~]$ 
[root@mcw4 ~]$ /tmp/etcd-download-test/etcd --version
etcd Version: 3.5.1
Git SHA: e8732fb5f
Go Version: go1.16.3
Go OS/Arch: linux/amd64
[root@mcw4 ~]$ /tmp/etcd-download-test/etcdctl version
etcdctl version: 3.5.1
API version: 3.5
[root@mcw4 ~]$ /tmp/etcd-download-test/etcdutl version
etcdutl version: 3.5.1
API version: 3.5

启动etcd并打开2379端口
[root@mcw4 ~]$ etcd -listen-client-urls http://10.0.0.134:2379 -advertise-client-urls http://10.0.0.134:2379
{"level":"info","ts":"2022-01-02T22:34:03.141+0800","caller":"etcdmain/etcd.go:72","msg":"Running: ","args":["etcd","-listen-client-urls","http://10.0.0.134:2379","-advertise-client-urls","http://10.0.0.134:2379"]}
{"level":"warn","ts":"2022-01-02T22:34:03.141+0800","caller":"etcdmain/etcd.go:104","msg":"'data-dir' was empty; using default","data-dir":"default.etcd"}
{"level":"info","ts":"2022-01-02T22:34:03.141+0800","caller":"embed/etcd.go:131","msg":"configuring peer listeners","listen-peer-urls":["http://localhost:2380"]}
{"level":"info","ts":"2022-01-02T22:34:03.141+0800","caller":"embed/etcd.go:139","msg":"configuring client listeners","listen-client-urls":["http://10.0.0.134:2379"]}

 测试etcd能用

[root@mcw4 ~]$ etcdctl  --endpoints=10.0.0.134:2379 put name "mcw"
OK
[root@mcw4 ~]$ etcdctl  --endpoints=10.0.0.134:2379 get name 
name
mcw

ETCDCTL_API=3 etcdctl --cacert=/etc/etcd/certs/ca.pem --key=/etc/etcd/certs/ca-key.pem --cert=/etc/etcd/certs/ca.pem --write-out=table --endpoints="https://10.xx.101:2379,https://10.xx.101:2379,xx" member list
xx endpoint health
xx member remove a275b4b74688c563

 

posted @ 2022-01-02 22:46  马昌伟  阅读(56)  评论(0编辑  收藏  举报
博主链接地址:https://www.cnblogs.com/machangwei-8/