一、CentOS 7.9 安装 rocketmq-4.9.2地址:
- https://rocketmq.apache.org
- https://github.com/apache/rocketmq
- https://archive.apache.org/dist/rocketmq/4.9.2/rocketmq-all-4.9.2-bin-release.zip
文章插图
二、下载RocketMQwget https://archive.apache.org/dist/rocketmq/4.9.2/rocketmq-all-4.9.2-bin-release.zip安装解压工具
yum install -y unzip zip解压
unzip rocketmq-all-4.9.2-bin-release.zip -d /opt/进入文件夹
cd /opt/rocketmq-4.9.2
文章插图
三、配置环境变量将rocketmq服务加入环境变量
vim /etc/profileexport PATH=$PATH:/opt/rocketmq-4.9.2/bin# 使配置文件生效source /etc/profile四、按需修改启动内存vim runserver.sh
文章插图
vim runbroker.sh
文章插图
vim tools.sh
文章插图
五、创建目录创建日志目录
mkdir -p /opt/rocketmq-4.9.2/logs六、启动NameServercd /opt/rocketmq-4.9.2/binnohup sh mqnamesrv > /opt/rocketmq-4.9.2/logs/mqnamesrv.log 2>&1 &验证是否启动OK:
tail -f /opt/rocketmq-4.9.2/logs/mqnamesrv.log# 输出nohup: ignoring inputJava 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 releaseJava HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.Java HotSpot(TM) 64-Bit Server VM warning: MaxNewSize (262144k) is equal to or greater than the entire heap (262144k). A new max generation size of 262080k will be used.The Name Server boot success. serializeType=JSON如果成功启动,能看到类似如下的日志
The Name Server boot success. ...
七、启动Broker/opt/rocketmq-4.9.2/binnohup sh mqbroker -n 127.0.0.1:9876 > /opt/rocketmq-4.9.2/logs/mqbroker.log 2>&1 &验证是否启动OK
tail -f /opt/rocketmq-4.9.2/logs/mqbroker.log# 输出nohup: ignoring inputThe broker[ecs-65685, 192.168.0.98:10911] boot success. serializeType=JSON and name server is 127.0.0.1:9876如果启动成功,能看到类似如下的日志:
The broker[itmuchcomdeMacBook-Pro.local, 192.168.43.197:10911] boot success. serializeType=JSON and name server is localhost:9876
八、测试在发送/接收消息之前 , 需要告诉客户名称服务器的位置 。
RocketMQ 提供了多种方法来实现这一点 。为了简单起见,使用环境变量NAMESRV_ADDR
# 开启两个端口,都执行一下命令export NAMESRV_ADDR=localhost:9876发送消息
# Producer 端口一执行sh /opt/rocketmq-4.9.2/bin/tools.sh org.apache.rocketmq.example.quickstart.Producer接收消息
# Consumer 端口二执行sh /opt/rocketmq-4.9.2/bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer九、安装RocketMQ控制台1 编译源码方式
前置环境
- 64bit OS, Linux/Unix/Mac is recommended
- 64bit JDK 1.8+
- Maven 3.2.x
https://github.com/apache/rocketmq-dashboardgit clone https://github.com/apache/rocketmq-dashboard.git3 在启动之前先修改下端口,默认的8080 已占用,一定要先修改端口,在进行编译 。
vim src/main/resources/application.yml
文章插图
文章插图
4 Maven spring-boot 方式启动
mvn spring-boot:run5 或者 使用Maven先build成jar包,再java -jar方式启动
mvn clean package -Dmaven.test.skip=truejava -jar target/rocketmq-dashboard-1.0.1-SNAPSHOT.jar
推荐阅读
- 不安装运行时运行 .NET 程序 - NativeAOT
- CentOS部署MySQL
- CentOS 7.9 安装 nginx-1.22.0
- 超详细 R及R Studio下载安装教程
- CentOS 7.9 安装 redis-6.2.0
- CentOS 7.9 安装 MySQL 5.7.35
- 关于windows-server-下MySQL Community版本的的安装与配置
- HBase1.4.6安装搭建及shell命令使用
- WinDbg Preview安装以及符号表配置
- Qt Designer、PyUIC、PyRcc PyCharm安装PyQt5及其工具详细教程