CentOS6.5 64位,启动在${activemq.home}/bin/linux-x86-64/activemq start|restart|stop|status

配置web管理页面的安全认证

默认的web页面用户名密码admin:admin,非常不安全,

编辑jetty-realm.properties文件,(用户:密码,组)

admin: admin123, admin

user: user123, user

配置web管理页面的绑定IP和端口

编辑jetty.xml,查找WebConsolePort

<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">

<!-- the default port number for the web console -->

<property name="host" value="192.168.0.31"/>

<property name="port" value="8161"/>

</bean>

配置MQ连接的安全认证

编辑activemq.xml,在<broker>下加

<plugins>

<simpleAuthenticationPlugin>

<users>

<authenticationUser username="user" password="user123" groups="users" />

</users>

</simpleAuthenticationPlugin>

</plugins>

禁用不使用的连接协议

编辑activemq.xml,在<transportConnectors>中注销或删除不使用的<transportConnector>

<transportConnectors>

<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->

<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>

<!--<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>

<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>

<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>

<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>-->

</transportConnectors>

上面我只保留了61616的openwire协议端口

绑定协议连接端口到指定IP

编辑activemq.xml,在<transportConnectors>下找到指定协议的配置,并修改0.0.0.0为要绑定的ip

<transportConnector name="openwire" uri="tcp://192.168.0.10:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>

使用MySql作为持久化保存

拷贝mysql-connector-java-5.1.28-bin.jar  commons-dbcp.jar    commons-pool.jar 到 lib 目录下
建空数据库 CREATE DATABASE IF NOT EXISTS `activemq` DEFAULT CHARACTER SET latin1;  注意:::: CHARACTER SET latin1; utf-8会报错

编辑activemq.xml,在<beans>下插入如下bean配置

<bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">

<property name="driverClassName" value="com.mysql.jdbc.Driver" />

<property name="url" value="jdbc:mysql://192.168.0.20/activemq?relaxAutoCommit=true" />

<property name="username" value="activemq" />

<property name="password" value="123456" />

<property name="poolPreparedStatements" value="true" />

</bean>

删除或注销掉<persistenceAdapter>下的<kahaD>,添加<jdbcPersistenceAdapter>

<persistenceAdapter>

<!--<kahaDB directory="${activemq.data}/kahadb"/>-->

<jdbcPersistenceAdapter dataDirectory="activemq-data" dataSource="#mysql-ds"/>

</persistenceAdapter>

配置基于JDBC的高可用环境

两个以上activemq使用一样的db配置,

客户端连接url为failover:(tcp://broker1:61616,tcp://broker2:61616)?jms.useAsyncSend=true 

官方参考文档

修改内存

linux下,修改bin/env的ACTIVEMQ_OPTS_MEMORY属性,Xms=最小内存,Xmx=最大内存

ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G"

window下,修改activemq.bat,在 if "%ACTIVEMQ_OPTS%" == " 前设置

set ACTIVEMQ_OPTS=-Xms1G -Xmx1G

注册为Service

linux(RedHat,Centos)下(官方参考文档),运行以下命令注册为service,并设置为开机自动启动

?
1
2
3
ln-snf
bin
/activemq/etc/init.d/activemq
chkconfig
--add activemq
chkconfig
activemq on

然后就可以使用如下service命令了

?
1
service
activemq start|stop|status|restart

可能遇到的问题:

查看启动记录:${active.home}/bin/activemq console

1)

错误:

INFO | Database lock driver override not found for : [mysql-ab_jdbc_driver].  Will use default implementation.

INFO | Attempting to acquire the exclusive lock to become the Master broker

INFO | Failed to acquire lock.  Sleeping for 1000 milli(s) before trying again...

INFO | Failed to acquire lock.  Sleeping for 1000 milli(s) before trying again...

INFO | Failed to acquire lock.  Sleeping for 1000 milli(s) before trying again...

INFO | Failed to acquire lock.  Sleeping for 1000 milli(s) before trying again...

INFO | Failed to acquire lock.  Sleeping for 1000 milli(s) before trying again...

解决办法:

在persistenceAdapter中添加useDatabaseLock="false"

<persistenceAdapter>

<jdbcPersistenceAdapter dataSource="#mysql-ds" useDatabaseLock="false" />

</persistenceAdapter>

2)

错误:

Failure Details: Binary logging not possible.

解决:

修改my.cnf,把下面几行打开。

log-bin=mysql-bin

binlog_format=mixed

Apache ActiveMQ URL请求源码泄露漏洞

漏洞描述:

Apache ActiveMQ是流行的消息传输和集成模式提供程序。

Apache ActiveMQ中存在输入验证错误,用户在提交给admin/index.jsp、admin/queues.jsp、admin /topics.jsp等管理页面的URL请求后附加“//”就可以读取JSP页面源码。<*参考 
http://marc.info/?l=bugtraq&m=127196074718617&q=p3
https://issues.apache.org/activemq/si/jira.issueviews:issue-html/AMQ-2700/AMQ-2700.html
http://secunia.com/advisories/39567/

*>

测试方法:

本站提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负!http://www.example.com:8161//admin/index.jsp
http://www.example.com:8161//admin/queues.jsp
http://www.example.com:8161//admin/topics.jspSEBUG安全建议:

临时解决方法:

1. 到${ACTIVEMQ_HOME}/webapps}}目录下

2. 创建名为static的新目录 - mkdir static

