gpt4 book ai didi

etcd3 - 启动 etcd 失败 "bind: cannot assign requested address"

转载 作者:行者123 更新时间:2023-12-03 23:56:19 26 4
gpt4 key购买 nike

我将 etcd 作为 docker 容器运行,而 10.132.41.234 是我在其上运行 docker 容器的主机 IP,我收到这样的错误信息,我不知道它是否正确,我现在对 etcd 很熟悉,有人可以帮忙?谢谢!

2017-09-13 08:55:03.339612 I | etcdmain: etcd Version: 3.0.17
2017-09-13 08:55:03.339891 I | etcdmain: Git SHA: cc198e2
2017-09-13 08:55:03.339902 I | etcdmain: Go Version: go1.6.4
2017-09-13 08:55:03.339912 I | etcdmain: Go OS/Arch: linux/amd64
2017-09-13 08:55:03.339921 I | etcdmain: setting maximum number of CPUs to 2, total number of available CPUs is 2
2017-09-13 08:55:03.340059 I | etcdmain: peerTLS: cert = /etc/ssl/certs/server.pem, key = /etc/ssl/certs/server-key.pem, ca = , trusted-ca = /etc/ssl/certs/ca.pem, client-cert-auth = true
2017-09-13 08:55:03.342794 I | etcdmain: listening for peers on https://127.0.0.1:2380
2017-09-13 08:55:03.342844 I | etcdmain: clientTLS: cert = /etc/ssl/certs/server.pem, key = /etc/ssl/certs/server-key.pem, ca = , trusted-ca = /etc/ssl/certs/ca.pem, client-cert-auth = true
2017-09-13 08:55:03.345340 I | etcdmain: stopping listening for peers on https://127.0.0.1:2380
2017-09-13 08:55:03.345386 C | etcdmain: listen tcp 10.132.41.234:2379: bind: cannot assign requested address


docker run -d -v /opt/certs:/etc/ssl/certs -v /opt/etcd-data:/etcd-data -p 2380:2380 -p 2379:2379 \
--name etcd gcr.io/google_containers/etcd-amd64:3.0.17 \
/usr/local/bin/etcd \
--name etcd0 \
--data-dir=/etcd-data \
--advertise-client-urls https://10.132.41.234:2379,https://127.0.0.1:2379 \
--listen-client-urls https://10.132.41.234:2379,https://127.0.0.1:2379 \
--initial-advertise-peer-urls https://127.0.0.1:2380 \
--listen-peer-urls https://127.0.0.1:2380 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster etcd0=https://127.0.0.1:2380,etcd1=https://127.0.0.1:2380,etcd2=https://127.0.0.1:2380 \
--initial-cluster-state new \
--cert-file=/etc/ssl/certs/server.pem \
--key-file=/etc/ssl/certs/server-key.pem \
--peer-cert-file=/etc/ssl/certs/server.pem \
--peer-key-file=/etc/ssl/certs/server-key.pem \
--trusted-ca-file=/etc/ssl/certs/ca.pem \
--peer-trusted-ca-file=/etc/ssl/certs/ca.pem \
--peer-client-cert-auth=true \
--client-cert-auth=true

最佳答案

尝试绑定(bind)到服务器的 IP 时出现同样的错误。
我通过在 --listen-peer-urls 和 --listen-client-urls 中添加 0.0.0.0 解决了这个问题(虽然,不确定结果是什么):

docker run --net=host -d -p 2379:2379 \
-p 2380:2380 \
--restart=always \
--volume=${DATA_DIR}:/etcd-data \
--name etcd0 quay.io/coreos/etcd:${ETCD_VERSION} \
/usr/local/bin/etcd \
--data-dir=/etcd-data --name ${THIS_NAME} \
--initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://0.0.0.0:2380 \
--advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://0.0.0.0:2379** \
--initial-cluster ${CLUSTER} \
--initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN}


使用 curl 验证工作集群:

curl http://IP:2379/v2/members
{"members":[{"id":"d587abebd4bc78d","name":"etcd1","peerURLs":["http://IP:2380"],"clientURLs":["http://IP:2379"]},{"id":"17efb04cb71d981c","name":"etcd0","peerURLs":["http://IP:2380"],"clientURLs":["http://IP:2379"]},{"id":"3d50a0b6f7f6bda6","name":"etcd3","peerURLs":["http://IP:2380"],"clientURLs":["http://IP:2379"]}]}


Docker 命令直接来自 coreos etcd 网站:
https://coreos.com/etcd/docs/3.2.9/op-guide/container.html#docker

关于etcd3 - 启动 etcd 失败 "bind: cannot assign requested address",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46193229/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com