gpt4 book ai didi

consul - 更改默认的 consul http 端口

转载 作者:行者123 更新时间:2023-12-01 15:49:57 28 4
gpt4 key购买 nike

我需要更改默认的 http 端口,因为另一个应用程序已经在使用 8500。

此命令有效:

领事信息-http-addr=http://127.0.0.1:18500

我无法弄清楚这等于配置文件中的什么配置设置。

这是我当前的设置:

datacenter = "test_test"
data_dir = "/opt/consul"
encrypt = "**********"
performance {
raft_multiplier = 1
}
ports {
http = 18500
dns = 18600
server = 18300
}
addresses {
http = "127.0.0.1"
}
retry_join = ["10.60.0.5"]`

运行 join 或 info 命令时的错误消息:

查询代理时出错:Get http://127.0.0.1:8500/v1/agent/self: dial tcp 127.0.0.1:8500: connect: connection refused

最佳答案

如果您使用:

{
"ports": {
"http": 18500
}
}

默认情况下 consul 将绑定(bind)到本地主机:

==> Log data will now stream in as it occurs:

2019/02/19 17:28:23 [INFO] raft: Initial configuration (index=1): [{Suffrage:Voter ID:4887467c-c84b-15b4-66f7-ad3f822631e0 Address:172.17.0.2:8300}]
2019/02/19 17:28:23 [INFO] raft: Node at 172.17.0.2:8300 [Follower] entering Follower state (Leader: "")
2019/02/19 17:28:23 [INFO] serf: EventMemberJoin: b884fe85d115.dc1 172.17.0.2
2019/02/19 17:28:23 [INFO] serf: EventMemberJoin: b884fe85d115 172.17.0.2
2019/02/19 17:28:24 [INFO] consul: Adding LAN server b884fe85d115 (Addr: tcp/172.17.0.2:8300) (DC: dc1)
2019/02/19 17:28:24 [INFO] consul: Handled member-join event for server "b884fe85d115.dc1" in area "wan"
2019/02/19 17:28:24 [WARN] agent/proxy: running as root, will not start managed proxies
2019/02/19 17:28:24 [INFO] agent: Started DNS server 127.0.0.1:8600 (tcp)
2019/02/19 17:28:24 [INFO] agent: Started DNS server 127.0.0.1:8600 (udp)
2019/02/19 17:28:24 [INFO] agent: Started HTTP server on 127.0.0.1:18500 (tcp)

显然,来自其他节点的任何人都无法连接到您的引导服务器。

你应该配置地址和端口:

{
"addresses": {
"http": "0.0.0.0"
},
"ports": {
"http": 18500
}
}

现在您可以看到任何 IP 0.0.0.0/0 的绑定(bind)

==> Log data will now stream in as it occurs:

2019/02/19 17:35:11 [INFO] raft: Initial configuration (index=1): [{Suffrage:Voter ID:ef42f35f-7505-d1fc-3f91-16f144d91fc6 Address:172.17.0.2:8300}]
2019/02/19 17:35:11 [INFO] raft: Node at 172.17.0.2:8300 [Follower] entering Follower state (Leader: "")
2019/02/19 17:35:11 [INFO] serf: EventMemberJoin: ac34230483e0.dc1 172.17.0.2
2019/02/19 17:35:11 [INFO] serf: EventMemberJoin: ac34230483e0 172.17.0.2
2019/02/19 17:35:11 [INFO] agent: Started DNS server 127.0.0.1:8600 (udp)
2019/02/19 17:35:11 [WARN] agent/proxy: running as root, will not start managed proxies
2019/02/19 17:35:11 [INFO] consul: Adding LAN server ac34230483e0 (Addr: tcp/172.17.0.2:8300) (DC: dc1)
2019/02/19 17:35:11 [INFO] agent: Started DNS server 127.0.0.1:8600 (tcp)
2019/02/19 17:35:11 [INFO] consul: Handled member-join event for server "ac34230483e0.dc1" in area "wan"
2019/02/19 17:35:11 [INFO] agent: Started HTTP server on [::]:18500 (tcp)

关于consul - 更改默认的 consul http 端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54599838/

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