如何解决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>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。