安装
官网 https://rocketmq.apache.org/zh/docs/4.x/introduction/02quickstart
下载 https://archive.apache.org/dist/rocketmq/4.9.4/rocketmq-all-4.9.4-source-release.zip
解压后上传
启动NameServer
修改runserver.sh,分配内存如果比系统高会导致启动失败
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
启动
nohup sh bin/mqnamesrv &
回车,输入
tail -f ~/logs/rocketmqlogs/namesrv.log
验证namesrv是否启动成功
启动broker
修改/bin/runbroker.sh如下行,分配内存如果比系统高会导致启动失败
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m"
启动
nohup sh bin/mqbroker -n localhost:9876 &
回车,输入
tail -f ~/logs/rocketmqlogs/broker.log
发送消息
export NAMESRV_ADDR=localhost:9876
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
接收消息
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
关闭Server
无论是关闭nameserver还是broker,都是使用bin/mqshutdown命令。
关闭nameserver
sh bin/mqshutdown broker
关闭broker
sh bin/mqshutdown namesrv
安装控制台
下载 https://github.com/apache/rocketmq-dashboard/releases/tag/rocketmq-dashboard-1.0.0
用IDEA打包后,上传 rocketmq-dashboard-1.0.0.jar,运行
nohup java -jar ./rocketmq-dashboard-1.0.0.jar &
地址 http://192.168.56.203:8080/