HazelcastException:CP 子系统未启用

问题描述 投票:0回答:1

在从 3.12.13 版本迁移到 5.1.6 版本时遇到问题,如果有人知道如何解决此问题,请告诉我。

import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.cp.ISemaphore;

public class HazelcastSemaphore implements MetaSemaphore {

    private HazelcastInstance hazelcastInstance;

    public boolean init(int permits) {

        if(semaphore == null){
            hz1.getCPSubsystem().getSemaphore(id);
            semaphore.init(permits);
        }
        return true;
    }
}

面临错误

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.services.config.ConfigService]: Factory method 'configService' threw exception; nested exception is com.hazelcast.core.HazelcastException: CP Subsystem is not enabled!

spring-boot hazelcast hazelcast-cloud
1个回答
0
投票

您必须启用 CP 子系统。

XML 示例

<hazelcast>
  <cp-subsystem>
   <!-- set cp-member-count with value 0 to run in unsafe mode -->
    <cp-member-count>3</cp-member-count>
    <!-- configuration options here -->
  </cp-subsystem>
</hazelcast>

在这里阅读更多内容: https://docs.hazelcast.com/hazelcast/5.3/cp-subsystem/configuration

© www.soinside.com 2019 - 2024. All rights reserved.