【Linux】之搭建 ActiveMQ 环境

淡淡的烟草味﹌ 2023-02-26 03:29 86阅读 0赞

使用 wget 命令下载压缩包(下载的版本为:apache-activemq-5.15.9-bin.tar.gz):

  1. wget http://archive.apache.org/dist/activemq/5.15.9/apache-activemq-5.15.9-bin.tar.gz

解压缩并复制到 /usr/local/ 目录下

  1. tar -zxvf apache-activemq-5.15.9-bin.tar.gz
  2. cp apache-activemq-5.15.9 /usr/local/activemq

添加环境变量,编辑 /etc/profile 文件,在末尾添加:

  1. EXPORT $PATH:/usr/local/activemq/bin

生效文件

  1. source /etc/profile

启动/关闭/重启 activemq 相关命令:

  1. activemq start/stop/restart

按指定配置文件启动

ActiveMQ 启动时默认加载的配置文件为 conf/activemq.xml,我们也可以指定配置文件启动,比如:

  1. [root@centos conf] activemq start xbean:file:/usr/local/activemq/conf/activemq02.xml
  2. INFO: Loading '/usr/local/activemq//bin/env'
  3. INFO: Using java '/usr/local/jdk1.8/bin/java'
  4. INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
  5. INFO: pidfile created : '/usr/local/activemq//data/activemq.pid' (pid '7808')

总结为就是启动的使用使用 xbean:file: 加上配置文件路径即可。

查看启动进程,activemq 的默认进程端口是 61616:

  1. ps -ef | grep activemq | grep -v grep
  2. netstat -anp | grep 61616
  3. lsof -i:61616

访问MQ管理控制台

ActiveMQ 控制台默认使用 8161 端口,所以:

访问地址为:http://ipaddr:8161/admin

默认的用户名和密码是:admin/admin

注意,我们客户端编码连接服务器使用的是 61616 端口,比如:tcp://127.0.0.1:61616,而我们 8161 是访问 MQ 控制台的端口属于 http 协议的,比如:http://127.0.0.1:8161。换句话说,访问控制台走的是 http 协议,而客户端连接 MQ 服务器走的是 tcp 协议。

发表评论

表情:
评论列表 (有 0 条评论,86人围观)

还没有评论,来说两句吧...

相关阅读