CentOS搭建ActiveMQ__ActiveMQ

來源:互聯網
上載者:User

以下操作是我看視頻操作的,以下操作都是我在root使用者下搭建的(搭建ActiveMQ單節點)

1、 安裝 JDK 並配置環境變數(略 配置環境可百度)  


2、 去activeMQ官網下載 Linux 版的 ActiveMQ(我個人下載的是 5.11.1  64的版本)


3、 解壓安裝 $ tar -zxvf apache-activemq-5.11.1-bin.tar.gz 
       $ mv apache-activemq-5.11.1 activemq-01
      如果啟動指令碼 activemq 沒有可執行許可權,此時則需要授權(此步可選) 

    如果activemq  為則不用執行以下命令
     $ cd activemq-01/bin/ 
     $ chmod 755 ./activemq


4、 防火牆中開啟對應的連接埠 ActiveMQ 需要用到兩個連接埠 
   一個是訊息通訊的連接埠(預設為 61616)   可在 conf/activemq.xml 中修改
   一個是管理主控台連接埠(預設為 8161)可在 conf/jetty.xml 中修改,如下:
  <bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
     <!-- the default port number for the web console -->
     <property name="host" value="0.0.0.0"/>
     <property name="port" value="8161"/>
   </bean> 
  # vi /etc/sysconfig/iptables 
  添加:
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 61616 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 8161 -j ACCEPT 
  重啟防火牆:
  # service iptables restart


5、 啟動 $ cd /home/wusc/activemq-01/bin
      $ ./activemq start

6、 開啟管理介面:http://192.168.98.72:8161/

   

    

  預設使用者名和密碼為:admin/admin

登陸後進入


7、 安全配置(訊息安全) ActiveMQ 如果不加入安全機制的話,任何人只要知道Message Service的具體地址(包括 ip,連接埠,訊息地址
[隊列或者主題地址],),都可以肆無忌憚的發送、接收訊息。關於 ActiveMQ 安裝配置
http://activemq.apache.org/security.html

ActiveMQ 的訊息安全配置策略有多種,我們以簡單授權配置為例:
在 conf/activemq.xml 檔案中在 broker 標籤最後加入以下內容即可:
$ vim  activemq-01/conf/activemq.xml
<plugins>
 <simpleAuthenticationPlugin>
 <users>
  <authenticationUser username="wangziqiang" password="wangziqiang.123" groups="users,admins"/>
 </users>
 </simpleAuthenticationPlugin>
</plugins>
定義了一個 wangziqiang 使用者,密碼為 wangziqiang.123,角色為 users,admins


設定 admin 的使用者名稱和密碼:

$ vi activemq-01/conf/jetty.xml
<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
    <property name="name" value="BASIC" />
    <property name="roles" value="admin" />
    <property name="authenticate" value="true" />
</bean>
確保 authenticate 的值為 true(預設) 
控制台的登入使用者名稱密碼儲存在 conf/jetty-realm.properties 檔案中,內容如下:
$ vi activemq-01/conf/jetty-realm.properties
# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename ...]
admin: wangziqiang, admin

注意:使用者名稱和密碼的格式是
使用者名稱 : 密碼 ,角色名稱 
重啟:
$ activemq-01/bin/activemq restart

重啟完之後,在此重新整理瀏覽器 使用者名稱admin  密碼 wangziqiang  即可登陸


設定開機啟動:
# vim /etc/rc.local
加入以下內容
## ActiveMQ
/root/activemq-01/bin/activemq start

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.