Groups
Groups

How to use AtomicLong on Hazelcast CP Subsystem with just 2 Hazelcast cluster nodes?

795 views
Skip to first unread message

Renato Rodrigues

unread,
May 2, 2019, 12:05:00 PM5/2/19
to Hazelcast

I am updating to latest Hazelcast version [3.12] and I am facing problem to obtain a instance of AtomicLong. The new version, HZ introduces the concept of CAP Theorem, to grant Consistency and Partition Tolerance, but he problem is the CP subsystem must have at least 3 members.

Config config = new Config();
config.getCPSubsystemConfig().setCPMemberCount(3);
config.getCPSubsystemConfig().setGroupSize(3);

HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config);

How can I configure the CP Subsystem to provides me an instance of atomicLong with just two hazelcast nodes?

If I start my application with just one node, the follow message is printed:

MetadataRaftGroupManager.log:65 [127.0.0.1]:6000 [dev] [3.12] CP Subsystem is waiting for 3 members to join the cluster. Current member count: 1

I will have just two nodes, so, the CP Subsystem doesn't allow me to use an atomicLong because it will waits for ever for at leats 3 nodes..

The version 3.11 I just called hazelcast.getAtomicLong("count"). How can I handle with this?

renato...@gmail.com

unread,
May 2, 2019, 12:53:01 PM5/2/19
to Hazelcast


0

ky...@hazelcast.com

unread,
May 2, 2019, 1:01:44 PM5/2/19
to Hazelcast
You set the CP member count to 3:

config.getCPSubsystemConfig().setCPMemberCount(3);

Do you still see the error if it is set to 2?

https://docs.hazelcast.org/docs/3.12/javadoc/com/hazelcast/config/cp/CPSubsystemConfig.html

Renato Rodrigues

unread,
May 2, 2019, 3:22:01 PM5/2/19
to haze...@googlegroups.com
Yes, if I set to 2 , there is a validation cheking if the count is lower than MIN_GROUP_SIZE.
Group size must be an odd value between 3 and 7.

So, i can't define with count equals 2. In fact, I guess I can't any more have an application with two nodes, if I needs an atomicLong 
provided by CP SubSystem.. There is no much sense..




Atenciosamente,

Renato Rodrigues Silva
Analista de Sistemas
Graduado em Tecnologia da Informação
Pós-graduado em Segurança em Redes


--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/6ecf2e4e-8ac3-4d7e-acee-88f2af07da7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ensar Basri Kahveci

unread,
May 2, 2019, 3:34:45 PM5/2/19
to Hazelcast
Hi Renato,

You need to keep the majority, i.e., more than half, of the CP members up and running to preserve availability of the CP Subsystem. If you run 3 CP members (majority=2), they will tolerate failure of 1 CP member. When a CP member crashes out of 3, you still need the majority running in order to remove that member and add a new CP member as a replacement. However, majority of 2 CP members is still 2, so running 2 CP members means that you don't have fault tolerance. That is why we require an odd number of CP members to run the CP Subsystem. 

In the next release, we will provide something like a development-mode to run the CP Subsystem with 1 or maybe 2 CP members. This mode will likely to have the full-functionality but it will not be fault-tolerant because of this majority requirement.

Thanks for trying out the new CP Subsystem! 

Regards,

To unsubscribe from this group and stop receiving emails from it, send an email to haze...@googlegroups.com.

yukti...@gmail.com

unread,
Aug 14, 2019, 4:01:42 AM8/14/19
to Hazelcast
Hello Renato,

You can configure more than one Hazelcast member on the same JVM.
You dont neccessarily need additional physical nodes.

Warm Regards,
Yukti.

yukti...@gmail.com

unread,
Aug 14, 2019, 4:01:42 AM8/14/19
to Hazelcast
Hi Ensar,

Has this feature been provided.If so, with which release?

Warm Regards,
Yukti

Deger

unread,
Aug 23, 2019, 10:34:09 AM8/23/19
to Hazelcast
Hi Yukti,

CP Subsystem was released with Hazelcast IMDG v3.12 on April 2019. See Hazelcast IMDG v3.12 Release Notes: https://docs.hazelcast.org/docs/rn/index.html#3-12

Regards,
Deger
Reply all
Reply to author
Forward
0 new messages
Search
Clear search
Close search
Google apps
Main menu