1. The public configuration class of the client: ClientConfig
Parameter name default value description
namesrvAddrNameServer |
|
List of addresses, multiple NameServer addresses separated by semicolons |
clientIp |
Native IP |
The client's local IP address, some machines will send the case that the client's IP address cannot be recognized, and the application needs to be specified in the code. |
instanceName |
DEFAULT |
Client instance name, multiple Producers and Consumers created by the client actually share an internal instance (this instance includes network connections, thread resources, etc.) |
clientCallbackExecutorThreads |
4 |
The number of asynchronous callback threads of the communication layer |
pollNameServerInterval |
30000 |
Polling NameServer interval time, in milliseconds |
heartbeatBrokerInterval |
30000 |
Send heartbeat interval to Broker, in milliseconds |
persistConsumerOffsetInterval |
5000 |
Persistent Consumer consumption progress interval, in milliseconds |
2. Producer configuration
Parameter name default value description
producerGroup |
DEFAULT_PRODUCER |
Producer group name. If multiple Producers belong to an application and send the same message, they should be grouped into the same group |
createTopicKey |
TBW102 |
When sending a message, automatically create a server that does not exist |
topicdefaultTopicQueueNums |
4 |
When sending a message, automatically create a topic that does not exist on the server, and the number of queues created by default |
sendMsgTimeout |
10000 |
Send message timeout, in milliseconds |
compressMsgBodyOverHowmuch |
4096 |
The message Body exceeds the size to start compression (Consumer will automatically decompress after receiving the message), in bytes |
retryAnotherBrokerWhenNotStoreOK |
FALSE |
If sending a message returns sendResult, but sendStatus!=SEND_OK, whether to retry sending |
maxMessageSize |
131072 |
The message size limited by the client, exceeds the error, and the server will also limit (default 128k) |
transactionCheckListener |
|
The transaction message will check the listener. If a transaction message is sent, it must be set |
checkThreadPoolMinSize |
1 |
The size of the thread pool when the Broker checks the transaction status of the Producer |
checkThreadPoolMaxSize |
1 |
The size of the thread pool when the Broker checks the transaction status of the Producer |
checkRequestHoldMax |
2000 |
When the Broker checks the status of the Producer transaction, the size of the Producer's local buffer request queue |
3. PushConsumer configuration
Parameter name default value description
consumerGroup |
DEFAULT_CONSUMER |
Consumer group name. If multiple consumers belong to an application, subscribe to the same message, and have the same consumption logic, they should be grouped into the same group |
messageModel |
CLUSTERING |
The message model supports the following two types: cluster consumption and broadcast consumption |
consumerFromWhere |
Consumer_FROM_LAST_OFFSET |
After the Consumer starts, where does it start to consume by default? |
allocateMessageQueueStrategy |
AllocateMessage QueueAveragelyRebalance |
Algorithm Implementation Strategy |
subscription |
{} |
Subscription relationship |
messageListener |
|
message listener |
offsetStore |
|
Consumption progress storage |
consumerThreadMin |
10 |
Number of consumer thread pools |
consumerThreadMax |
20 |
Number of consumer thread pools |
consumeConsurrentlMaxSpan |
2000 |
The maximum span allowed by single-queue parallel consumption |
pullThresholdForQueue |
1000 |
The maximum number of buffered messages in the local queue for pulling messages |
Pullinterval |
0 |
The pull message interval, because it is long polling, is 0, but if flow control is applied, a value greater than 0 can also be set, in milliseconds |
consumeMessageBatchMaxSize |
1 |
Batch consumption, how many messages to consume at a time |
pullBatchSize |
32 |
Pull messages in batches, how many messages can be pulled at a time |
4. PullConsumer configuration
Parameter name default value description
consumerGroup |
|
Consumer group name. If multiple consumers belong to an application, subscribe to the same message, and have the same consumption logic, they should be grouped into the same group |
brokerSuspendMaxTimeMills |
20000 |
Long polling, the longest time that the Consumer pull message request hangs on the Broker, in milliseconds |
consumerPullTimeout |
10000 |
Non-long polling, pull message timeout, in milliseconds |
consumerTimeoutMillisWhenSuspend |
30000 |
Long polling, the Consumer pulls the message requesting the Broker to hang for more than the specified time, and the client considers it to be timed out, in milliseconds |
messageModel |
BROADCASTING |
Message type, supports the following two: cluster consumption; broadcast mode |
messageQueueListener |
|
Monitor queue changes |
offsetStore |
|
Consumption progress storage |
registerTopics |
|
The set of registered topics |
allocateMessageQueueStrategyRebalance |
|
Algorithm Implementation Strategy |
- Broker parameter configuration
Parameter name default value description
listenPort |
10911 |
Broker's listening port for external services |
namesrvAddr |
Null |
NameServer address |
brokerIP1 |
Native IP |
The ip address of the local machine is automatically recognized by the default system, but some multi-network card machines may have recognition errors. In this case, manual configuration can be performed. |
brokerName |
|
local hostname |
brokerClusterName |
DefaultCluster |
Which cluster the broker belongs to |
brokerId |
0 |
BrokerId, must be an integer greater than or equal to 0, 0 means Master, greater than 0 means Slave, a Master can hang multiple Slaves, Master and Slave are paired by BrokerName |
storePathCommitLog |
$HOME/store/commitlog |
commitLog storage path |
storePathConsumerQueue |
$HOME/store/consumequeue |
Consumption queue storage path |
storePathIndex |
$HOME/store/index |
message index storage queue |
deleteWhen |
4 |
Delete time point, the default is 4 am |
fileReserverdTime |
48 |
File retention time, default 48 hours |
maxTransferBytesOnMessageInMemory |
262144 |
单次pull消息(内存)传输的最大字节数 |
maxTransferCountOnMessageInMemory |
32 |
单次pull消息(内存)传输的最大条数 |
maxTransferBytesOnMessageInDisk |
65535 |
单次Pull消息(磁盘)传输的最大字节数 |
maxTransferCountOnMessageInDisk |
8 |
单次pull消息(磁盘)传输的最大条数 |
messageIndexEnable |
TRUE |
是否开启消息索引功能 |
messageIndexSafe |
FALSE |
是否提供安全的消息索引机制,索引保证不丢 |
brokerRole |
ASYNC_MASTER |
Broker的角色:ASYNC_MASTER异步复制Master; SYNC_MASTER同步双写MASTER; SLAVE |
flushDiskType |
ASYNC_FLUSH |
刷盘方式: ASYNC_FLUSH异步刷盘;SYNC_FLUSH同步刷盘clientFileForciblyEnable |
http://blog.csdn.net/u013256816/article/details/54743551