rocketMQ安装与启动

Posted 一只猪的思考

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rocketMQ安装与启动相关的知识,希望对你有一定的参考价值。

一、下载

https://rocketmq.apache.org/dowloading/releases/

二、启动服务

  1. 启动nameserver
yy@ljdeMacBook-Pro rocketmq-all-4.9.4-bin-release % 
yy@ljdeMacBook-Pro rocketmq-all-4.9.4-bin-release % cd bin #进入启动目录
yy@ljdeMacBook-Pro bin % sh mqnamesrv #启动nameserver
Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
The Name Server boot success. serializeType=JSON
  1. 启动broker
yy@ljdeMacBook-Pro rocketmq-all-4.9.4-bin-release % cd conf #修改broker配置
yy@ljdeMacBook-Pro conf % ls
2m-2s-async		dledger			plain_acl.yml
2m-2s-sync		logback_broker.xml	tools.yml
2m-noslave		logback_namesrv.xml
broker.conf		logback_tools.xml
yy@ljdeMacBook-Pro conf % vim broker.conf 
yy@ljdeMacBook-Pro conf % cd ../bin 
yy@ljdeMacBook-Pro bin % mqbroker -n localhost:9876 -c ../conf/broker.conf 
The broker[broker-a, 127.0.0.1:10911] boot success. serializeType=JSON and name server is localhost:9876

具体修改内容如下:

brokerIP1= 具体绑定的地址

  1. 测试
#终端1
# 生产消息
# 1.设置环境变量
export NAMESRV_ADDR=localhost:9876
# 2.使用安装包的Demo发送消息
sh tools.sh org.apache.rocketmq.example.quickstart.Producer
​
#终端2
# 消费消息
# 1.设置环境变量
export NAMESRV_ADDR=localhost:9876
# 2.接收消息
sh tools.sh org.apache.rocketmq.example.quickstart.Consumer

如果能接受到消息则启动成功

以上是关于rocketMQ安装与启动的主要内容,如果未能解决你的问题,请参考以下文章

rocketMQ安装与启动

安装配置RocketMQ

安装配置RocketMQ

安装配置RocketMQ

RocketMQ启动测试与关闭

rocketMQ安装配置+与java交互API操作+集群搭建+高级特性