zoukankan      html  css  js  c++  java
  • activemq 安装配置二

    管理后台地址http://localhost:8161/admin 或 http://127.0.0.1:8161/admin 默认用户名密码admin admin,端口默认是8161,且服务采用的是服务器,所以我们进入到conf/jetty.xml

    一. 放开本地访问限制

    将host由127.0.0.1 变更为0.0.0.0 , 放开非本地访问限制

        <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>

     二. 修改控制台账号密码

    打开conf/jetty.xml文件 

        <bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
            <property name="name" value="BASIC" />
            <property name="roles" value="user,admin" />
            <!-- set authenticate=false to disable login -->
            <property name="authenticate" value="true" />
        </bean>

    将authenticate的值改为true

    然后打开conf/jetty-realm.properties文件,修改控制台用户和密码

    # username: password [,rolename ...]注意这里的提示:用户名:密码,角色
    superman: newpass, admin
    user: user, user 

    重启activeMQ,可以访问 http://192.168.0.168:8161/admin,  填充用户校验窗口,输入新账号super,密码newpass,登录成功

    三, 给生产者和消费者连接ActiveMQ添加用户名、密码

    配置方案有多种,详细可参考 http://activemq.apache.org/security.html 

    (1) 最简单配置,在conf/activemq.xml文件的在<broker>标签里的<systemUsage>标签前加入

    <plugins>
        <simpleAuthenticationPlugin>
          <users>
              <authenticationUser username="superman" password="newpass" groups="users,admins"/>
          </users>
        </simpleAuthenticationPlugin>
    </plugins>

    四, 程序配置,这里以spring配置为例

           <bean id="connectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
             <property name="connectionFactory">
                 <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                     <property name="brokerURL">
                         <value>${jms.brokerURL}</value>
                     </property>
                     <property name="useAsyncSend">
                         <value>true</value>
                     </property>
                     <property name="userName">
                         <value>superman</value>
                     </property>
                     <property name="password">
                         <value>newpass</value>
                     </property>
                 </bean>
             </property>
         </bean>
  • 相关阅读:
    cf B. Vasily the Bear and Fly
    hdu 3339 In Action
    hdu 六度分离
    cf A. Vasily the Bear and Triangle
    cf C. Secrets
    2.19学习笔记|2.20学习笔记
    VAE代码学习
    2.9日学习记录
    deconvolution反卷积(待学习)
    gamma分布学习
  • 原文地址:https://www.cnblogs.com/zsg88/p/15268432.html
Copyright © 2011-2022 走看看