rocketmq-4.4.0從零單排(詳細(xì)參數(shù)與配置)

rocketmq采用netty作為底層通信框架,其中具體技術(shù)細(xì)節(jié)如下:

1、通信協(xié)議

rocketmq通信協(xié)議采用netty作為底層通信框架弛槐,協(xié)議格式采用自定義方式實現(xiàn)枫虏。具體協(xié)議如下:


rocketmq協(xié)議格式

(4個字節(jié)的數(shù)據(jù)包長度與4個字節(jié)的頭長度,這個包長與頭長怎么會一樣亮航?感覺可以再優(yōu)化下)

2、通信加密

rocketmq采用netty鏈接時可以使用netty 的sslContext方式加密傳輸,不過需要加相關(guān)啟動參數(shù)上(-Dkey=value)睡毒,啟動參數(shù)如下(省略-D):

tls.server.mode=disabled (不加密傳輸) /?permissive (默認(rèn)) /?enforcing? ?(當(dāng)然了,如果沒有檢測到證書路徑也不會選擇加密傳輸)

tls.server.certPath=xxx

tls.server.keyPath=xxx

tls.server.trustCertPath=xxx

以上三個均是證書路徑冗栗,不過是服務(wù)端的吕嘀,客戶端也有,客戶端如下:

tls.client.certPath=xxx

tls.client.keyPath=xxx

tls.client.trustCertPath=xxx

3贞瞒、rocketmq-netty默認(rèn)線程數(shù)量

rocketmq采用主從線程模型

thread-acceptor : 1

thread-boss : 3

thread-worker : 8

4偶房、rocketmq可配參數(shù)


rocketmq組件配置架構(gòu)圖

1)netty-server-config參數(shù)

listenPort=8888

serverWorkerThreads=8 (這是worker線程)

serverCallbackExecutorThreads=0

serverSelectorThreads=3 (這是boss線程)

serverOnewaySemaphoreValue=256

serverAsyncSemaphoreValue=64

serverChannelMaxIdleTimeSeconds=120(默認(rèn)空閑2分鐘斷掉)

serverSocketSndBufSize=65535

serverSocketRcvBufSize=65535

serverPooledByteBufAllocatorEnable=true(是否使用內(nèi)存池,默認(rèn)使用)

useEpollNativeSelector=false(是否采用netty自己實現(xiàn)的EpollLoopGroup)

2)? netty-client-config參數(shù)

clientWorkerThreads =4

clientCallbackExecutorThreads=核心數(shù)量

clientOnewaySemaphoreValue = 65535

clientAsyncSemaphoreValue = 65535

connectTimeoutMillis =3000

channelNotActiveInterval=1000 *60

clientChannelMaxIdleTimeSeconds=120

clientSocketSndBufSize = 65535

clientSocketRcvBufSize = 65535

clientPooledByteBufAllocatorEnable=false

clientCloseSocketIfTimeout=false

useTLS=false

3)nameserver-config參數(shù)

rocketmq.home.dir=xxx(這是啟動參數(shù)军浆,not properties)

user.home=xxx(啟動參數(shù)棕洋,存放kvConfig.json、namesrv.properties)

productEnvName=center(默認(rèn)生產(chǎn)環(huán)境名稱)

orderMessageEnable=false(有序消息可用性)

4)? broker-config參數(shù)

aclEnable=false

adminBrokerThreadPoolNums=16

autoCreateSubscriptionGroup=true

autoCreateTopicEnable=true

brokerClusterName=DefaultCluster

brokerFastFailureEnable=true

brokerId=0

brokerIP1=localhost

brokerIP2=localhost

brokerName=localhost

brokerPermission=4 | 2 (read | write)

brokerTopicEnable=true

clientManagerThreadPoolQueueCapacity=1000000

clientManageThreadPoolNums=32

clusterTopicEnable=true

commercialBaseCount=1

commercialBigCount=1

commercialEnable=true

commercialTimerCount=1

commercialTransCount=1

compressedRegister=false

consumerFallbehindThreshold=1024L *1024 *1024 *16

consumerManagerThreadPoolQueueCapacity=1000000

