【问题标题】:Hazelcast cluster not startingHazelcast 集群未启动
【发布时间】:2019-03-08 21:48:18
【问题描述】:

当我从多个端口启动时,我看不到添加到集群的成员。下面只是基本配置。每个似乎都有自己的端口。

@SpringBootApplication
@Configuration
public class HazelcastApplication {

    public static void main(String[] args) {
        SpringApplication.run(HazelcastApplication.class, args);
    }

    @Bean(destroyMethod = "shutdown")
    public HazelcastInstance createStorageNode() throws Exception {
        return Hazelcast.newHazelcastInstance();
    }
}



Members [1] {
        Member [169.254.137.152]:5702 this
}


Members [1] {
        Member [169.254.137.152]:5701 this
}

【问题讨论】:

    标签: hazelcast


    【解决方案1】:

    在运行多播时,您运行的机器上可能有多个网络接口。将上述方法修改为:

        @Bean(destroyMethod = "shutdown")
        public HazelcastInstance createStorageNode() throws Exception {
            Config config = new Config();
            JoinConfig joinConfig = config.getNetworkConfig().getJoin();
            joinConfig.getMulticastConfig().setEnabled(false);
            joinConfig.getTcpIpConfig().setEnabled(true)
                    .getMembers()
                    .add("127.0.0.1");
            //.add("169.254.137.152");  // or this
            Hazelcast.newHazelcastInstance(config);
    
        }
    
    

    【讨论】:

    • 怎么样?因为它是相同的本地环境,对吗?此外,如果您看到应用程序启动的端口,则 ip 是相同的
    • 我只是在这里猜测,所以需要更多信息。如果在 mac 上请运行“ifconfig -a”,如果在 windows 上运行“ipconfig /all”,在 linux 上运行“ip a”以列出您机器上的所有接口。
    • 如果您正在运行 virtual box 或 vmware fusion,请参考之前报告的以下问题:github.com/hazelcast/hazelcast/issues/11415
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-01-11
    • 2016-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-28
    • 2016-11-30
    相关资源
    最近更新 更多