Jboss Wildfly:集群上的单例部署|在服务器组中选择两台服务器

Jboss Wildfly:集群上的单例部署|在服务器组中选择两台服务器,jboss,singleton,wildfly,wildfly-cluster,wildfly-16,Jboss,Singleton,Wildfly,Wildfly Cluster,Wildfly 16,这种情况并非总是发生,而是多次发生 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

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

  • 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或deploy:它在两个服务器中显示相同的日志

存在运行两次的调度程序,该调度程序使用重复项损坏数据库

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

项目结构:

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

<?xml version="1.0" encoding="UTF-8"?>
<singleton-deployment xmlns="urn:jboss:singleton-deployment:1.0"/>
任何建议,为什么它运行良好,但不运行良好多次


它是否链接到JGroups?或者两个集群之间的通信?

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

谢谢。请您详细说明“服务器正在正确构建集群”,因为其他服务器组都在这样运行。没有启用随机选举,但我希望这不是一个问题。为什么它多次运行良好,有时运行不正常,这实际上是个问题。
@Startup
@Singleton
@AccessTimeout(value = 30, unit = TimeUnit.MINUTES)
public class SnowPollerNew {