1、ActiveMQ Artemis官網下載
https://activemq.apache.org/components/artemis/download/
當前版本2.20.0,不支持JDK8,JDK8需要下載版本2.19.0的,本人下載的是2.19.0
https://activemq.apache.org/components/artemis/download/past_releases
2、上傳安裝壓縮包apache-artemis-2.19.0-bin.tar.gz到服務器/opt目錄上
3、解壓
cd /opt tar -zxvf apache-artemis-2.19.0-bin.tar.gz
4、創建Broker實例
cd apache-artemis-2.19.0/bin ./artemis create mybroker
輸出:
Creating ActiveMQ Artemis instance at: /opt/apache-artemis-2.19.0/bin/mybroker
之後會提示輸入默認用戶名、密碼、是否允許匿名登錄
--user: Please provide the default username: admin --password: is mandatory with this configuration: Please provide the default password: --allow-anonymous | --require-login: Allow anonymous access?, valid values are Y,N,True,False N
輸入之後,輸出:
Auto tuning journal ... done! Your system can make 62.5 writes per millisecond, your journal-buffer-timeout will be 16000 You can now start the broker by executing: "/opt/apache-artemis-2.19.0/bin/mybroker/bin/artemis" run Or you can run the broker in the background using: "/opt/apache-artemis-2.19.0/bin/mybroker/bin/artemis-service" start
執行下面命令啓動Artemis
"/opt/apache-artemis-2.19.0/bin/mybroker/bin/artemis-service" start
5、修改Artemis配置
(1)修改 vim mybroker/etc/jolokia-access.xml
找到下面一行
<allow-origin>*://localhost*</allow-origin>
在它的下面添加一行訪問權限設置,例如
<allow-origin>*://172.16.21.3*</allow-origin>
(2)修改 vim mybroker/etc/bootstrap.xml
找到下面一行
<web bind="http://localhost:8161" path="web">
把裏面的localhost修改爲服務器IP
<web bind="http://172.16.21.3:8161" path="web">
(3)重啓Artemis
"/opt/apache-artemis-2.19.0/bin/mybroker/bin/artemis-service" restart
(4)檢查防火牆指是允開啓端口8161和61616,沒開啓則開啓
firewall-cmd --query-port=8161/tcp firewall-cmd --zone=public --add-port=8161/tcp --permanent firewall-cmd --query-port=61616/tcp firewall-cmd --zone=public --add-port=61616/tcp --permanent firewall-cmd --reload
6、登錄控制檯
http://172.16.21.3:8161/console/login
用戶名及密碼爲上面創建Broker實例時的用戶名及密碼