Caused by: org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to

cd /usr/rocketmq/distribution/target/rocketmq-4.7.1-SNAPSHOT/rocketmq-4.7.1-SNAPSHOT
#暴露的外網IP
brokerIP1=阿里雲外網ip
#所屬集羣名字
brokerClusterName=rocketmq
#broker名字,注意此處不同的配置文件填寫的不一樣
brokerName=broker-a
#0 表示 Master,>0 表示 Slave
brokerId=0
#nameServer地址,分號分割
namesrvAddr=阿里雲外網ip:9876
#在發送消息時,自動創建服務器不存在的topic,默認創建的隊列數
defaultTopicQueueNums=4
#是否允許 Broker 自動創建Topic,建議線下開啓,線上關閉
#autoCreateTopicEnable=true
#是否允許 Broker 自動創建訂閱組,建議線下開啓,線上關閉
#autoCreateSubscriptionGroup=true
#Broker 對外服務的監聽端口
listenPort=10911
#刪除文件時間點,默認凌晨 4點
deleteWhen=04
#文件保留時間,默認 48 小時
fileReservedTime=120
#commitLog每個文件的大小默認1G
mapedFileSizeCommitLog=1073741824
#ConsumeQueue每個文件默認存30W條,根據業務情況調整
mapedFileSizeConsumeQueue=300000
#destroyMapedFileIntervalForcibly=120000
#redeleteHangedFileInterval=120000
#檢測物理文件磁盤空間
diskMaxUsedSpaceRatio=88
#commitLog 存儲路徑
storePathCommitLog=/usr/local/rocketmq/store/broker/commitlog
#消費隊列存儲路徑存儲路徑
storePathConsumeQueue=/usr/local/rocketmq/store/broker/consumequeue
#消息索引存儲路徑
storePathIndex=/usr/local/rocketmq/store/broker/index
#checkpoint 文件存儲路徑
storeCheckpoint=/usr/local/rocketmq/store/broker/checkpoint
#abort 文件存儲路徑
abortFile=/usr/local/rocketmq/store/broker/abort
#限制的消息大小
maxMessageSize=65536
#flushCommitLogLeastPages=4
#flushConsumeQueueLeastPages=2
#flushCommitLogThoroughInterval=10000
#flushConsumeQueueThoroughInterval=60000
#Broker 的角色
#- ASYNC_MASTER 異步複製Master
#- SYNC_MASTER 同步雙寫Master
#- SLAVE
brokerRole=SYNC_MASTER
#刷盤方式
#- ASYNC_FLUSH 異步刷盤
#- SYNC_FLUSH 同步刷盤
flushDiskType=ASYNC_FLUSH
#checkTransactionMessageEnable=false
#發消息線程池數量
#sendMessageThreadPoolNums=128
#拉消息線程池數量
#pullMessageThreadPoolNums=128

配置好broker.conf文件後,啓動命令:

###rocketmq cmd

# 關閉啓動mqname服務
sh bin/mqshutdown namesrv
nohup sh bin/mqnamesrv &

# 關閉啓動mqbroker配置
sh bin/mqshutdown broker
nohup sh bin/mqbroker -c conf/broker.conf &

# 打包rocketmq-console.jar
mvn clean package -Dmaven.test.skip=true

完成阿里服務器上面rocketmq配置啓動後,還需要在阿里上面新增安全組配置

開放內網和外網的映射端口
內網  外網
10911   10911
10909   10909(這個是vip通道端口,如果不使用則不需要設置)

這兩個IP必須加到安全組裏面不然就會報錯:

Caused by: org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to <阿里公網ip:10911> failed

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章