ActiveMQ简介:
ActiveMQ是一个消息队列,现在用的很少了,只需要了解即可。
官网:
软件下载地址:
5.16.4版本:
下载后解压到目录中
配置文件 ativemq.xml
也可以直接启动服务,启动命令:
/apps/activemq/bin/linux-x86-64/activemq start
/apps/activemq/bin/linux-x86-64/activemq status
/apps/activemq/bin/linux-x86-64/activemq --help
日志文件:
/apps/activemq/data/activemq.log
安装部署:
1、安装jdk环境
root@usera:~# apt update -y root@usera:~# apt install openjdk-8-jdk -y root@usera:~# java -version openjdk version "1.8.0_312" OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07) OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
2、下载软件包并上传
root@usera:~# mkdir /apps root@usera:~# cd /apps root@usera:/apps# ll total 63676 drwxr-xr-x 2 root root 4096 Mar 15 07:05 ./ drwxr-xr-x 21 root root 4096 Mar 15 07:02 ../ -rw-r--r-- 1 root root 65195457 Mar 15 07:03 apache-activemq-5.16.4-bin.tar.gz
3、解压软件包,并配置文件,启动服务
root@usera:/apps# tar zxf apache-activemq-5.16.4-bin.tar.gz root@usera:/apps# ln -sv apache-activemq-5.16.4 activemq 'activemq' -> 'apache-activemq-5.16.4' root@usera:/apps# cd activemq root@usera:/apps/activemq# ll total 18128 drwxr-xr-x 10 root root 4096 Jan 31 01:02 ./ drwxr-xr-x 3 root root 4096 Mar 15 07:07 ../ -rwxr-xr-x 1 root root 18471406 Jan 31 01:02 activemq-all-5.16.4.jar* drwxr-xr-x 5 root root 4096 Mar 15 07:06 bin/ drwxr-xr-x 2 root root 4096 Mar 15 07:06 conf/ drwxr-xr-x 2 root root 4096 Mar 15 07:06 data/ drwxr-xr-x 2 root root 4096 Mar 15 07:06 docs/ drwxr-xr-x 7 root root 4096 Jan 31 01:02 examples/ drwxr-xr-x 6 root root 4096 Mar 15 07:06 lib/ -rw-r--r-- 1 root root 40581 Jan 31 01:02 LICENSE -rw-r--r-- 1 root root 3334 Jan 31 01:02 NOTICE -rw-r--r-- 1 root root 2611 Jan 31 01:02 README.txt drwxr-xr-x 6 root root 4096 Mar 15 07:06 webapps/ drwxr-xr-x 3 root root 4096 Mar 15 07:06 webapps-demo/ root@usera:/apps/activemq# ll conf/ total 92 drwxr-xr-x 2 root root 4096 Mar 15 07:06 ./ drwxr-xr-x 10 root root 4096 Jan 31 01:02 ../ -rw-r--r-- 1 root root 5912 Jan 31 01:02 activemq.xml -rw-r--r-- 1 root root 1370 Jan 31 01:02 broker.ks -rw-r--r-- 1 root root 592 Jan 31 01:02 broker-localhost.cert -rw-r--r-- 1 root root 665 Jan 31 01:02 broker.ts -rw-r--r-- 1 root root 1357 Jan 31 01:02 client.ks -rw-r--r-- 1 root root 665 Jan 31 01:02 client.ts -rw-r--r-- 1 root root 1172 Jan 31 01:02 credentials-enc.properties -rw-r--r-- 1 root root 1121 Jan 31 01:02 credentials.properties -rw-r--r-- 1 root root 962 Jan 31 01:02 groups.properties -rw-r--r-- 1 root root 1011 Jan 31 01:02 java.security -rw-r--r-- 1 root root 1087 Jan 31 01:02 jetty-realm.properties -rw-r--r-- 1 root root 8432 Jan 31 01:02 jetty.xml -rw-r--r-- 1 root root 965 Jan 31 01:02 jmx.access -rw-r--r-- 1 root root 964 Jan 31 01:02 jmx.password -rw-r--r-- 1 root root 3561 Jan 31 01:02 log4j.properties -rw-r--r-- 1 root root 1207 Jan 31 01:02 logging.properties -rw-r--r-- 1 root root 1016 Jan 31 01:02 login.config -rw-r--r-- 1 root root 961 Jan 31 01:02 users.properties root@usera:/apps/activemq# ll bin/ total 164 drwxr-xr-x 5 root root 4096 Mar 15 07:06 ./ drwxr-xr-x 10 root root 4096 Jan 31 01:02 ../ -rwxr-xr-x 1 root root 26694 Jan 31 01:02 activemq* -rwxr-xr-x 1 root root 6190 Jan 31 01:02 activemq-diag* -rw-r--r-- 1 root root 15940 Jan 31 01:02 activemq.jar -rw-r--r-- 1 root root 5598 Jan 31 01:02 env drwxr-xr-x 2 root root 4096 Mar 15 07:06 linux-x86-32/ drwxr-xr-x 2 root root 4096 Mar 15 07:06 linux-x86-64/ drwxr-xr-x 2 root root 4096 Mar 15 07:06 macosx/ -rw-r--r-- 1 root root 83820 Jan 31 01:02 wrapper.jar root@usera:/apps/activemq# ./bin/activemq start INFO: Loading '/apps/apache-activemq-5.16.4//bin/env' INFO: Using java '/usr/bin/java' INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details INFO: pidfile created : '/apps/apache-activemq-5.16.4//data/activemq.pid' (pid '1659') root@usera:/apps/activemq# ./bin/activemq status INFO: Loading '/apps/apache-activemq-5.16.4//bin/env' INFO: Using java '/usr/bin/java' ActiveMQ is running (pid '1659') ## 现在的服务只是监听本机,需要修改下配置文件 root@usera:/apps/activemq# netstat -ntpl |grep 1659 tcp6 0 0 127.0.0.1:8161 :::* LISTEN 1659/java tcp6 0 0 :::5672 :::* LISTEN 1659/java tcp6 0 0 :::61613 :::* LISTEN 1659/java tcp6 0 0 :::38605 :::* LISTEN 1659/java tcp6 0 0 :::61614 :::* LISTEN 1659/java tcp6 0 0 :::61616 :::* LISTEN 1659/java tcp6 0 0 :::1883 :::* LISTEN 1659/java ## 搜索在哪个配置文件里边,有只监控本机的配置 root@usera:/apps/activemq# grep 8161 ./* -R ./conf/jetty.xml: <property name="port" value="8161"/> ./docs/WebConsole-README.txt: http://localhost:8161/admin/ ./docs/WebConsole-README.txt:same VM as the broker. The console is accessibly under http://localhost:8161/admin/. ./docs/user-guide.html:In a web browser you can access the url <a href="http://0.0.0.0:8161/admin">http://0.0.0.0:8161/admin</a> to access the ActiveMQ web console. ./docs/user-guide.html:In a web browser you can access the url <a href="http://0.0.0.0:8161/demo">http://0.0.0.0:8161/demo</a> to access the ActiveMQ web demos. ./examples/conf/jetty-demo.xml: <property name="port" value="8161"/> ./webapps/api/WEB-INF/web.xml: <param-value>http://${host}:8161/api/jolokia</param-value> ## 修改下边的配置项,以监听所有地址的8161端口 root@usera:/apps/activemq# vim conf/jetty.xml <property name="host" value="0.0.0.0"/> ## 重启服务 root@usera:/apps/activemq/conf# cd ../bin root@usera:/apps/activemq/bin# /apps/activemq/bin/activemq stop root@usera:/apps/activemq/bin# /apps/activemq/bin/activemq start INFO: Loading '/apps/apache-activemq-5.16.4//bin/env' INFO: Using java '/usr/bin/java' INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details INFO: pidfile created : '/apps/apache-activemq-5.16.4//data/activemq.pid' (pid '2293') root@usera:/apps/activemq/bin# ss -ntpl |grep 2293 LISTEN 0 50 *:8161 *:* users:(("java",pid =2293,fd=159)) LISTEN 0 4096 *:5672 *:* users:(("java",pid =2293,fd=149)) LISTEN 0 4096 *:61613 *:* users:(("java",pid =2293,fd=150)) LISTEN 0 50 *:61614 *:* users:(("java",pid =2293,fd=153)) LISTEN 0 4096 *:61616 *:* users:(("java",pid =2293,fd=148)) LISTEN 0 50 *:43315 *:* users:(("java",pid =2293,fd=26)) LISTEN 0 4096 *:1883 *:* users:(("java",pid =2293,fd=151)) ## 日志文件位置 root@usera:/apps/activemq# ll data/ total 20 drwxr-xr-x 3 root root 4096 Mar 15 07:10 ./ drwxr-xr-x 11 root root 4096 Mar 15 07:10 ../ -rw-r--r-- 1 root root 3977 Mar 15 07:10 activemq.log -rw-r--r-- 1 root root 5 Mar 15 07:10 activemq.pid -rw-r--r-- 1 root root 0 Mar 15 07:09 audit.log drwxr-xr-x 2 root root 4096 Mar 15 07:10 kahadb/
浏览器访问:
http://172.31.3.130:8161/
默认用户密码都是 admin