Activemq配置文件详解
Activemq目录
Activemq根目录下目录列表:
-rw-r--r-- 1 activemq activemq 40580 Aug 2 2016 LICENSE
-rw-r--r-- 1 activemq activemq 3334 Aug 2 2016 NOTICE
-rw-r--r-- 1 activemq activemq 2610 Aug 2 2016 README.txt
-rwxr-xr-x 1 activemq activemq 16195019 Aug 2 2016 activemq-all-5.14.0.jar
drwxr-xr-x 5 activemq activemq 147 Jul 3 2019 bin
drwxr-xr-x 2 activemq activemq 4096 Jul 3 2019 conf
drwxrwxrwx 3 root root 77 Sep 1 05:28 data
drwxr-xr-x 2 activemq activemq 76 Jul 3 2019 docs
drwxr-xr-x 7 activemq activemq 71 Jul 3 2019 examples
drwxr-xr-x 6 activemq activemq 4096 Jul 3 2019 lib
drwxr-xr-x 4 activemq activemq 136 Sep 1 05:28 tmp
drwxr-xr-x 6 activemq activemq 95 Jul 3 2019 webapps
drwxr-xr-x 3 activemq activemq 18 Jul 3 2019 webapps-demo
bin----存放的是脚本文件
conf----存放的是基本配置文件
data----存放的是日志文件
docs----存放的是说明文档
examples----存放的是简单的实例
lib----存放的是activemq所需jar包
webapps----用于存放项目的目录
bin目录
bin目录存储脚本文件以及程序文件
-rwxr-xr-x 1 activemq activemq 21446 Aug 2 2016 activemq
-rwxr-xr-x 1 activemq activemq 6189 Aug 2 2016 activemq-diag
-rw-r--r-- 1 activemq activemq 15995 Aug 2 2016 activemq.jar
-rw-r--r-- 1 activemq activemq 4884 Aug 2 2016 env
drwxr-xr-x 2 activemq activemq 78 Jul 3 2019 linux-x86-32
drwxr-xr-x 2 activemq activemq 78 Jul 3 2019 linux-x86-64
drwxr-xr-x 2 activemq activemq 82 Jul 3 2019 macosx
-rw-r--r-- 1 activemq activemq 83820 Aug 2 2016 wrapper.jar
conf目录
存储配置文件。
-rw-r--r-- 1 activemq activemq 5911 Aug 2 2016 activemq.xml #
-rw-r--r-- 1 activemq activemq 592 Aug 2 2016 broker-localhost.cert
-rw-r--r-- 1 activemq activemq 1370 Aug 2 2016 broker.ks
-rw-r--r-- 1 activemq activemq 665 Aug 2 2016 broker.ts
-rw-r--r-- 1 activemq activemq 1357 Aug 2 2016 client.ks
-rw-r--r-- 1 activemq activemq 665 Aug 2 2016 client.ts
-rw-r--r-- 1 activemq activemq 1172 Aug 2 2016 credentials-enc.properties
-rw-r--r-- 1 activemq activemq 1121 Aug 2 2016 credentials.properties
-rw-r--r-- 1 activemq activemq 962 Aug 2 2016 groups.properties
-rw-r--r-- 1 activemq activemq 1011 Aug 2 2016 java.security
-rw-r--r-- 1 activemq activemq 1087 Aug 2 2016 jetty-realm.properties
-rw-r--r-- 1 activemq activemq 7795 Aug 2 2016 jetty.xml
-rw-r--r-- 1 activemq activemq 965 Aug 2 2016 jmx.access
-rw-r--r-- 1 activemq activemq 964 Aug 2 2016 jmx.password
-rw-r--r-- 1 activemq activemq 3084 Aug 2 2016 log4j.properties
-rw-r--r-- 1 activemq activemq 1207 Aug 2 2016 logging.properties
-rw-r--r-- 1 activemq activemq 1016 Aug 2 2016 login.config
-rw-r--r-- 1 activemq activemq 961 Aug 2 2016 users.properties
data目录
data目录存放的是日志文件
-rw-r--r-- 1 activemq activemq 199757 Sep 6 03:10 activemq.log #启动日志文件
-rw-r--r-- 1 activemq activemq 2 Sep 1 05:28 activemq.pid #进程id文件
-rw-r--r-- 1 activemq activemq 0 Sep 1 05:28 audit.log
drwxr-xr-x 2 activemq activemq 160 Sep 3 18:56 kahadb #使用kahadb 作为存储
kahadb目录
-rw-r--r-- 1 activemq activemq 33554432 Sep 2 03:05 db-1.log
-rw-r--r-- 1 activemq activemq 33554432 Sep 2 03:26 db-2.log
-rw-r--r-- 1 activemq activemq 147632 Sep 2 03:14 db-3.log
-rw-r--r-- 1 activemq activemq 33554432 Sep 3 18:55 db-4.log
-rw-r--r-- 1 activemq activemq 6070512 Sep 2 03:29 db-5.log
-rw-r--r-- 1 activemq activemq 33554432 Sep 6 03:19 db-6.log
-rw-r--r-- 1 activemq activemq 9208023 Sep 3 18:57 db-7.log
-rw-r--r-- 1 activemq activemq 6901760 Sep 6 03:19 db.data
-rw-r--r-- 1 activemq activemq 1239400 Sep 6 03:19 db.redo
-rw-r--r-- 1 activemq activemq 8 Sep 1 05:28 lock
说明:
db.data
:它是消息的索引文件。本质上是B-Tree
的实现,使用B-Tree作为索引指向db-*.log
里面存储的消息。db-*.log
: 存储消息的内容。对于一个消息而言,不仅仅有消息本身的数据(message data),而且还有(Destinations、订阅关系、事务…)。data log以日志形式存储消息,而且新的数据总是以APPEND的方式追加到日志文件末尾。db.redo
:主要用来进行消息恢复。edo log的原理用到了“Double Write”。lock
:锁定数据库
docs目录
docs目录存放的是说明文档
examples
存放的是简单
./amqp/
./amqp/java #java示例
./amqp/python #python示例./conf/
./conf/activemq-demo.xml
./conf/activemq-dynamic-network-broker1.xml
./conf/activemq-dynamic-network-broker2.xml
./conf/activemq-jdbc-performance.xml
./conf/activemq-jdbc.xml
./conf/activemq-leveldb-replicating.xml
./conf/activemq-mqtt.xml
./conf/activemq-scalability.xml
./conf/activemq-security.xml
./conf/activemq-specjms.xml
./conf/activemq-static-network-broker1.xml
./conf/activemq-static-network-broker2.xml
./conf/activemq-stomp.xml
./conf/activemq-throughput.xml
./conf/activemq.xml
./conf/camel.xml
./conf/jetty-demo.xml
./conf/log4j.properties
./conf/resin-web.xml
./conf/web.xml./mqtt #mqtt 协议 java代码
./mqtt/java
./mqtt/websocket #mqtt 协议 websocket./openwire/
./stomp
lib
存放的是activemq所需jar包
webapps
用于存放项目的目录
Activemq配置文件
主配置
activemq.xml
<beansxmlns="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.xsdhttp://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 accessing the server log --><bean id="logQuery" class="io.fabric8.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}"><destinationPolicy><policyMap><policyEntries><policyEntry topic=">" ><!-- The constantPendingMessageLimitStrategy is used to preventslow topic consumers to block producers and affect other consumersby limiting the number of messages that are retainedFor more information, see:http://activemq.apache.org/slow-consumer-handling.html--><pendingMessageLimitStrategy><constantPendingMessageLimitStrategy limit="1000"/></pendingMessageLimitStrategy></policyEntry></policyEntries></policyMap></destinationPolicy><!--The managementContext is used to configure how ActiveMQ is exposed inJMX. By default, ActiveMQ uses the MBean server that is started bythe JVM. For more information, see:http://activemq.apache.org/jmx.html--><managementContext><managementContext createConnector="false"/></managementContext><!--Configure message persistence for the broker. The default persistencemechanism is the KahaDB store (identified by the kahaDB tag).For more information, see:http://activemq.apache.org/persistence.html--><!--配置持久化适配器,默认为kahaDB。支持:JDBC,文件系统(AMQ),levelDB--><persistenceAdapter><kahaDB directory="${activemq.data}/kahadb"/><!-- JDBC<jdbcPersistenceAdapter dataSource="#my-ds"/> --><!-- AMQ<amqPersistenceAdapter directory="${activemq.base}/activemq-data" maxFileLength="32mb"/>--></persistenceAdapter><!--The systemUsage controls the maximum amount of space the broker willuse 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="70" /></memoryUsage><storeUsage><storeUsage limit="100 gb"/></storeUsage><tempUsage><tempUsage limit="50 gb"/></tempUsage></systemUsage></systemUsage><!--The transport connectors expose ActiveMQ over a given protocol toclients and other brokers. For more information, see:http://activemq.apache.org/configuring-transports.html传输连接器通过给定的协议将ActiveMQ公开给客户和其他经纪人。--><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&wireFormat.maxFrameSize=104857600"/><transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/><transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/><transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/><transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&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 demosThe web consoles requires by default login, you can disable this in the jetty.xml fileTake a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details--><import resource="jetty.xml"/></beans>
<!-- END SNIPPET: example -->
broker节点
参数名 | 类型 | 默认值 | 说明 |
---|---|---|---|
brokerName | Str | localhost | 机器名网络内唯一 |
persistent | Boolean | true |
是否持久化。 true表示需要持久化,需要与元素persistenceAdapter结合使用 false表示不持久化 重启后消息丢失 且十分消耗内存 |
dataDirectory | Str | ${activemq.data} | 默认持久化数据的目录 |
deleteAllMessagesOnStartup | Boolean | false | 启动时是否清空持久化的消息 |
enableStatistics | Boolean | true | 是否启用数据收集 |
persistenceAdapter节点
JDBC:https://activemq.apache.org/jdbc-support
AMQ:https://activemq.apache.org/amq-message-store
KahaDB:https://activemq.apache.org/kahadb 。支持多KahaDB设置,不同队列使用不同实例。
levelDB:https://activemq.apache.org/leveldb-store
访问Activmq账户
<broker><plugins><!-- anonymousAccessAllowed :支持匿名访问 --><simpleAuthenticationPlugin anonymousAccessAllowed="false"> <users><authenticationUser username="system" password="manager" groups="users,admins"/><authenticationUser username="user" password="password" groups="users"/><authenticationUser username="guest" password="password" groups="guests"/></users></simpleAuthenticationPlugin><!-- 分别设置不同topic,queue的权限--><authorizationPlugin><map><authorizationMap><authorizationEntries><authorizationEntry queue=">" read="admins" write="admins" admin="admins" /><authorizationEntry queue="USERS.>" read="users" write="users" admin="users" /><authorizationEntry queue="GUEST.>" read="guests" write="guests,users" admin="guests,users" /><authorizationEntry queue="TEST.Q" read="guests" write="guests" /><authorizationEntry topic=">" read="admins" write="admins" admin="admins" /><authorizationEntry topic="USERS.>" read="users" write="users" admin="users" /><authorizationEntry topic="GUEST.>" read="guests" write="guests,users" admin="guests,users" /><authorizationEntry topic="ActiveMQ.Advisory.>" read="guests,users" write="guests,users" admin="guests,users"/></authorizationEntries></authorizationMap></map></authorizationPlugin></plugins>
</broker>
用户名、密码等可以引用*.properties文件中的变量。例如:
transports
传输连接器通过给定的协议将ActiveMQ公开给客户和其他broker。
主要属性包括name
、uri
systemUsage
配置系统资源使用情况,包括内存、存储、临时存储。
它主要控制的是当系统资源超过限定时,会控制TCP的流量。数据流会降低速度,producer会被阻塞。具体的行为可以配置。
可配置属性:
- sendFailIfNoSpace:true/false。空间不够直接失败。
- sendFailIfNoSpaceAfterTimeout : 空间不够直接失败的超时设置(指定时间后才失败)
从5.15.x 存储空间支持百分比。
networks
指定activemq broker的服务发现方式。包括:static
消息Destination策略
<destinationPolicy><policyMap><policyEntries><!--指定策略应用的topic。仅限非持久化topic --><policyEntry topic=">" > <!-- The constantPendingMessageLimitStrategy is used to preventslow topic consumers to block producers and affect other consumersby limiting the number of messages that are retainedFor more information, see:http://activemq.apache.org/slow-consumer-handling.html--><!--用于指定避免慢消费者阻塞生产者的策略。 --><pendingMessageLimitStrategy><constantPendingMessageLimitStrategy limit="1000"/></pendingMessageLimitStrategy><!--可以设置很多不同用途的策略 --><dispatchPolicy> <roundRobinDispatchPolicy/> </dispatchPolicy> <subscriptionRecoveryPolicy> <lastImageSubscriptionRecoveryPolicy/> </subscriptionRecoveryPolicy></policyEntry></policyEntries></policyMap></destinationPolicy>
pendingMessageLimitStrategy策略:
- ConstantPendingMessageLimitStrategy:
- PrefetchRatePendingMessageLimitStrategy:
属性文件
credentials.properties
定义凭据
# Defines credentials that will be used by components (like web console) to access the brokeractivemq.username=system
activemq.password=manager
guest.password=password
credentials-enc.properties
定义加密的凭据
# Defines credentials that will be used by components (like web console) to access the brokeractivemq.username=system
activemq.password=ENC(mYRkg+4Q4hua1kvpCCI2==)
guest.password=ENC(Cf3Jf3tM+UrSOoaKU50od5CuBa8r=====)
安全配置
管理端配置
jetty.xml
Jetty
是一个开源的servlet容器,它为基于Java的web内容,例如JSP和servlet提供运行环境。
Activemq管理端使用Jetty
作为内嵌容器。使用Spring框架提供http服务。
<!--An embedded servlet engine for serving up the Admin consoles, REST and Ajax APIs andsome demos Include this file in your configuration to enable ActiveMQ web componentse.g. <import resource="jetty.xml"/>-->
<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"><bean id="securityLoginService" class="org.eclipse.jetty.security.HashLoginService"><property name="name" value="ActiveMQRealm" /><property name="config" value="${activemq.conf}/jetty-realm.properties" /></bean><!-- 访问系统的权限的功能,具有的角色 --><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 --><!-- true表示需要用户登录 --><property name="authenticate" value="true" /></bean><!-- 需要管理员权限的功能 --><bean id="adminSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint"><property name="name" value="BASIC" /><property name="roles" value="admin" /><!-- set authenticate=false to disable login --><property name="authenticate" value="true" /></bean><bean id="securityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping"><property name="constraint" ref="securityConstraint" /><property name="pathSpec" value="/api/*,/admin/*,*.jsp" /></bean><bean id="adminSecurityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping"><property name="constraint" ref="adminSecurityConstraint" /><property name="pathSpec" value="*.action" /></bean><bean id="rewriteHandler" class="org.eclipse.jetty.rewrite.handler.RewriteHandler"><property name="rules"><list><bean id="header" class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule"><property name="pattern" value="*"/><property name="name" value="X-FRAME-OPTIONS"/><property name="value" value="SAMEORIGIN"/></bean></list></property></bean><bean id="secHandlerCollection" class="org.eclipse.jetty.server.handler.HandlerCollection"><property name="handlers"><list><ref bean="rewriteHandler"/><bean class="org.eclipse.jetty.webapp.WebAppContext"><property name="contextPath" value="/admin" /><property name="resourceBase" value="${activemq.home}/webapps/admin" /><property name="logUrlOnStart" value="true" /></bean><bean class="org.eclipse.jetty.webapp.WebAppContext"><property name="contextPath" value="/api" /><property name="resourceBase" value="${activemq.home}/webapps/api" /><property name="logUrlOnStart" value="true" /></bean><bean class="org.eclipse.jetty.server.handler.ResourceHandler"><property name="directoriesListed" value="false" /><property name="welcomeFiles"><list><value>index.html</value></list></property><property name="resourceBase" value="${activemq.home}/webapps/" /></bean><bean id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"><property name="serveIcon" value="false" /></bean></list></property></bean> <bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler"><property name="loginService" ref="securityLoginService" /><property name="authenticator"><bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator" /></property><property name="constraintMappings"><list><ref bean="adminSecurityConstraintMapping" /><ref bean="securityConstraintMapping" /></list></property><property name="handler" ref="secHandlerCollection" /></bean><bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"></bean><!--host,端口管理 --><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><bean id="Server" depends-on="jettyPort" class="org.eclipse.jetty.server.Server"destroy-method="stop"><property name="handler"><bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"><property name="handlers"><list><ref bean="contexts" /><ref bean="securityHandler" /></list></property></bean></property></bean><bean id="invokeConnectors" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"><property name="targetObject" ref="Server" /><property name="targetMethod" value="setConnectors" /><property name="arguments"><list><bean id="Connector" class="org.eclipse.jetty.server.ServerConnector"><constructor-arg ref="Server" /><!-- see the jettyPort bean --><property name="host" value="#{systemProperties['jetty.host']}" /><property name="port" value="#{systemProperties['jetty.port']}" /></bean><!--Enable this connector if you wish to use https with web console--><!-- bean id="SecureConnector" class="org.eclipse.jetty.server.ServerConnector"><constructor-arg ref="Server" /><constructor-arg><bean id="handlers" class="org.eclipse.jetty.util.ssl.SslContextFactory"><property name="keyStorePath" value="${activemq.conf}/broker.ks" /><property name="keyStorePassword" value="password" /></bean></constructor-arg><property name="port" value="8162" /></bean --></list></property></bean><bean id="configureJetty" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"><property name="staticMethod" value="org.apache.activemq.web.config.JspConfigurer.configureJetty" /><property name="arguments"><list><ref bean="Server" /><ref bean="secHandlerCollection" /></list></property></bean><bean id="invokeStart" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" depends-on="configureJetty, invokeConnectors"><property name="targetObject" ref="Server" /><property name="targetMethod" value="start" /> </bean></beans>
jetty-realm.properties
存储登录用户的信息
# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename ...]
admin: admin, admin
user: user, user
JAAS身份验证
users.properties
存储用户名和密码。格式:用户名=密码。
admin=admin
groups.properties
定义用户组包括哪些用户。用户组=用户1,用户2(多个用户中间用逗号隔开)
admins=admin
login.config
用于登录的配置。
指定使用的属性文件:users.properties
、groups.properties
activemq {org.apache.activemq.jaas.PropertiesLoginModule requiredorg.apache.activemq.jaas.properties.user="users.properties"org.apache.activemq.jaas.properties.group="groups.properties";
};
凭据
broker-localhost.cert
broker.ks
broker.ts
client.ks
client.ts
java.security
JMX配置
jmx.access
admin readwrite
jmx.password
admin activemq
日志配置
log4j.properties
logging.properties
附录
参考
密码加密:https://activemq.apache.org/encrypted-passwords
安全:https://activemq.apache.org/security
transport:https://activemq.apache.org/configuring-transports
networks:https://activemq.apache.org/networks-of-brokers , http://www.javashuo.com/article/p-fiubjedj-np.html
KahaDB参数说明
属性名称 | 默认值 | 注释 |
---|---|---|
archiveCorruptedIndex
|
false
|
If true , 启动时归档损坏的index(非删除)。
|
archiveDataLogs
|
false
|
If true , 从data log 移动消息到 归档目录,而不是删除
|
checkForCorruptJournalFiles
|
false
|
If true , 启动时检查损坏journal日志,并尝试修复。
|
checkpointInterval
|
5000
|
Time (ms) before check-pointing the journal。checkpoint的间隔时间,默认是5000。 |
checksumJournalFiles
|
true
|
是否为每个消息日志文件提供checksum。在ActiveMQ 5.9.0之前默认值是:false .
|
cleanupInterval
|
30000
|
在检查到不再使用的消息后,在执行删除消息前的时间(ms),默认30000。 |
compactAcksAfterNoGC
|
10
|
从ActiveMQ 5.14.0开始:当启用确认压缩功能时,此值控制必须完成的存储GC周期数,在压缩逻辑被触发之前不会清除其他文件,从而可能将跨日志文件的旧确认压缩到新日志中文件。值设置越低,压缩可能发生得越快,如果经常运行,可能会影响性能。 |
compactAcksIgnoresStoreGrowth
|
false
|
从ActiveMQ 5.14.0开始:当启用确认压缩功能时,此值控制当存储仍在增长时是否运行压缩,或者是否仅在存储停止增长时(由于达到空闲或存储限制而发生)。如果启用,则无论商店仍有空间或处于活动状态,压缩都会运行,这会降低整体性能,但会更快地回收空间。 |
concurrentStoreAndDispatchQueues
|
true
|
是否分发queue消息到客户端,同时进行存储 |
concurrentStoreAndDispatchTopics
|
false
|
是否分发Topic消息到客户端,同时进行存储。 Enabling this property is not recommended. |
directory
|
activemq-data
|
The path to the directory to use to store the message store data and log files. |
directoryArchive
|
null
|
定义消息已经被消费过后,移动data log到的路径,默认null。 |
enableAckCompaction
|
true
|
从ActiveMQ 5.14.0:此设置控制商店是否将定期压缩仅包含消息确认的旧日记日志文件。通过将这些旧的确认压缩到新的日志日志文件中,可以删除较旧的文件以释放空间并允许消息存储继续操作而不会达到存储大小限制。 |
enableIndexWriteAsync
|
false
|
是否异步写索引。 |
enableJournalDiskSyncs
|
true
|
是否保证每个没有事务的内容,被同步写入磁盘(JMS持久化的时候需要)。默认为true。 从ActiveMQ 5.14.0: 被 journalDiskSyncStrategy 代替.
|
ignoreMissingJournalfiles
|
false
|
是否忽略丢失的消息日志文件 |
indexCacheSize
|
10000
|
内存中缓存索引page 的数量
|
indexDirectory
|
从ActiveMQ 5.10.0开始,可以单独设置KahaDB index files (db.data and db.redo ) 的存储路径。
|
|
indexWriteBatchSize
|
1000
|
批量写入磁盘的索引page 数量
|
journalDiskSyncInterval
|
1000
|
何时执行磁盘同步的时间间隔(ms) journalDiskSyncStrategy=periodic 。只有在自上次磁盘同步或日志转到新日志文件后对日志进行了写入时,才会执行同步。
|
journalDiskSyncStrategy
|
always
|
从ActiveMQ 5.14.0:此设置配置磁盘同步策略。可用的同步策略列表(按安全性降低和性能提高的顺序):always 确保每个日志写入后跟一个磁盘同步(JMS持久性要求)。这是最安全的选项,但也是最慢的选项,因为它需要在每次写入消息后进行同步。这相当于不推荐使用的属性 enableJournalDiskSyncs=true 。periodic 磁盘将以设定的时间间隔(如果发生写入)而不是在每次日志写入之后同步,这将减少磁盘上的负载并且应该提高吞吐量。滚动到新的日志文件时,磁盘也将同步。默认间隔为1秒。默认间隔提供非常好的性能,同时比更安全 never 磁盘同步,因为数据丢失的最大值限制为1秒。请参阅journalDiskSyncInterval 更改磁盘同步的频率。never 永远不会显式调用同步,并且操作系统将刷新到磁盘。这相当于设置deprecated属性enableJournalDiskSyncs=false 。这是最快的选择,但是最不安全,因为无法确保何时将数据刷新到磁盘。因此,代理失败时可能会发生消息丢失。
|
journalMaxFileLength
|
`32mb | 每个消息数据文件的最大size。 |
maxAsyncJobs
|
10000
|
设置最大的可以存储的异步消息队列,默认值10000,可以和concurrent MessageProducers设置成一样的值。 |
preallocationScope
|
entire_journal
|
从ActiveMQ 5.14.0:此设置配置如何预分配日记帐数据文件。默认策略使用appender线程在首次使用时预先分配日志文件。 entire_journal_async 将在单独的线程中提前使用preallocate。none 禁用预分配。在SSD上,使用 entire_journal_async 避免在首次使用时延迟写入等待预分配。注意:在HDD上,磁盘的额外线程争用会产生负面影响。因此使用默认值。
|
preallocationStrategy
|
sparse_file
|
从ActiveMQ 5.12.0:此设置配置代理在需要新日志文件时尝试预分配日志文件的方式。sparse_file - 设置文件长度,但不会用任何数据填充它。os_kernel_copy - 将预分配委派给操作系统。zeros - 每个预分配的日志文件只包含0x00 整个文件。
|
storeOpenWireVersion
|
11
|
确定封送到KahaDB日志的OpenWire命令的版本。在ActiveMQ 5.12.0之前:默认值为6 。代理的某些功能取决于较新协议修订版中存储在OpenWire命令中的信息,如果将商店版本设置为较低值,这些功能可能无法正常工作。在许多情况下,代理版本大于5.9.0的KahaDB存储仍然可以被代理读取,但会导致代理继续使用较旧的商店版本,这意味着较新的功能可能无法按预期工作。对于在ActiveMQ 5.9.0之前的版本中创建的KahaDB存储,需要手动设置storeOpenWireVersion="6" 以便启动代理而不会出现错误。
|
PolicyEntry
<policyEntry queue=">"> <!-- 死信队列策略 --><deadLetterStrategy><!--如果你想把非持久的消息发送到死信队列中。需要设置属性processNonPersistent=true --><sharedDeadLetterStrategy processNonPersistent="true"/></deadLetterStrategy>
</policyEntry>
<!--删除不活动队列:没有消息pending并且没有comsumer的队列 -->
<policyEntry queue=">" gcInactiveDestinations="true" inactiveTimoutBeforeGC="30000"/>
<policyEntry topic="FOO.>"><!--分发策略: SimpleDispatchPolicy ,PriorityNetworkDispatchPolicy --><dispatchPolicy><roundRobinDispatchPolicy /><strictOrderDispatchPolicy/></dispatchPolicy><subscriptionRecoveryPolicy><lastImageSubscriptionRecoveryPolicy /></subscriptionRecoveryPolicy>
</policyEntry>
参考:
https://activemq.apache.org/per-destination-policies
https://activemq.apache.org/dispatch-policies
https://activemq.apache.org/subscription-recovery-policy
死信队列:https://activemq.apache.org/message-redelivery-and-dlq-handling
Activemq配置文件详解相关推荐
- 全面的Spring Boot配置文件详解
全面的Spring Boot配置文件详解 Spring Boot在工作中是用到的越来越广泛了,简单方便,有了它,效率提高不知道多少倍.Spring Boot配置文件对Spring Boot来说就是入门 ...
- activemq使用详解
消息中间件ActiveMQ使用详解 </h1><div class="clear"></div><div class="post ...
- java 消息队列详解_Java消息队列-Spring整合ActiveMq的详解
本篇文章主要介绍了详解Java消息队列-Spring整合ActiveMq ,小编觉得挺不错的,现在分享给大家,也给大家做个参考.一起跟随小编过来看看吧 1.概述 首先和大家一起回顾一下Java 消息服 ...
- mybatis mysql 配置文件_Mybatis配置文件详解(4)
本次主要来了解: MyBatis数据库配置文件SqlMapConfig.xml SQL映射配置中输入映射的配置 SQL映射配置中输出映射的配置 SQL映射配置中动态SQL语句的配置 1. SqlMap ...
- MyBatis复习笔记2:配置文件详解
配置文件详解 属性(properties) MyBatis可以使用 properties 来引入外部 properties 配置文件的内容 resource:引入类路径下的资源 url:引入网络路径或 ...
- vuecli 编译后部署_基于vue-cli 打包时抽离项目相关配置文件详解
前言:当使用vue-cli进行开发时时常需要动态配置一些设置,比如接口的请求地址(axios.defaults.baseURL),这些设置可能需要在项目编译后再进行设置的,所以在vue-cli里我们需 ...
- (转) SpringBoot非官方教程 | 第二篇:Spring Boot配置文件详解
springboot采纳了建立生产就绪spring应用程序的观点. Spring Boot优先于配置的惯例,旨在让您尽快启动和运行.在一般情况下,我们不需要做太多的配置就能够让spring boot正 ...
- CENTOS7 高性能Linux集群 通过yum进行 haproxy配置 !安装 !使用!HAProxy配置文件详解
Haproxy配置 永久修改名字:便于区分虚拟机! Haproxy:hostnamectl set-hostname haproxy Web1: hostnamectl set-hostname WE ...
- 用户管理 之 用户(User)和用户组(Group)配置文件详解
作者:北南南北 来自:LinuxSir.Org 摘要:本文详解用户(User)和用户组(Group)的配置文件,本文是<Linux 用户(User)和用户组(Group)管理概述>文档的关 ...
- 【ZooKeeper】配置文件详解
ZooKeeper的配置文件详解 zkServer.sh读取的默认配置文件是$ZOOKEEPER_HOME/conf/zoo.cfg.如果要用其它配置文件.如下传递配置文件参数: zkServer.s ...
最新文章
- 第六章:密码破解系统修复
- 线程池中submit()方法与execute()方法的区别
- 机器学习算法基础——朴素贝叶斯算法
- Java动态代理之InvocationHandler最简单的入门教程
- 得到classpath和当前类的绝对路径的一些方法
- Hbulider代码注释,缩进问题 - 设置篇
- mpvue中使用vant-weapp
- 奇怪的拍立得,按下快门,你就被AI变成一张简笔涂鸦 | 补童年·有代码
- 使用vue-qriously插件,在vue项目中生成二维码
- 使用Notepad2替代系统笔记本
- 从应用层设置mx31-pdk板的lcd背光亮度
- Navicat在输入da..时自动关闭解决方法(手心输入法)
- 《灵飞经》②东岛门人 第一章 倩女灵苏
- 谷歌工程师深度技术分析“为什么ios比android流畅
- Photoshop 2023 支持 M1 Mac下载
- Unity 2017+提取模型材质
- 【图文并茂】在线一键重装win7系统详细教程
- mac mini u盘安装系统_用PE系统U盘启动盘安装操作系统
- CSS基本知识点总结
- 关于Java中抽象类和接口的一点思索
热门文章
- html如何调用flash插件,htmlflash播放器插件如何播放 网页播放器flash插件怎么解决...
- mysql vga怎么使用,mysql explain 详解
- 英特尔科技论坛 北京登场
- 小白学习Java的路上~rush
- csu1706irrational root
- 最难忘的一节计算机课,作文:最难忘的一节课
- 关于计算机系统的基本组成
- DevOps--Chef/Puppet
- 软考知识点笔记之----信息系统特点
- Python 基于 uiautomator2 实现《全民开喵铺》自动收币,自动签到,自动浏览得喵币