[TOC] ## 一、说明 - activemq最新版部署请遵循服务独立化原则,使用最新版activemq部署,此部署文档是基于5.14.3完成的; - activemq最新版本不再支持tomcat中集成,tomcat集成方式修改请参考:http://10.80.7.49:8181/api/deploy_/edit/ ## 二、activemq独立部署教程 ### 1、新版服务部署 > 按教程部署:https://blog.csdn.net/baokx/article/details/100745745 ### 2、端口配置 `activemq-web-console-5.14.3/WEB-INF/activemq.xml`中的配置,记住关键的端口配置信息。 ````xml <transportConnectors> <transportConnector name="openwire" uri="tcp://0.0.0.0:3061" enableStatusMonitor="true"/> <transportConnector name="stomp" uri="stomp://0.0.0.0:3062"/> </transportConnectors> ```` - 修改`conf/activemq.xml`中:transportConnectors中的`openwire`、`stomp`中的端口为原先端口。 ``` sed -i 's/0.0.0.0:61616/0.0.0.0:3061/g' activemq.xml sed -i 's/0.0.0.0:61613/0.0.0.0:3062/g' activemq.xml ``` ### 3、JDK1.8安装 - 升级时注意环境JDK版本为1.8以上。若系统环境非JDK1.8,activemq还可以指定JDK版本启动,需要在`activemq/bin/env`文件中修改JAVA_HOME的值。 否则启动会报错: ```shell [root@host-192-168-244-44 bin]# ./activemq start INFO: Loading '/data/apache-activemq-5.15.12//bin/env' INFO: Using java '/usr/local/java/bin/java' Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/activemq/console/Main : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Tasks provided by the sysv init script: kill - terminate instance in a drastic way by sending SIGKILL restart - stop running instance (if there is one), start new instance console - start broker in foreground, useful for debugging purposes status - check if activemq process is running ``` ### 4、服务启动 ```shell [root@host-192-168-244-44 bin]# ./activemq start INFO: Loading '/data/apache-activemq-5.15.12//bin/env' INFO: Using java '/usr/local/jdk1.8.0_77/bin/java' INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details INFO: pidfile created : '/data/apache-activemq-5.15.12//data/activemq.pid' (pid '11826') ``` 启动后,查看web-console。http://172.24.4.159:8161/admin/queues.jsp 验证已成功。 - 验证功能,升级成功! ![消息消费](http://dc.zjhcsoft.com:25680/mindoc/uploads/deploy_/images/m_1f86109634ebaacaf92399a1b3cd610b_r.png "消息消费")