Search code examples
javaspring-bootdockermacoshazelcast

Hazelcast: client is shutdown, when I start Hazelcast container on Mac


I have docker-compose.yml file:

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

And I have 2 computers: 1 with ubuntu, 1 with MacOs on arm.

  1. After starting Hazelcast container in MacOs, the log:

    ########################################
    # 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

    Then, I try to run my Spring-Boot app.

    Log:

    hz.client_1 [dev] [3.12.12] HazelcastClient 3.12.12 (20210209 - 35096ec) is SHUTTING_DOWN
    hz.client_1 [dev] [3.12.12] Could not connect to any cluster, shutting down the client: Giving up retrying to connect to cluster since client is shutdown.
    hz.client_1 [dev] [3.12.12] HazelcastClient 3.12.12 (20210209 - 35096ec) is SHUTDOWN

2 When I starting Hazelcast container on Ubuntu, its log

########################################
# 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

And Spring-Boot app starts successfully.

Why does the same project doesn't work proper on MacOs?

Why postrgres works correctly?

How can I fix problem with Hazelcast?


Solution

  • I used Hazelcast:3.12.2 and it doesn’t work in docker on Mac m* chips. Newer versions such 4.* and 5* of Hazelcast don’t work with Hazelcast client 3.* versions. But 3.12.12 Hazelcast version which also doesn’t not optimised for arm, works properly.