gpt4 book ai didi

docker - Hazelcast无法连接到Hazelcast-mancenter

转载 作者:行者123 更新时间:2023-12-02 20:40:42 24 4
gpt4 key购买 nike

我编写了以下docker-compose.yml以使用Mancenter构建Hazelcast的运行Docker实例。

version: "3"
services:
hazelcast:
image: hazelcast/hazelcast:3.12.9
container_name: hazelcast
restart: unless-stopped
environment:
MAX_HEAP_SIZE: "512m"
MIN_HEAP_SIZE: "512m"
JAVA_OPTS: "-Dhazelcast.rest.enabled=true
-Dhazelcast.mancenter.enabled=true
-Dhazelcast.mancenter.url=http://localhost:8080/hazelcast-mancenter"
ports:
- "5701:5701"
networks:
- default

hazelcast-management:
image: hazelcast/management-center:3.12.9
container_name: hazelcast-management
restart: unless-stopped
ports:
- "8080:8080"
networks:
- default

networks:
default:
driver: bridge
即使我使用“127.0.0.1”或我的IP而不是本地主机,日志也始终显示以下错误。我正在使用相同的版本:hc和hc-mancenter。
hazelcast               | Sep 23, 2020 11:38:35 AM com.hazelcast.internal.management.ManagementCenterService
hazelcast | INFO: [192.168.160.3]:5701 [dev] [3.12.9] Failed to pull tasks from Management Center
hazelcast | Sep 23, 2020 11:38:35 AM com.hazelcast.internal.management.ManagementCenterService
hazelcast | INFO: [192.168.160.3]:5701 [dev] [3.12.9] Failed to connect to: http://localhost:8080/hazelcast-mancenter/collector.do
问候,唐

最佳答案

docker-compose中的服务位于同一“docker网络”上,并且可以通过服务名称访问。当您使用localhost或127.0.0.1时,容器尝试与其“自己的” localhost进行通信。因此,您应该连接到Dhazelcast.mancenter.url=http://localhost:8080而不是Dhazelcast.mancenter.url=http://hazelcast-management:8080。 hazelcast服务的容器应具有一个主机条目,该主机条目将名称hazelcast-management指向正确的容器ip。

关于docker - Hazelcast无法连接到Hazelcast-mancenter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64027489/

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