3

I am new to in-memory data grid and Hazelcast. I was trying on the demo application on the offical website.

https://training.hazelcast.com/demo-getting-started-with-hazelcast-imdg/277088/scorm/f2u8hre5zf9p

It mentioned that on running the application for multiple times, it should add members to the the same cluster.

However, on running the program for second time, it seems new member is not added to the same cluster.

Would like to see if there is any possible problems with my setting, thanks.

Environment:
Eclipse IDE
JDK 13
hazelcast 3.12.2

1st run:

Oct 07, 2019 8:35:55 PM com.hazelcast.instance.HazelcastInstanceFactory
WARNING: Hazelcast is starting in a Java modular environment (Java 9 and newer) but without proper access to required Java packages. Use additional Java arguments to provide Hazelcast access to Java internal API. The internal API access is used to get the best performance results. Arguments to be used:
 --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
Oct 07, 2019 8:35:55 PM com.hazelcast.instance.AddressPicker
INFO: [LOCAL] [dev] [3.12.2] Prefer IPv4 stack is true, prefer IPv6 addresses is false
Oct 07, 2019 8:35:55 PM com.hazelcast.instance.AddressPicker
INFO: [LOCAL] [dev] [3.12.2] Picked [192.168.0.211]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
Oct 07, 2019 8:35:56 PM com.hazelcast.system
INFO: [192.168.0.211]:5701 [dev] [3.12.2] Hazelcast 3.12.2 (20190802 - e34b163) starting at [192.168.0.211]:5701
Oct 07, 2019 8:35:56 PM com.hazelcast.system
INFO: [192.168.0.211]:5701 [dev] [3.12.2] Copyright (c) 2008-2019, Hazelcast, Inc. All Rights Reserved.
Oct 07, 2019 8:35:56 PM com.hazelcast.spi.impl.operationservice.impl.BackpressureRegulator
INFO: [192.168.0.211]:5701 [dev] [3.12.2] Backpressure is disabled
Oct 07, 2019 8:35:56 PM com.hazelcast.instance.Node
INFO: [192.168.0.211]:5701 [dev] [3.12.2] Creating MulticastJoiner
Oct 07, 2019 8:35:56 PM com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl
INFO: [192.168.0.211]:5701 [dev] [3.12.2] Starting 16 partition threads and 9 generic threads (1 dedicated for priority tasks)
Oct 07, 2019 8:35:56 PM com.hazelcast.internal.diagnostics.Diagnostics
INFO: [192.168.0.211]:5701 [dev] [3.12.2] Diagnostics disabled. To enable add -Dhazelcast.diagnostics.enabled=true to the JVM arguments.
Oct 07, 2019 8:35:56 PM com.hazelcast.core.LifecycleService
INFO: [192.168.0.211]:5701 [dev] [3.12.2] [192.168.0.211]:5701 is STARTING
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.hazelcast.internal.networking.nio.SelectorOptimizer (file:/Users/patrick/.m2/repository/com/hazelcast/hazelcast/3.12.2/hazelcast-3.12.2.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of com.hazelcast.internal.networking.nio.SelectorOptimizer
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Oct 07, 2019 8:35:58 PM com.hazelcast.internal.cluster.ClusterService
INFO: [192.168.0.211]:5701 [dev] [3.12.2] 

Members {size:1, ver:1} [
    Member [192.168.0.211]:5701 - 5d8492ad-df09-46fc-8420-5d00784204d9 this
]

Oct 07, 2019 8:35:58 PM com.hazelcast.core.LifecycleService
INFO: [192.168.0.211]:5701 [dev] [3.12.2] [192.168.0.211]:5701 is STARTED
Oct 07, 2019 8:35:58 PM com.hazelcast.internal.partition.impl.PartitionStateManager
INFO: [192.168.0.211]:5701 [dev] [3.12.2] Initializing cluster partition table arrangement...
Customer with key 1: Joe
Map Size: 3
First customer: Tom
Second Customer: Mary
Queue size: 2

2nd run:

Oct 07, 2019 8:39:31 PM com.hazelcast.instance.HazelcastInstanceFactory
WARNING: Hazelcast is starting in a Java modular environment (Java 9 and newer) but without proper access to required Java packages. Use additional Java arguments to provide Hazelcast access to Java internal API. The internal API access is used to get the best performance results. Arguments to be used:
 --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
Oct 07, 2019 8:39:31 PM com.hazelcast.instance.AddressPicker
INFO: [LOCAL] [dev] [3.12.2] Prefer IPv4 stack is true, prefer IPv6 addresses is false
Oct 07, 2019 8:39:31 PM com.hazelcast.instance.AddressPicker
INFO: [LOCAL] [dev] [3.12.2] Picked [192.168.0.211]:5702, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5702], bind any local is true
Oct 07, 2019 8:39:31 PM com.hazelcast.system
INFO: [192.168.0.211]:5702 [dev] [3.12.2] Hazelcast 3.12.2 (20190802 - e34b163) starting at [192.168.0.211]:5702
Oct 07, 2019 8:39:31 PM com.hazelcast.system
INFO: [192.168.0.211]:5702 [dev] [3.12.2] Copyright (c) 2008-2019, Hazelcast, Inc. All Rights Reserved.
Oct 07, 2019 8:39:31 PM com.hazelcast.spi.impl.operationservice.impl.BackpressureRegulator
INFO: [192.168.0.211]:5702 [dev] [3.12.2] Backpressure is disabled
Oct 07, 2019 8:39:32 PM com.hazelcast.instance.Node
INFO: [192.168.0.211]:5702 [dev] [3.12.2] Creating MulticastJoiner
Oct 07, 2019 8:39:32 PM com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl
INFO: [192.168.0.211]:5702 [dev] [3.12.2] Starting 16 partition threads and 9 generic threads (1 dedicated for priority tasks)
Oct 07, 2019 8:39:32 PM com.hazelcast.internal.diagnostics.Diagnostics
INFO: [192.168.0.211]:5702 [dev] [3.12.2] Diagnostics disabled. To enable add -Dhazelcast.diagnostics.enabled=true to the JVM arguments.
Oct 07, 2019 8:39:32 PM com.hazelcast.core.LifecycleService
INFO: [192.168.0.211]:5702 [dev] [3.12.2] [192.168.0.211]:5702 is STARTING
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.hazelcast.internal.networking.nio.SelectorOptimizer (file:/Users/patrick/.m2/repository/com/hazelcast/hazelcast/3.12.2/hazelcast-3.12.2.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of com.hazelcast.internal.networking.nio.SelectorOptimizer
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Oct 07, 2019 8:39:34 PM com.hazelcast.internal.cluster.ClusterService
INFO: [192.168.0.211]:5702 [dev] [3.12.2] 

Members {size:1, ver:1} [
    Member [192.168.0.211]:5702 - 10c3d969-f060-4253-8260-5cfc3be87e0f this
]

Oct 07, 2019 8:39:34 PM com.hazelcast.instance.Node
WARNING: [192.168.0.211]:5702 [dev] [3.12.2] Config seed port is 5701 and cluster size is 1. Some of the ports seem occupied!
Oct 07, 2019 8:39:34 PM com.hazelcast.core.LifecycleService
INFO: [192.168.0.211]:5702 [dev] [3.12.2] [192.168.0.211]:5702 is STARTED
Oct 07, 2019 8:39:34 PM com.hazelcast.internal.partition.impl.PartitionStateManager
INFO: [192.168.0.211]:5702 [dev] [3.12.2] Initializing cluster partition table arrangement...
Customer with key 1: Joe
Map Size: 3
First customer: Tom
Second Customer: Mary
Queue size: 2



Patrick C.
  • 1,339
  • 3
  • 16
  • 31

4 Answers4

2

Make sure you have required options specified in your JVM:

--add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
Andrey Lebedenko
  • 1,850
  • 17
  • 24
0

Do you perhaps have virtualization software on your local environment installed? It's possible that hazelcast's default multicast address is in conflict. Try changing the address to: 224.0.0.1:

cfg.getNetworkConfig().getJoin().getMulticastConfig().setMulticastGroup("224.0.0.1");

Manuel David
  • 141
  • 3
0

(Update 8 Oct 2019)

Not quite sure what happened, but I was able to get the expected output showing after upgrading to MacOS Catalina. Not sure if it is related to the OS or not.

enter image description here

Oct 08, 2019 4:42:20 PM com.hazelcast.instance.HazelcastInstanceFactory
WARNING: Hazelcast is starting in a Java modular environment (Java 9 and newer) but without proper access to required Java packages. Use additional Java arguments to provide Hazelcast access to Java internal API. The internal API access is used to get the best performance results. Arguments to be used:
 --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
Oct 08, 2019 4:42:20 PM com.hazelcast.instance.AddressPicker
INFO: [LOCAL] [dev] [3.12.2] Prefer IPv4 stack is true, prefer IPv6 addresses is false
Oct 08, 2019 4:42:20 PM com.hazelcast.instance.AddressPicker
INFO: [LOCAL] [dev] [3.12.2] Picked [192.168.0.247]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
Oct 08, 2019 4:42:21 PM com.hazelcast.system
INFO: [192.168.0.247]:5701 [dev] [3.12.2] Hazelcast 3.12.2 (20190802 - e34b163) starting at [192.168.0.247]:5701
Oct 08, 2019 4:42:21 PM com.hazelcast.system
INFO: [192.168.0.247]:5701 [dev] [3.12.2] Copyright (c) 2008-2019, Hazelcast, Inc. All Rights Reserved.
Oct 08, 2019 4:42:21 PM com.hazelcast.spi.impl.operationservice.impl.BackpressureRegulator
INFO: [192.168.0.247]:5701 [dev] [3.12.2] Backpressure is disabled
Oct 08, 2019 4:42:21 PM com.hazelcast.instance.Node
INFO: [192.168.0.247]:5701 [dev] [3.12.2] Creating MulticastJoiner
Oct 08, 2019 4:42:21 PM com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl
INFO: [192.168.0.247]:5701 [dev] [3.12.2] Starting 16 partition threads and 9 generic threads (1 dedicated for priority tasks)
Oct 08, 2019 4:42:21 PM com.hazelcast.internal.diagnostics.Diagnostics
INFO: [192.168.0.247]:5701 [dev] [3.12.2] Diagnostics disabled. To enable add -Dhazelcast.diagnostics.enabled=true to the JVM arguments.
Oct 08, 2019 4:42:21 PM com.hazelcast.core.LifecycleService
INFO: [192.168.0.247]:5701 [dev] [3.12.2] [192.168.0.247]:5701 is STARTING
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.hazelcast.internal.networking.nio.SelectorOptimizer (file:/Users/patrick/.m2/repository/com/hazelcast/hazelcast/3.12.2/hazelcast-3.12.2.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of com.hazelcast.internal.networking.nio.SelectorOptimizer
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Oct 08, 2019 4:42:24 PM com.hazelcast.internal.cluster.ClusterService
INFO: [192.168.0.247]:5701 [dev] [3.12.2] 

Members {size:1, ver:1} [
    Member [192.168.0.247]:5701 - 1d3f21e8-0294-434a-84c2-cbf128286987 this
]

Oct 08, 2019 4:42:24 PM com.hazelcast.core.LifecycleService
INFO: [192.168.0.247]:5701 [dev] [3.12.2] [192.168.0.247]:5701 is STARTED
Oct 08, 2019 4:42:24 PM com.hazelcast.internal.partition.impl.PartitionStateManager
INFO: [192.168.0.247]:5701 [dev] [3.12.2] Initializing cluster partition table arrangement...
Customer with key 1: Joe
Map Size: 3
First customer: Tom
Second Customer: Mary
Queue size: 2
Oct 08, 2019 4:42:31 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [192.168.0.247]:5701 [dev] [3.12.2] Initialized new cluster connection between /192.168.0.247:5701 and /192.168.0.247:49798
Oct 08, 2019 4:42:37 PM com.hazelcast.internal.cluster.ClusterService
INFO: [192.168.0.247]:5701 [dev] [3.12.2] 

Members {size:2, ver:2} [
    Member [192.168.0.247]:5701 - 1d3f21e8-0294-434a-84c2-cbf128286987 this
    Member [192.168.0.247]:5702 - ccc3af03-5783-4808-b2c1-c709ea94f562
]

Oct 08, 2019 4:42:37 PM com.hazelcast.internal.partition.impl.MigrationManager
INFO: [192.168.0.247]:5701 [dev] [3.12.2] Re-partitioning cluster data... Migration queue size: 271
Oct 08, 2019 4:42:39 PM com.hazelcast.internal.partition.impl.MigrationThread
INFO: [192.168.0.247]:5701 [dev] [3.12.2] All migration tasks have been completed. (lastRepartitionTime=Tue Oct 08 16:42:37 HKT 2019, completedMigrations=271, totalCompletedMigrations=271, elapsedMigrationTime=602ms, totalElapsedMigrationTime=602ms)
Patrick C.
  • 1,339
  • 3
  • 16
  • 31
0

I know it's an old question but I just started to play with Hazelcast and ran into the same issue with IntelliJ and that demo. The way I solved it was to not use multicast on the local machine but to use tcp/ip via the loopback adapter, so I changed the first few lines to read:

    Config cfg = new Config();
    final TcpIpConfig tcpIpConfig = cfg.getNetworkConfig().getJoin().getTcpIpConfig();
    tcpIpConfig.setEnabled(true);
    tcpIpConfig.setMembers(List.of("127.0.0.1"));

After that change and starting 2 runs I got

Members {size:2, ver:2} [
    Member [127.0.0.1]:5701 - f5e2f023-4bb1-4d8f-b21d-fae2458fe79d
    Member [127.0.0.1]:5702 - f8a7618d-8682-4c86-8ca9-c6800570c427 this
]
siriousje
  • 41
  • 2