gpt4 book ai didi

consul - 如何设置单节点 Consul 服务器/客户端?

转载 作者:行者123 更新时间:2023-12-05 03:58:27 25 4
gpt4 key购买 nike

实现这个需要什么配置?

可以使用此处提到的“开发模式”- https://learn.hashicorp.com/consul/getting-started/agent (但不推荐用于生产)。

我试过设置它,但我不确定如何设置客户端配置。我试过的配置是:

{
"data_dir": "/tmp2/consul-client",
"log_level": "INFO",
"server": false,
"node_name": "master",
"addresses": {
"https": "127.0.0.1"
},
"bind_addr": "127.0.0.1"
}

这导致失败:

consul agent -config-file=client.json
==> Starting Consul agent...
==> Error starting agent: Failed to start Consul client: Failed to start lan serf: Failed to create memberlist: Could not set up network transport: failed to obtain an address: Failed to start TCP listener on "127.0.0.1" port 8301: listen tcp 127.0.0.1:8301: bind: address already in use

最佳答案

运行的 Consul 集群不需要“客户端”代理。

我必须通过将 bootstrap_expect 设置为 1(boostrap 进程的节点数)来设置此服务器/主服务器:

{
"retry_join" : ["127.0.0.1"],
"data_dir": "/tmp2/consul",
"log_level": "INFO",
"server": true,
"node_name": "master",
"addresses": {
"https": "127.0.0.1"
},
"bind_addr": "127.0.0.1",
"ui": true,
"bootstrap_expect": 1
}

关于consul - 如何设置单节点 Consul 服务器/客户端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57954526/

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