架构师_程序员_码农网

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 5272|回复: 0

ACTIVEMQ主题、队列设置用户名密码

[复制链接]
发表于 2017-11-21 13:53:20 | 显示全部楼层 |阅读模式
修改文件%ACTIVEMQ_BASE%/conf/activemq.xml,用户名密码储存在文件%ACTIVEMQ_BASE%/conf/credentials.properties中,

04165311-5110fe7f749c422a81f2845a32551a0d.jpg

activemq.xml详细如下:

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- START SNIPPET: example -->
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>

<!-- Allows log searching in hawtio console -->
<bean id="logQuery" class="org.fusesource.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop">
</bean>

<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" useJmx="true">

<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:

http://activemq.apache.org/slow-consumer-handling.html

-->
<!-- 分发策略 -->
<dispatchPolicy>
<!-- 按顺序分发 -->
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<!-- 恢复策略-->
<subscriptionRecoveryPolicy>
<!-- 只恢复最后一个message -->
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
<pendingQueuePolicy>
<!-- 首先在内存中保存消息的引用,如果内存使用量达到上限,那么会把消息引用保存到临时文件中 -->
<fileQueueCursor/>
</pendingQueuePolicy>
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>

<!-- 个人简历 -->
<policyEntry queue="PER.>" producerFlowControl="true" memoryLimit="10mb">
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:

http://activemq.apache.org/slow-consumer-handling.html

-->
<!-- 分发策略 -->
<dispatchPolicy>
<!-- 按顺序分发 -->
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<!-- 恢复策略-->
<subscriptionRecoveryPolicy>
<!-- 只恢复最后一个message -->
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
<pendingQueuePolicy>
<!-- 首先在内存中保存消息的引用,如果内存使用量达到上限,那么会把消息引用保存到临时文件中 -->
<fileQueueCursor/>
</pendingQueuePolicy>
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>

<!-- 企业 -->
<policyEntry queue="COM.>" producerFlowControl="true" memoryLimit="10mb">
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:

http://activemq.apache.org/slow-consumer-handling.html

-->
<!-- 分发策略 -->
<dispatchPolicy>
<!-- 按顺序分发 -->
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<!-- 恢复策略-->
<subscriptionRecoveryPolicy>
<!-- 只恢复最后一个message -->
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
<pendingQueuePolicy>
<!-- 首先在内存中保存消息的引用,如果内存使用量达到上限,那么会把消息引用保存到临时文件中 -->
<fileQueueCursor/>
</pendingQueuePolicy>
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>

<!-- 招聘会 -->
<policyEntry queue="RECR.>" producerFlowControl="true" memoryLimit="10mb">
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:

http://activemq.apache.org/slow-consumer-handling.html

-->
<!-- 分发策略 -->
<dispatchPolicy>
<!-- 按顺序分发 -->
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<!-- 恢复策略-->
<subscriptionRecoveryPolicy>
<!-- 只恢复最后一个message -->
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
<pendingQueuePolicy>
<!-- 首先在内存中保存消息的引用,如果内存使用量达到上限,那么会把消息引用保存到临时文件中 -->
<fileQueueCursor/>
</pendingQueuePolicy>
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>

<!-- 微招聘 -->
<policyEntry queue="MCOM.>" producerFlowControl="true" memoryLimit="10mb">
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:

http://activemq.apache.org/slow-consumer-handling.html

-->
<!-- 分发策略 -->
<dispatchPolicy>
<!-- 按顺序分发 -->
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<!-- 恢复策略-->
<subscriptionRecoveryPolicy>
<!-- 只恢复最后一个message -->
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
<pendingQueuePolicy>
<!-- 首先在内存中保存消息的引用,如果内存使用量达到上限,那么会把消息引用保存到临时文件中 -->
<fileQueueCursor/>
</pendingQueuePolicy>
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>

<!-- 微求职 -->
<policyEntry queue="MPER.>" producerFlowControl="true" memoryLimit="10mb">
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:

http://activemq.apache.org/slow-consumer-handling.html

-->
<!-- 分发策略 -->
<dispatchPolicy>
<!-- 按顺序分发 -->
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<!-- 恢复策略-->
<subscriptionRecoveryPolicy>
<!-- 只恢复最后一个message -->
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
<pendingQueuePolicy>
<!-- 首先在内存中保存消息的引用,如果内存使用量达到上限,那么会把消息引用保存到临时文件中 -->
<fileQueueCursor/>
</pendingQueuePolicy>
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>

<!-- 后台 -->
<policyEntry queue="ERP.>" producerFlowControl="true" memoryLimit="10mb">
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:

http://activemq.apache.org/slow-consumer-handling.html

