ActiveMQ的多个实例开始引起问题

时间:2018-06-20 06:57:49

标签: activemq

当我尝试启动ActiveMQ时,它会为我提供一个包含新pid和新pidfile的过程。那么旧的pid和旧的pidfile会发生什么。另外,偶尔会说实例处于活动状态。我正在使用Mac OS X。

amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/Cellar/activemq/5.15.4/libexec//data/activemq.pid' (pid '12637')
amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/Cellar/activemq/5.15.4/libexec//data/activemq.pid' (pid '12730')
amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/Cellar/activemq/5.15.4/libexec//data/activemq.pid' (pid '12815')
amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Process with pid '12815' is already running
amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/Cellar/activemq/5.15.4/libexec//data/activemq.pid' (pid '12982')

1 个答案:

答案 0 :(得分:1)

如果您多次运行activemq start,它将启动多个JVM来运行代理。但是,由于您没有指定任何唯一的代理配置,因此每个实例将使用conf/activemq.xml中相同的默认代理配置。这通常意味着每个代理实例都将争夺默认KahaDB存储上的锁定。 只有一个实例将获得该存储上的锁并完全启动(主代理),其他实例将继续竞争该锁(从属代理)。

这种运行多个代理的方法出于测试目的可能是可行的,但不应在任何实际环境中进行,因为每个实例还写入同一日志文件。 对于真正的主/从部署,通常在多个不同的服务器/ VM上运行代理,它们通常通过已安装的网络驱动器共享相同的持久性存储。

希望有帮助。 托斯滕