Rocketmq 4.2.0 安裝

Rocketmq 4.2.0 安裝

標籤(空格分隔): RocketMQapache


[toc]ui

1. 編譯

> unzip rocketmq-all-4.2.0-source-release.zip
  > cd rocketmq-all-4.2.0/
  > mvn -Prelease-all -DskipTests clean install -U
  > cd distribution/target/apache-rocketmq

2. 啓動 Name Server

> nohup sh bin/mqnamesrv &
  > tail -f ~/logs/rocketmqlogs/namesrv.log
  The Name Server boot success...

3. 啓動Broker

> nohup sh bin/mqbroker -n localhost:9876 &
  > tail -f ~/logs/rocketmqlogs/broker.log 
  The broker[%s, 172.30.30.233:10911] boot success...
  # 啓動加入配置文件參數
 nohup sh bin/mqbroker -c  /paxos/software/apache-rocketmq-all/conf/2m-2s-sync/broker-a.properties -n 127.0.0.1:9876 &
 [rocketmq@localhost rocketmq]$ more /paxos/software/apache-rocketmq-all/conf/2m-2s-sync/broker-a.properties
#Broker對外服務的監聽端口 
#listenPort = 10911 
## Name Server地址 
#namesrvAddr=192.168.0.26:9876  
#本機IP地址,默認系統自動識別,可是某些多網卡機器會存在識別錯誤的狀況,這種狀況下能夠人工配置
brokerIP1=192.168.0.26
#Broker所屬哪一個集羣,其中缺省值爲DefaultCluster
brokerClusterName=DefaultCluster
#本機主機名
brokerName=broker-a
#BrokerId,必須是大等於0的整數,0表示Master,>0表示Slave,一個Master能夠掛多個Slave,Master與Slave經過BrokerName來配對
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=SYNC_MASTER
flushDiskType=ASYNC_FLUSH

4. Send & Receive Messages

> export NAMESRV_ADDR=localhost:9876
 > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
 SendResult [sendStatus=SEND_OK, msgId= ...

 > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
 ConsumeMessageThread_%d Receive New Messages: [MessageExt...

5. 中止服務

> sh bin/mqshutdown broker
The mqbroker(36695) is running...
Send shutdown request to mqbroker(36695) OK

> sh bin/mqshutdown namesrv
The mqnamesrv(36664) is running...
Send shutdown request to mqnamesrv(36664) OK
相關文章
相關標籤/搜索