docker Hazelcast:当我在Mac上启动Hazelcast容器时,客户端关闭

rta7y2nd  于 2023-04-05  发布在  Docker
关注(0)|答案(1)|浏览(143)

我有docker-compose.yml文件:

version: "2"
services:
  postgres:
    image: postgres:12.4
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=password
    ports:
      - 5432:5432
  hazelcast:
    image: hazelcast/hazelcast:3.11
    ports:
      - 5701:5701
    environment:
      - JAVA_OPTS=-Dhazelcast.local.publicAddress=localhost:5701

我有两台电脑:1个带ubuntu,1个带MacOs
1.在MacOs中启动Hazelcast容器后,日志:

########################################

JAVA_OPTS=-Djava.net.preferIPv4Stack=true -Dhazelcast.local.publicAddress=localhost:5701

CLASSPATH=/opt/hazelcast:/opt/hazelcast/*

#从现在开始...
########################################

  • exec java -server -Djava.net.preferIPv4Stack=true -Dhazelcast.local.publicAddress=localhost:5701 com.hazelcast.core.server.StartServer
    然后,我尝试运行我的Spring-Boot应用程序。
    日志:
    hz.client_1 [dev] [3.12.12] HazelcastClient 3.12.12(20210209 - 35096ec)is SHUTING_DOWN
    hz.client_1 [dev] [3.12.12]无法连接到任何群集,正在关闭客户端:由于客户端关闭,放弃重试连接群集。
    hz.client_1 [dev] [3.12.12] HazelcastClient 3.12.12(20210209 - 35096 ec)已关闭
    2在Ubuntu上启动Hazelcast容器时,其日志
########################################
# JAVA_OPTS=-Djava.net.preferIPv4Stack=true -Dhazelcast.local.publicAddress=localhost:5701
# CLASSPATH=/opt/hazelcast:/opt/hazelcast/*
# starting now....
########################################
+ exec java -server -Djava.net.preferIPv4Stack=true -Dhazelcast.local.publicAddress=localhost:5701 com.hazelcast.core.server.StartServer
Feb 23, 2023 12:41:45 PM com.hazelcast.config.XmlConfigLocator
INFO: Loading 'hazelcast-default.xml' from classpath.
Feb 23, 2023 12:41:45 PM com.hazelcast.instance.AddressPicker
INFO: [LOCAL] [dev] [3.11] Prefer IPv4 stack is true, prefer IPv6 addresses is false
Feb 23, 2023 12:41:45 PM com.hazelcast.instance.AddressPicker
INFO: [LOCAL] [dev] [3.11] Picked [172.22.0.2]:5701, using socket ServerSocket[addr=/0.0.0.0,localport=5701], bind any local is true
Feb 23, 2023 12:41:45 PM com.hazelcast.instance.AddressPicker
INFO: [LOCAL] [dev] [3.11] Using public address: [localhost]:5701
Feb 23, 2023 12:41:46 PM com.hazelcast.system
INFO: [localhost]:5701 [dev] [3.11] Hazelcast 3.11 (20181023 - 1500bbb) starting at [localhost]:5701
Feb 23, 2023 12:41:46 PM com.hazelcast.system
INFO: [localhost]:5701 [dev] [3.11] Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
Feb 23, 2023 12:41:46 PM com.hazelcast.instance.Node
INFO: [localhost]:5701 [dev] [3.11] A non-empty group password is configured for the Hazelcast member. Starting with Hazelcast version 3.8.2, members with the same group name, but with different group passwords (that do not use authentication) form a cluster. The group password configuration will be removed completely in a future release.
Feb 23, 2023 12:41:46 PM com.hazelcast.spi.impl.operationservice.impl.BackpressureRegulator
INFO: [localhost]:5701 [dev] [3.11] Backpressure is disabled
Feb 23, 2023 12:41:46 PM com.hazelcast.instance.Node
INFO: [localhost]:5701 [dev] [3.11] Creating MulticastJoiner
Feb 23, 2023 12:41:46 PM com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl
INFO: [localhost]:5701 [dev] [3.11] Starting 8 partition threads and 5 generic threads (1 dedicated for priority tasks)
Feb 23, 2023 12:41:46 PM com.hazelcast.internal.diagnostics.Diagnostics
INFO: [localhost]:5701 [dev] [3.11] Diagnostics disabled. To enable add -Dhazelcast.diagnostics.enabled=true to the JVM arguments.
Feb 23, 2023 12:41:46 PM com.hazelcast.core.LifecycleService
INFO: [localhost]:5701 [dev] [3.11] [localhost]:5701 is STARTING
Feb 23, 2023 12:41:49 PM com.hazelcast.internal.cluster.ClusterService
INFO: [localhost]:5701 [dev] [3.11] 

Members {size:1, ver:1} [
        Member [localhost]:5701 - 704a653c-7a09-4b9e-83cf-85b136c2e6d0 this
]

Feb 23, 2023 12:41:49 PM com.hazelcast.core.LifecycleService
INFO: [localhost]:5701 [dev] [3.11] [localhost]:5701 is STARTED

并且Spring-Boot应用启动成功。
为什么同一个项目在MacOS上无法正常工作?
为什么postrgres可以正常工作?
如何解决Hazelcast的问题?

kxxlusnw

kxxlusnw1#

我使用的是Hazelcast:3.12.2,它在Mac m* 芯片上的Docker中不工作。较新的版本,如4.* 和5* 的Hazelcast不适用于Hazelcast客户端3.* 版本。但是3.12.12 Hazelcast版本也没有针对arm进行优化,可以正常工作。

相关问题