Wildfly:Singleton Deployment on Cluster |选择服务器组中的两台服务器



这种情况并非总是发生,而是多次发生。

  • 服务器组的3个集群
  • 野蝇16

从UI部署.war。它在一台服务器上选择良好::

2020-02-26 07:21:12,951 INFO  [org.wildfly.clustering.server] (LegacyDistributedSingletonService - 1) WFLYCLSV0003: alp-esb-app02:servicedesk-02 elected as the singleton provider of the jboss.deployment.unit."Now-1.11-SNAPSHOT.war".installer service
2020-02-26 07:21:13,115 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 26) WFLYSRV0010: Deployed "Now-1.11-SNAPSHOT.war" (runtime-name : "Now-1.11-SNAPSHOT.war")
2020-02-26 07:21:14,133 INFO  [org.wildfly.clustering.server] (LegacyDistributedSingletonService - 1) WFLYCLSV0001: This node will now operate as the singleton provider of the jboss.deployment.unit."Now-1.11-SNAPSHOT.war".installer service

但我禁用renable或下次部署:它在两个服务器中显示相同的日志。

有一个调度程序运行两次,导致数据库出现重复。

需要重新部署和重新部署,并检查日志是否正常,即只选择了一台服务器。

项目结构:

webapp->Meta INF->singleton-deployment.xml

<?xml version="1.0" encoding="UTF-8"?>
<singleton-deployment xmlns="urn:jboss:singleton-deployment:1.0"/>

调度器启动方式:

@Startup
@Singleton
@AccessTimeout(value = 30, unit = TimeUnit.MINUTES)
public class SnowPollerNew {

任何关于为什么它运行良好但多次运行不好的建议。

它与JGroups有关联吗?还是两个集群之间的通信?

您需要确保服务器正确构建集群。我还记得单身人士选举的一些问题(WFLY-11619(。我想这在WildFly 18是不可复制的。

最新更新