1:下载activemq安装包 https://archive.apache.org/dist/activemq/5.16.3/apache-activemq-5.16.3-bin.zip
2: 上传activemq安装到服务器指定目录进行 unzip apache-activemq-5.16.3-bin.zip 解压
3: 配置文件更改 ./apache-activemq-5.16.3/conf/activemq.xml
<shutdownHooks> <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" /> </shutdownHooks> <plugins> <simpleAuthenticationPlugin> <users> <authenticationUser username="mqtt_user" password="123456ytrewq" groups="users,admins"/> </users> </simpleAuthenticationPlugin> <timeStampingBrokerPlugin ttlCeiling="10000" zeroExpirationOverride="10000" /> <discardingDLQBrokerPlugin dropAll="true" dropTemporaryTopics="true" dropTemporaryQueues="true" /> </plugins>
4. 配置文件更改 ./apache-activemq-5.16.3/conf/jetty.xml
<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start"> <!-- the default port number for the web console --> <property name="host" value="0.0.0.0"/> <property name="port" value="8161"/>
</bean>
4: 修改运行权限设置
cd ./apache-activemq-5.16.3/bin chmod 755 activemq ./activemq
三种运行方式:
(1)普通启动 ./activemq start
(2)启动并指定日志文件 ./activemq start >tmp/smlog
(3)后台启动方式nohup ./activemq start >/tmp/smlog
前两种方式下在命令行窗口关闭时或者ctrl+c时导致进程退出,采用后台启动方式则可以避免这种情况
访问地址: http://IP:8161/ 页面登录: admin/admin
mqtt客户端:mqtt_user/123456ytrewq