RocketMQ快速入門

環境要求

  1. 64位系統,Linux/Unix/Mac
  2. 64位 JDK 1.8+
  3. Maven 3.2.x
  4. Git

若是下載binary包的話,只須要前兩條就能夠了。下載地址: RocketMQapache

啓動Name Server

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

Name Server的默認監聽端口爲9876服務器

啓動Broker

> nohup sh bin/mqbroker -n localhost:9876 &
> tail -f ~/logs/rocketmqlogs/broker.log 
The broker[%s, 172.30.30.233:10911] boot success...

發送消息Producer/接收消息consumer

> 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...

中止服務器

> 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
相關文章
相關標籤/搜索