安装解压版activemq(版本太高,java不支持)

发布时间 2023-09-28 13:57:45作者: 摩斯

1、上传压缩包 apache-activemq-5.16.5-bin.tar.gz 到/usr/local目录

2、解压 tar -xzvf apache-activemq-5.16.5-bin.tar.gz

3、测试启动,进入/usr/local/apache-activemq-5.16.5/bin目录,启动 ./activemq start

4、测试访问activemq,访问http://localhost:8161/admin

5、修改网页登录密码

1) 打开安装目录,进入conf目录,找到jetty.xml

<bean id="adminSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint">
        <property name="name" value="BASIC" />
        <property name="roles" value="admin" />
         <!-- set authenticate=false to disable login -->
        <property name="authenticate" value="true" />
</bean>
View Code

上边的 authenticate 修改成true

2) 然后打开同目录下的jetty-realm.properties

# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename ...]
admin: admin, admin
user: user, user
View Code

用户名:密码,角色; 根据这个修改即可。修改完成后,重新启动,使用新的账号和密码即可登录成功。

6、设置开机自启动,如果服务启动后又停止,可能是端口被占用,查看5672端口占用情况,也有可能是mq版本太高,java不支持,导致启动失败

1) 软链接ln -s /usr/local/activemq/bin/activemq /etc/init.d/activemq

2) 进入目录cd /etc/init.d/

3) 编辑vim activemq

4) 在第二行添加

# chkconfig: 345 63 37

# description: Auto start ActiveMQ

5) 在最后一个#后添加export JAVA_HOME=/usr/local/java/jdk1.8

6) chmod +x activemq

7) 添加启动项chkconfig --add activemq

8) 查看启动项chkconfig --list 显示activemq服务则成功

9) 命令

10) service activemq start

11) service activemq status

12) service activemq stop

7、开机自启动失败的话,到/usr/local/activemq/bin目录启动,./activemq start