[MQ]关于ActiveMQ的配置
property name
default value
Comments
directory
activemq-data
the path to the directory to use to store the message store data and log files
indexWriteBatchSize
1000
number of indexes written in a batch
indexCacheSize
10000
number of index pages cached in memory
enableIndexWriteAsync
false
if set, will asynchronously write indexes
journalMaxFileLength
32mb
a hint to set the maximum size of the message data logs
enableJournalDiskSyncs
true
ensure every non transactional journal write is followed by a disk sync (JMS durability requirement)
cleanupInterval
30000
time (ms) before checking for a discarding/moving message data logs that are no longer used
checkpointInterval
5000
time (ms) before checkpointing the journal
ignoreMissingJournalfiles
false
If enabled, will ignore a missing message log file
checkForCorruptJournalFiles
false
If enabled, will check for corrupted Journal files on startup and try and recover them
checksumJournalFiles
false
create a checksum for a journal file - to enable checking for corrupted journals
Available since version 5.4:
??archiveDataLogs
false
If enabled, will move a message data log to the archive directory instead of deleting it.
directoryArchive
null
Define the directory to move data logs to when they all the messages they contain have been consumed.
databaseLockedWaitDelay
10000
time (ms) before trying to get acquire a the database lock (used by shared master/slave)
maxAsyncJobs
10000
the maximum number of asynchronous messages that will be queued awaiting storage (should be the same as the number of concurrent MessageProducers)
concurrentStoreAndDispatchTopics
false
enable the dispatching of Topic messages to interested clients to happen concurrently with message storage
concurrentStoreAndDispatchQueues
true
enable the dispatching of Queue messages to interested clients to happen concurrently with message storage
?
2)AMQ持久配置property name
default value
Comments
directory
activemq-data
the path to the directory to use to store the message store data and log files
useNIO
true
use NIO to write messages to the data logs
syncOnWrite
false
sync every write to disk
maxFileLength
32mb
a hint to set the maximum size of the message data logs
persistentIndex
true
use a persistent index for the message logs. If this is false, an in-memory structure is maintained
maxCheckpointMessageAddSize
4kb
the maximum number of messages to keep in a transaction before automatically committing
cleanupInterval
30000
time (ms) before checking for a discarding/moving message data logs that are no longer used
indexBinSize
1024
default number of bins used by the index. The bigger the bin size - the better the relative performance of the index
indexKeySize
96
the size of the index key - the key is the message id
indexPageSize
16kb
the size of the index page - the bigger the page - the better the write performance of the index
directoryArchive
archive
the path to the directory to use to store discarded data logs
archiveDataLogs
false
if true data logs are moved to the archive directory instead of being deleted
?
3)systemUsage配置property name
default value
Comments
memoryUsage
20M
amq使用内存大小,照amq论坛上说,这个值应该大于所有durable desitination设置的
memoryUsage之和,否则会导致硬盘swap,影响性能。
storeUsage
1G
kaha数据存储大小,如果设置不足,性能会下降到1个1个发
tempUsage
100M
非persistent的消息存储在temp区域
4)其他配置http://activemq.apache.org/nms/configuring.html
?
4.1)Failover Transport OptionsOption Name
Default
Description
transport.timeout
-1
Time that a send operation blocks before failing.
transport.initialReconnectDelay
10
Time in Milliseconds that the transport waits before attempting to reconnect the first time.
transport.maxReconnectDelay
30000
The max time in Milliseconds that the transport will wait before attempting to reconnect.
transport.backOffMultiplier
2
The amount by which the reconnect delay will be multiplied by if useExponentialBackOff is enabled.
transport.useExponentialBackOff
true
Should the delay between connection attempt grow on each try up to the max reconnect delay.
transport.randomize
true
Should the Uri to connect to be chosen at random from the list of available Uris.
transport.maxReconnectAttempts
0
Maximum number of time the transport will attempt to reconnect before failing (0 means infinite retries)
transport.startupMaxReconnectAttempts
0
Maximum number of time the transport will attempt to reconnect before failing when there has never been a connection made. (0 means infinite retries) (included in NMS.ActiveMQ v1.5.0+)
transport.reconnectDelay
10
The delay in milliseconds that the transport waits before attempting a reconnection.
transport.backup
false
Should the Failover transport maintain hot backups.
transport.backupPoolSize
1
If enabled, how many hot backup connections are made.
transport.trackMessages
false
keep a cache of in-flight messages that will flushed to a broker on reconnect
transport.maxCacheSize
256
Number of messages that are cached if trackMessages is enabled.
transport.updateURIsSupported
true
Update the list of known brokers based on BrokerInfo messages sent to the client.
?
4.2)Connection OptionsOption Name
Default
Description
connection.AsyncSend
false
Are message sent Asynchronously.
connection.AsyncClose
true
Should the close command be sent Asynchronously
connection.AlwaysSyncSend
false
Causes all messages a Producer sends to be sent Asynchronously.
connection.CopyMessageOnSend
true
Copies the Message objects a Producer sends so that the client can reuse Message objects without affecting an in-flight message.
connection.ProducerWindowSize
0
The ProducerWindowSize is the maximum number of bytes in memory that a producer will transmit to a broker before waiting for acknowledgement messages from the broker that it has accepted the previously sent messages. In other words, this how you configure the producer flow control window that is used for async sends where the client is responsible for managing memory usage. The default value of 0 means no flow control at the client. See also Producer Flow Control
connection.useCompression
false
Should message bodies be compressed before being sent.
connection.sendAcksAsync
false
Should message acks be sent asynchronously
connection.messagePrioritySupported
true
Should messages be delivered to the client based on the value of the Message Priority header.
connection.dispatchAsync
false
Should the broker dispatch messages asynchronously to the connection's consumers.
?
4.3)OpenWire OptionsOption Name
Default
Description
wireFormat.stackTraceEnabled
false
Should the stack trace of exception that occur on the broker be sent to the client? Only used by openwire protocol.
wireFormat.cacheEnabled
false
Should commonly repeated values be cached so that less marshalling occurs? Only used by openwire protocol.
wireFormat.tcpNoDelayEnabled
false
Does not affect the wire format, but provides a hint to the peer that TCP nodelay should be enabled on the communications Socket. Only used by openwire protocol.
wireFormat.sizePrefixDisabled
false
Should serialized messages include a payload length prefix? Only used by openwire protocol.
wireFormat.tightEncodingEnabled
false
Should wire size be optimized over CPU usage? Only used by the openwire protocol.
wireFormat.maxInactivityDuration
30000
The maximum inactivity duration (before which the socket is considered dead) in milliseconds. On some platforms it can take a long time for a socket to appear to die, so we allow the broker to kill connections if they are inactive for a period of time. Use by some transports to enable a keep alive heart beat feature. Set to a value <= 0 to disable inactivity monitoring.
maxInactivityDurationInitalDelay
10000
The initial delay in starting the maximum inactivity checks (and, yes, the word 'Inital' is supposed to be misspelled like that)
?
5)安全配置1、控制台安全配置,打开conf/jetty.xml文件,找到
??? <bean id="securityConstraint" value="BASIC" />
??????? <property name="roles" value="admin" />
??????? <property name="authenticate" value="false" />
??? </bean>
?? 将“false”改为“true”即可。用户名和密码存放在conf/jetty-realm.properties文件中。
2、生产者和消费者连接MQ需要密码
?? 打开conf/activemq.xml文件,在<broker>标签里的<systemUsage>标签前加入:
?? <plugins>??
<simpleAuthenticationPlugin>??
<users>??
<authenticationUser username="${activemq.username}" password="${activemq.password}" groups="users,admins"/>??
</users>??
</simpleAuthenticationPlugin>??
?? </plugins>
?注意必须在<systemUsage>标签前,否则启动ActiveMQ会报错。
?
用户名和密码存放在conf/credentials.properties文件中