consumerManageThreadPoolNums=32

defaultTopicQueueNums=8

disableConsumeIfConsumerReadSlowly=false

enableCalcFilterBitMap=false

enablePropertyFilter=false

endTransactionPoolQueueCapacity=100000

endTransactionThreadPoolNums=8 + 核心數(shù)量 *2

expectConsumerNumUseFilter=32

fetchNamesrvAddrByAddressServer=false

filterDataCleanTimeSpan=24 *3600 *1000

filterServerNums=0

filterSupportRetry=false

flushConsumerOffsetHistoryInterval=1000 *60

flushConsumerOffsetInterval=1000 *5

forceRegister=true

heartbeatThreadPoolNums=Math.min(32, 核心數(shù)量)

heartbeatThreadPoolQueueCapacity=50000

highSpeedMode=false

longPollingEnable=true

maxDelayTime=40

maxErrorRateOfBloomFilter=20

messageStorePlugIn=""

msgTraceTopicName=RMQ_SYS_TRACE_TOPIC

namesrvAddr=localhost:8080;localhost:8080

notifyConsumerIdsChangedEnable=true

pullMessageThreadPoolNums=16 + 核心數(shù)量 *2

pullThreadPoolQueueCapacity=100000

queryMessageThreadPoolNums=8 + 核心數(shù)量

queryThreadPoolQueueCapacity=20000

regionId=DefaultRegion

registerBrokerTimeoutMills=6000

registerNameServerPeriod=1000 *30

rejectTransactionMessage=false

rocketmqHome=你的環(huán)境變量-ROCKETMQ_HOME

sendMessageThreadPoolNums=1

sendThreadPoolQueueCapacity=10000

shortPollingTimeMills=1000

slaveReadEnable=false

startAcceptSendRequestTimeStamp=0

traceOn=true

traceTopicEnable=false

transactionCheckInterval=60 *1000

transactionCheckMax=15

transactionTimeOut=6 *1000

transferMsgByHeap=true

waitTimeMillsInHeartbeatQueue=31 *1000

waitTimeMillsInPullQueue=5 *1000

waitTimeMillsInSendQueue=200

waitTimeMillsInTransactionQueue=3 *1000

5) message-store-config

accessMessageInMemoryMaxRatio=40

bitMapLengthConsumeQueueExt=64

brokerRole=ASYNC_MASTER

checkCRCOnRecover=true

cleanFileForciblyEnable=true

cleanResourceInterval=10000

commitCommitLogLeastPages=4

commitCommitLogThoroughInterval=200

commitIntervalCommitLog=200

debugLockEnable=false

defaultQueryMaxNum=32

deleteCommitLogFilesInterval=100

deleteConsumeQueueFilesInterval=100

deleteWhen="04" // When to delete,default is at 4 am

destroyMapedFileIntervalForcibly=1000 *120

diskFallRecorded=true

diskMaxUsedSpaceRatio=75

duplicationEnable=false

enableConsumeQueueExt=false

fastFailIfNoBufferInStorePool=false

fileReservedTime=72

flushCommitLogLeastPages=4

flushCommitLogThoroughInterval=1000 *10

flushCommitLogTimed=false

flushConsumeQueueLeastPages=2

flushConsumeQueueThoroughInterval=1000 *60

flushDelayOffsetInterval=1000 *10

flushDiskType=ASYNC_FLUSH

flushIntervalCommitLog=500

flushIntervalConsumeQueue=1000

flushLeastPagesWhenWarmMapedFile=1024 /4 *16

haHousekeepingInterval=1000 *20

haListenPort=10912

haSendHeartbeatInterval=1000 *5

haSlaveFallbehindMax=1024 *1024 *256

haTransferBatchSize=1024 *32

mapedFileSizeCommitLog=1024 *1024 *1024

mappedFileSizeConsumeQueueExt=48 *1024 *1024

maxHashSlotNum=5000000

maxIndexNum=5000000 *4

maxMessageSize=1024 *1024 *4

maxMsgsNumBatch=64

maxTransferBytesOnMessageInDisk=1024 *64

maxTransferBytesOnMessageInMemory=1024 *256