3. 将index.html文件移动到该目录下 - mv index.html static/

4. 更改ResourceHandler使用static目录,编辑{{${ACTIVEMQ_HOME}/conf/jetty.xml将 ResourceHandler定义更改为

<bean class="org.mortbay.jetty.handler.ResourceHandler">

  <property name="welcomeFiles">

    <list>

      <value>index.html</value>

    </list>

  </property>

  <property name="resourceBase" value="${activemq.base}/webapps/static"/>

</bean>

厂商补丁:

Apache Group

------------

目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载

https://repository.apache.org/content/repositories/snapshots/org/apache/activemq/apache-activemq/5.4-SNAPSHOT/apache-activemq-5.4-SNAPSHOT-bin.tar.gz


cd conf ,修改activemq.xml 修改里面的61616端口

修改jetty.xml,修改内容容器jetty的默认启动端口,找到默认的8161后修改


ActiveMQ进阶配置的更多相关文章

  1. github+hexo搭建自己的博客网站(六)进阶配置(搜索引擎收录,优化你的url)

    详细的可以查看hexo博客的演示:https://saucxs.github.io/ 绑定了域名: http://www.chengxinsong.cn hexo+github博客网站源码(可以clo ...

  2. ActiveMQ安装配置及使用 转发 https://www.cnblogs.com/hushaojun/p/6016709.html

    ActiveMQ安装配置及使用 ActiveMQ介绍 ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JM ...

  3. ActiveMQ内存配置和密码设置

    1.配置内存 bin中activemq.bat 中的第一行 加上 : REM 配置内存 set ACTIVEMQ_OPTS=-Xms1G -Xmx1G 2.修改控制台密码 1.打开conf/jetty ...

  4. (转)关于ActiveMQ的配置

    目前常用的消息队列组建无非就是MSMQ和ActiveMQ,至于他们的异同,这里不想做过多的比较.简单来说,MSMQ内置于微软操作系统之中,在部署上包含一个隐性条件:Server需要是微软操作系统.(对 ...

  5. VSCode-python 进阶配置

    VSCode-python 进阶配置 中文乱码 中文乱码,网上一堆解决方法,但是根本没有有效起作用的. 在python脚本的前面添加: # -*- coding:utf-8 -*- 并不能在控制台输出 ...

  6. Ubuntu Server下docker实战 02: docker进阶配置

    在上一篇文章里<Ubuntu Server下docker实战 01: 安装docker>,我们已经把docker安装起来了,并运行了一个hello-world 这一篇,我们继续讲进阶配置. ...

  7. (jms)ActiveMQ 安装配置.

    前言 ActiveMQ他是Apache出品的一个JMS提供者,管理会话和队列,运行在JVM下,支持多种语言,如JAVA,C++,C#,应用协议: OpenWire,Stomp REST,WS Noti ...

  8. ActiveMQ安全配置

    1.activeMQ管理后台用户名.密码的设置 管理后台地址http://localhost:8161/admin 默认用户名密码admin admin 端口默认是8161,且服务采用的是服务器,所以 ...

  9. ActiveMQ主从配置

    这种方式有个问题,activemq1有消息没消费完但是突然宕机,虽然程序会自动连到activemq2.但是activemq1的消息只有等机器恢复后才会被消费. 1.启动:我这里使用的是apache-a ...

随机推荐

  1. FreeMarker has_content等价于StringUtils.isNotNullOrEmpty

    has_content It is true if the variable exists (and isn't Java null) and is not "empty", ot ...

  2. js堆栈

    //栈只存地址 堆存对象和地址: 浅拷贝: 深拷贝: 队列类似于过道,走廊:

  3. windows 与linux 上面PG的简单验证

    0.0 目的 验证一下 windows 上面 和linux上面的数据文件是否可以 冷备份 恢复. 1 方法关闭 windows机器上面postgresql 的服务 我这边是PG10.4 可以使用命令 ...

  4. Alpha、伪Beta 发布个人感想与体会

    1.Alpha版本 在Alpha版本发布时,我在Fantacy组,那时的体会我已在前面写过,现在回想起来,我觉得自己的决定似乎做的并不是很糟糕,因为来到新的团队里,我学到了很多东西,认识了很多技术很好 ...

  5. linux运维掌握不熟练命令用法记录

    rename   :批量修改文件名 [root@Dannyserver test]# ls .txt .txt .txt .txt [root@Dannyserver test]# rename 't ...

  6. codeforces622B

    The Time CodeForces - 622B 给你当前的时间(24小时制):HH:MM.输出 x 分钟后的时间是多少?(24小时制) 不明白可以看看例子哦- Input 第一行给出了当前时间, ...

  7. python系列-1 字符串操作

    1.去除空格   str.strip():删除字符串两边的指定字符,括号的写入指定字符,默认为空格 >>> a=' hello ' >>> b=a.strip() ...

  8. 关于mysql的压测sysbench

    测试表格:CREATE TABLE `sbtest` ( `id` int(10) unsigned NOT NULL auto_increment, `k` int(10) unsigned NOT ...

  9. Web Scraper爬取就是这么简单

    这应该是最全的一个文档了 https://www.jianshu.com/p/e4c1561a3ea7 所以我就不介绍了,大家直接看就可以了,有问题可以提出来,我会针对问题对文章进行补充~

  10. The Shortest Statement CodeForces - 1051F(待测试)

    #include <iostream> #include <cstdio> #include <sstream> #include <cstring> ...