-->
<!-- 分发策略 -->
<dispatchPolicy>
<!-- 按顺序分发 -->
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<!-- 恢复策略-->
<subscriptionRecoveryPolicy>
<!-- 只恢复最后一个message -->
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
<pendingQueuePolicy>
<!-- 首先在内存中保存消息的引用,如果内存使用量达到上限,那么会把消息引用保存到临时文件中 -->
<fileQueueCursor/>
</pendingQueuePolicy>
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>


<!--
The managementContext is used to configure how ActiveMQ is exposed in
JMX. By default, ActiveMQ uses the MBean server that is started by
the JVM. For more information, see:

http://activemq.apache.org/jmx.html
-->
<managementContext>
<managementContext createConnector="false"/>
</managementContext>

<!--
Configure message persistence for the broker. The default persistence
mechanism is the KahaDB store (identified by the kahaDB tag).
For more information, see:

http://activemq.apache.org/persistence.html
-->
<persistenceAdapter>
<kahaDB directory="E:/activemq_data"
enableJournalDiskSyncs="false"
indexWriteBatchSize="1000"
indexCacheSize="10000"
journalMaxFileLength="32mb"
/>
</persistenceAdapter>


<plugins>
<!-- Configure authentication; Username, passwords and groups -->
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="${activemq.username}" password="${activemq.password}" groups="admins"/>
<authenticationUser username="${per.username}" password="${per.password}" groups="personal"/>
<authenticationUser username="${mper.username}" password="${mper.password}" groups="mpersonal"/>
<authenticationUser username="${com.username}" password="${com.password}" groups="company"/>
<authenticationUser username="${mcom.username}" password="${mcom.password}" groups="mcompany"/>
<authenticationUser username="${erp.username}" password="${erp.password}" groups="erp"/>
<authenticationUser username="${recr.username}" password="${recr.password}" groups="recr"/>
</users>
</simpleAuthenticationPlugin>

<!-- Lets configure a destination based authorization mechanism -->
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
<authorizationEntry queue="PER.>" read="personal, mpersonal, company, mcompany, erp, recr" write="personal" admin="personal" />
<authorizationEntry queue="MPER.>" read="personal, mpersonal, company, mcompany, erp, recr" write="mpersonal" admin="mpersonal" />
<authorizationEntry queue="COM.>" read="personal, mpersonal, company, mcompany, erp, recr" write="company" admin="company" />
<authorizationEntry queue="MCOM.>" read="personal, mpersonal, company, mcompany, erp, recr" write="mcompany" admin="mcompany" />
<authorizationEntry queue="ERP.>" read="personal, mpersonal, company, mcompany, erp, recr" write="erp" admin="erp" />
<authorizationEntry queue="RECR.>" read="personal, mpersonal, company, mcompany, erp, recr" write="recr" admin="recr" />

<authorizationEntry topic="ActiveMQ.Advisory.>" read="personal, mpersonal, company, mcompany, erp, recr" write="personal, mpersonal, company, mcompany, erp, recr" admin="personal, mpersonal, company, mcompany, erp, recr" />
</authorizationEntries>
</authorizationMap>
</map>
</authorizationPlugin>
</plugins>

<!--
The systemUsage controls the maximum amount of space the broker will
use before disabling caching and/or slowing down producers. For more information, see:
http://activemq.apache.org/producer-flow-control.html
-->
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="100" />
</memoryUsage>
<storeUsage>
<storeUsage limit="1 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="100 mb"/>
</tempUsage>
</systemUsage>
</systemUsage>

<!--
The transport connectors expose ActiveMQ over a given protocol to
clients and other brokers. For more information, see:

http://activemq.apache.org/configuring-transports.html
-->
<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>

<!-- destroy the spring context on shutdown to stop jetty -->
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>

</broker>

<!--
Enable web consoles, REST and Ajax APIs and demos
The web consoles requires by default login, you can disable this in the jetty.xml file

Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>

</beans>
<!-- END SNIPPET: example -->

credentials.properties详细如下:

## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------

# Defines credentials that will be used by components (like web console) to access the broker

activemq.username=***
activemq.password=***

per.username=***
per.password=***

mper.username=***
mper.password=***

com.username=***
com.password=***

mcom.username=***
mcom.password=***

erp.username=***
erp.password=***

recr.username=***
recr.password=***

以上配置今天发现队列监控出现异常,最后查到问题出现在这里:

06144540-b2d18631c0d142a0b741e6df16289e9a.jpg

由于队列监控项目admin里使用的账户为system/manager(webapps\admin\WEB-INF\webconsole-embedded.xml

05201141-8d0daedfc703406880924995a60a08de.jpg

),属于admins群组,需要加上权限






上一篇:activemq修改网站管理密码
下一篇:.net/c# activemq设置连接账号和密码
码农网,只发表在实践过程中,遇到的技术难题,不误导他人。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

免责声明:
码农网所发布的一切软件、编程资料或者文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:help@itsvse.com

QQ|手机版|小黑屋|架构师 ( 鲁ICP备14021824号-2 )|网站地图

GMT+8, 2024-3-29 05:09

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表