我需要更改默认的http端口,因为另一个应用程序已经在使用8500。
此命令有效:
consul info -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"]`
运行加入或信息命令时出现错误消息:
Error querying agent: Get http://127.0.0.1:8500/v1/agent/self: dial tcp 127.0.0.1:8500: connect: connection refused
答案 0 :(得分:1)
如果您使用:
{
"ports": {
"http": 18500
}
}
然后默认情况下,领事将绑定到本地主机:
==> 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的绑定
==> 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)