SpringBoot Admin中的Hazelcast可通过Docker Swarm运行2个实例

问题描述

我是SpringBoot Admin,HazelCast和Docker Swarm的新手... 我想做的是在Docker Swarm中运行2个SpringBoot Admin Server实例。 一个实例工作正常。我拥有SBA的所有功能,并且运作良好。 如果我将副本数设置为“ 2”,并且在群集中添加了以下内容,则登录页面将无法正常工作(它显示但我无法登录,控制台中没有错误):

mode: replicated
      replicas: 2
      update_config:
        parallelism: 1
        delay: 60s
        failure_action: rollback
        order: start-first
        monitor: 60s
      rollback_config:
        parallelism: 1
        delay: 60s
        failure_action: pause
        order: start-first
        monitor: 60s
      restart_policy:
        condition: any
        delay: 60s
        max_attempts: 3
        window: 3600s

我当前的HazelCast配置如下(在SpringBoot管理文档中指定):

@Bean
    public Config hazelcast() {
        // This map is used to store the events.
        // It should be configured to reliably hold all the data,// Spring Boot Admin will compact the events,if there are too many
        MapConfig eventStoreMap = new MapConfig(DEFAULT_NAME_EVENT_STORE_MAP).setInMemoryFormat(InMemoryFormat.OBJECT)
                .setBackupCount(1).setEvictionPolicy(EvictionPolicy.NONE)
                .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(),100));

        // This map is used to deduplicate the notifications.
        // If data in this map gets lost it should not be a big issue as it will atmost
        // lead to
        // the same notification to be sent by multiple instances
        MapConfig sentNotificationsMap = new MapConfig(DEFAULT_NAME_SENT_NOTIFICATIONS_MAP)
                .setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(1).setEvictionPolicy(EvictionPolicy.LRU)
                .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(),100));

        Config config = new Config();
        config.addMapConfig(eventStoreMap);
        config.addMapConfig(sentNotificationsMap);
        config.setProperty("hazelcast.jmx","true");

        // WARNING: This setups a local cluster,you change it to fit your needs.
        config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(true);
        TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig();
        tcpIpConfig.setEnabled(true);

//        NetworkConfig network = config.getNetworkConfig();
//        InterfacesConfig interfaceConfig = network.getInterfaces();
//        interfaceConfig.setEnabled( true )
//                .addInterface( "192.168.1.3" );
//        tcpIpConfig.setMembers(singletonList("127.0.0.1"));
        return config;

    }
```

I guess these inputs are not enough for you to properly help,but since I don't really weel understand the way HazelCast is workging,I don't really know what is useful or not. So please don't hesitate to ask me for what is needed to help! :)

Do you guys have any idea of what I'm doing wrong?

Many thanks!

解决方法

组播在默认覆盖驱动程序中的Docker Swarm中不起作用(至少表示为here)。 我试图使其与编织网络插件一起运行,但没有运气。 就我而言,将Hazelcast切换到TCP模式并提供我要搜索其他副本的网络就足够了。

类似的东西:

<div>
  <input type="checkbox" id="egg" name="egg" onchange="updateResult(this);">
  <label for="egg">Egg</label>
</div>
<div id="make"></div>

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...