maxTransferCountOnMessageInDisk=8

maxTransferCountOnMessageInMemory=32

messageDelayLevel=1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h

messageIndexEnable=true

messageIndexSafe=false

offsetCheckInSlave=false

osPageCacheBusyTimeOutMills=1000

putMsgIndexHightWater=600000

redeleteHangedFileInterval=1000 *120

storePathCommitLog=...

storePathRootDir=...

syncFlushTimeout=1000 *5

transientStorePoolEnable=false

transientStorePoolSize=5

useReentrantLockWhenPutMessage=false

warmMapedFileEnable=false

5 特殊參數(shù)

broker可以動態(tài)調(diào)整nameserver地址乒融,頻率是每2分鐘以http的請求方式獲取nameserver地址然后更新掰盘,這樣可以增加系統(tǒng)高可用。熱備broker鏈接nameserver需要啟動參數(shù)赞季,非配置文件愧捕,啟動參數(shù)如下:

-Drocketmq.namesrv.domain=jmenv.tbsite.net

-Drocketmq.namesrv.domain.subgroup=nsaddr

默認(rèn) jmenv.tbsite.net:8080/rocketmq/nsaddr

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市申钩,隨后出現(xiàn)的幾起案子次绘,更是在濱河造成了極大的恐慌,老刑警劉巖撒遣,帶你破解...
    沈念sama閱讀 217,907評論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件邮偎,死亡現(xiàn)場離奇詭異,居然都是意外死亡义黎,警方通過查閱死者的電腦和手機禾进,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,987評論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來廉涕,“玉大人泻云,你說我怎么就攤上這事艇拍。” “怎么了宠纯?”我有些...
    開封第一講書人閱讀 164,298評論 0 354
  • 文/不壞的土叔 我叫張陵淑倾,是天一觀的道長。 經(jīng)常有香客問我征椒,道長娇哆,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,586評論 1 293
  • 正文 為了忘掉前任勃救,我火速辦了婚禮碍讨,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘蒙秒。我一直安慰自己勃黍,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 67,633評論 6 392
  • 文/花漫 我一把揭開白布晕讲。 她就那樣靜靜地躺著覆获,像睡著了一般。 火紅的嫁衣襯著肌膚如雪瓢省。 梳的紋絲不亂的頭發(fā)上弄息,一...
    開封第一講書人閱讀 51,488評論 1 302
  • 那天,我揣著相機與錄音勤婚,去河邊找鬼摹量。 笑死,一個胖子當(dāng)著我的面吹牛馒胆,可吹牛的內(nèi)容都是我干的缨称。 我是一名探鬼主播,決...
    沈念sama閱讀 40,275評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼祝迂,長吁一口氣:“原來是場噩夢啊……” “哼睦尽!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起型雳,我...
    開封第一講書人閱讀 39,176評論 0 276
  • 序言:老撾萬榮一對情侶失蹤当凡,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后四啰,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體宁玫,經(jīng)...
    沈念sama閱讀 45,619評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡粗恢,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,819評論 3 336
  • 正文 我和宋清朗相戀三年柑晒,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片眷射。...
    茶點故事閱讀 39,932評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡匙赞,死狀恐怖佛掖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情涌庭,我是刑警寧澤芥被,帶...
    沈念sama閱讀 35,655評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站坐榆,受9級特大地震影響拴魄,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜席镀,卻給世界環(huán)境...
    茶點故事閱讀 41,265評論 3 329
  • 文/蒙蒙 一匹中、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧豪诲,春花似錦顶捷、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,871評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至交播,卻和暖如春重虑,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背秦士。 一陣腳步聲響...
    開封第一講書人閱讀 32,994評論 1 269
  • 我被黑心中介騙來泰國打工嚎尤, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人伍宦。 一個月前我還...
    沈念sama閱讀 48,095評論 3 370
  • 正文 我出身青樓芽死,卻偏偏與公主長得像,于是被迫代替她去往敵國和親次洼。 傳聞我的和親對象是個殘疾皇子关贵,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,884評論 2 354

推薦閱讀更多精彩內(nèi)容