Artemis安装

Linux下安装Artemis

Artemis是下一代的ActiveMQ,也就是说目前的ActiveMQ是5.x,Artemis将是6.x

1. 下载

官网下载地址:

https://activemq.apache.org/components/artemis/download/

wget https://downloads.apache.org/activemq/activemq-artemis/2.13.0/apache-artemis-2.13.0-bin.tar.gz

2. 解压

[ package]# tar zxf apache-artemis-2.11.0-bin.tar.gz -C /opt/software/
[ package]# cd /opt/software/

为了以后换版本也方便,可以创建一个链接

[ software]# ln -s apache-artemis-2.11.0/ artemis

3. 创建Broker实例

Broker实例是包含与Broker进程关联的所有配置和运行时数据(如日志和数据文件)的目录。

官网文档建议我们不要在${ARTEMIS_HOME}下创建实例目录。

会提示输入账号、密码、以及是否允许匿名登录

[ artemis]# cd /data01/artemis/
[ artemis]# /opt/software/artemis/bin/artemis create myBroker
Creating ActiveMQ Artemis instance at: /data01/artemis/myBroker

--user: is a mandatory property!
Please provide the default username:
aganRun

--password: is mandatory with this configuration:
Please provide the default password:


--allow-anonymous | --require-login: is a mandatory property!
Allow anonymous access?, valid values are Y,N,True,False
Y     

Auto tuning journal ...
done! Your system can make 16.67 writes per millisecond, your journal-buffer-timeout will be 59999

You can now start the broker by executing:  

   "/data01/artemis/myBroker/bin/artemis" run

Or you can run the broker in the background using:

   "/data01/artemis/myBroker/bin/artemis-service" start

[ artemis]#

4. 启动停止

第三部控制台已经输出了启停命令

启动: /data01/artemis/myBroker/bin/artemis run
后台启动  /data01/artemis/myBroker/bin/artemis-service start

后台启动

[ artemis]# /data01/artemis/myBroker/bin/artemis-service start
Starting artemis-service
artemis-service is now running (1615)

5. 访问控制台

根据官方文档所述,我们可以通过使用浏览器访问URL http://localhost:8161/console 来使用控制台.

默认只能通过本机访问。如果想通过IP:8161访问需要修改配置文件

  1. 修改 etc/jolokia-access.xml,添加一条allow-origin的访问权限设置
    <restrict>
    
        <cors>
            <!-- Allow cross origin access from localhost ... -->
            <allow-origin>*://localhost*</allow-origin>
            <allow-origin>*://192.168.88.200*</allow-origin>        <!-- 这个是新添加的 -->
    
    
            <!-- Options from this point on are auto-generated by Create.java from the Artemis CLI -->
            <!-- Check for the proper origin on the server side, too -->
            <strict-checking/>
        </cors>
    
    </restrict>
  2. 修改etc/bootstrap.xml,localhost改为服务器的ip
    <web bind="http://192.168.88.200:8161" path="web">
           <app url="activemq-branding" war="activemq-branding.war"/>
           <app url="artemis-plugin" war="artemis-plugin.war"/>
           <app url="console" war="console.war"/>
       </web>
  3. 重启
    /data01/artemis/myBroker/bin/artemis-service restart

此时成功访问

相关推荐