启用 schedulerSupport 将 activemq 代理置于从属模式,等待获取锁

Enabling schedulerSupport is putting activemq broker in slave mode waiting for lock to be acquired

我计划在 activemq 中使用延迟,我指的是一些帖子,例如 this,其中人们提到 activemq.xml 中的以下更改以启用调度程序:

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" schedulerSupport="true">

所以,我在 activemq.xml 中做了完全相同的事情,结果如下:

C:\tan\my_softwares\apache-activemq-5.15.11\bin>activemq start
Java Runtime: Oracle Corporation 13.0.2 C:\Program Files\Java\jdk-13.0.2
  Heap sizes: current=1048576k  free=1042942k  max=1048576k
    JVM args: -Dcom.sun.management.jmxremote -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\conf\login.config -Dactivemq.classpath=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\conf;C:\tan\my_softwares\apache-activemq-5.15.11\bin\../conf;C:\tan\my_softwares\apache-activemq-5.15.11\bin\../conf; -Dactivemq.home=C:\tan\my_softwares\apache-activemq-5.15.11\bin\.. -Dactivemq.base=C:\tan\my_softwares\apache-activemq-5.15.11\bin\.. -Dactivemq.conf=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\conf -Dactivemq.data=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data -Djava.io.tmpdir=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data\tmp
Extensions classpath:
  [C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib,C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib\camel,C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib\optional,C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib\web,C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib\extra]
ACTIVEMQ_HOME: C:\tan\my_softwares\apache-activemq-5.15.11\bin\..
ACTIVEMQ_BASE: C:\tan\my_softwares\apache-activemq-5.15.11\bin\..
ACTIVEMQ_CONF: C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\conf
ACTIVEMQ_DATA: C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data
Loading message broker from: xbean:activemq.xml
 INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory@1cbbffcd: startup date [Thu Jun 25 07:35:22 CDT 2020]; root of context hierarchy
 INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data\kahadb]
 INFO | KahaDB is version 6
 INFO | PListStore:[C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data \localhost\tmp_storage] started
 INFO | Database C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data \localhost\scheduler\lock is locked by another server. This broker is now in slave mode waiting a lock to be acquired

在此之后,我无法访问 ActiveMQ 的 Web 控制台并且 http://localhost:8161/admin/index.jsp 结果为 Unable to connect。但是,如果我放回没有 schedulerSupport 的原始配置,一切正常,我可以访问 Web 控制台:

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">

如何解决这个问题?

调度器使用它自己的自定义 KahaDB 存储来管理预定的消息,它正在使用的文件夹似乎锁定了它用来确保只有一个代理实例写入该存储的文件。您需要调查是否有另一个代理实例访问该存储位置,然后停止它或更新配置以使用不同的位置。您也可以检查文件夹权限等。您也可以手动删除该文件夹中的所有文件,以确保删除旧的锁定文件。

即日志明确指出问题所在的目录。

INFO | Database C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data \localhost\scheduler\lock is locked by another server. This broker is now in slave mode waiting a lock to be acquired