Giriş
Şu satırı dahil ederiz
import com.hazelcast.config.cp.CPSubsystemConfig;
setGroupSize metodu
Açıklaması şöyle
When the CP subsystem starts, it internally creates 2 consensus groups. We call these groups CP groups. Each CP group runs the Raft consensus algorithm to elect a leader node and commit operations. The first CP group is the Metadata CP group that manages CP members and CP groups created for data structures. The second CP group is the Default CP group. When you do not specify a CP group name while fetching a CP data structure proxy, the proxy internally talks to the Default CP group.
Şöyle yaparız
Config config = ... config.getCPSubsystemConfig().setCPMemberCount(5); config.getCPSubsystemConfig().setGroupSize(3);
Açıklaması şöyle
Here, we configure the CP group size and CP member count parameters separately. What we do is, we form the CP subsystem with 5 CP members. However, CP groups will be created with 3 CP members. It means that when a CP group is created, its members will be randomly selected among all CP members available in the CP subsystem. With this method, you can improve throughput by running multiple instances of the Raft consensus algorithm via CP groups and having multiple Raft leaders. This approach is basically partitioning (sharding) and you decide how partitions will be created.
setCPMemberCount
Açıklaması şöyle
The current set of CP data structures (IAtomicLong, IAtomicReference, ICountDownLatch, ISemaphore, FencedLock) have relatively small memory footprints. Therefore, all members of your Hazelcast IMDG cluster do not have to be CP members. It is perfectly fine to configure only 3 or 5 CP members in a 100-member Hazelcast cluster. All members of a cluster have access to the CP Subsystem APIs.
Örnek
Şöyle yaparız
Config config = ... config.getCPSubsystemConfig().setCPMemberCount(3);
setPersistenceEnabled metodu
Örnek
Şöyle yaparız
config.getCPSubsystemConfig().setPersistenceEnabled(true);
Hiç yorum yok:
Yorum Gönder