我已经写了下面的docker-compose.yml来构建一个运行Docker-Instance的Hazelcast和Mancenter。
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而不是localhost。我使用相同的版本: 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致敬,Dom
发布于 2020-09-23 20:06:25
docker-compose中的服务位于相同的"docker网络“上,并且可以通过服务名称访问。当您使用localhost或127.0.0.1时,容器会尝试与其“自己的”localhost通信。因此,您应该连接到Dhazelcast.mancenter.url=http://hazelcast-management:8080,而不是Dhazelcast.mancenter.url=http://localhost:8080。hazelcast服务的容器应该有一个主机条目,该条目将名称hazelcast-management指向正确的容器ip。
https://stackoverflow.com/questions/64027489
复制相似问题