一、Linux安装RocketMQ

官方安装教程

1.下载安装包

1
2
3
cd /usr/local
# 下载source版本(未编译版)
wget https://ftp.jaist.ac.jp/pub/apache/rocketmq/4.8.0/rocketmq-all-4.8.0-source-release.zip

2.解压

1
unzip rocketmq-all-4.8.0-source-release.zip

3.使用mvn进行编译

1
2
3
cd rocketmq-all-4.8.0-source-release/
# 编译打包(时间比较久,耐心等待)
mvn -Prelease-all -DskipTests clean install -U

4.启动

1
2
# 进入项目目录文件
cd distribution/target/rocketmq-4.8.0/rocketmq-4.8.0

4.1 启动NameServer

1
2
3
nohup sh bin/mqnamesrv &
# 查看日志(可以看到The Name Server boot success...)
tail -f ~/logs/rocketmqlogs/namesrv.log

4.2 启动Broker

1
2
3
nohup sh bin/mqbroker -n localhost:9876 &
# 查看日志(可以看到The broker[localhost.localdomain, 172.17.0.1:10911] boot success)
tail -f ~/logs/rocketmqlogs/broker.log

5.验证端口9876

1
lsof -i:9876

看见端口在监听中说明安装成功了

6.附上关闭服务的命令

1
2
3
4
5
6
7
8
9
# 关闭Broker
> sh bin/mqshutdown broker
The mqbroker(36695) is running...
Send shutdown request to mqbroker(36695) OK

# 关闭NameServer
> sh bin/mqshutdown namesrv
The mqnamesrv(36664) is running...
Send shutdown request to mqnamesrv(36664) OK

二、安装 RocketMQ 官方管理页面

1.下载源码包

下载地址
image.png

2.上次并解压

1
2
cd /usr/local
unzip rocketmq-externals-master.zip

3.修改配置文件

1
2
cd rocketmq-externals-master\rocketmq-console\src\main\resources
vim application.properties

image.png

4.maven打包

1
2
3
4
# 进入目录
cd rocketmq-externals-master\rocketmq-console
# 打包生成rocketmq-console-ng-2.0.0.jar
mvn clean package -Dmaven.test.skip=true

在路径rocketmq-externals-master/rocketmq-console/target下得到rocketmq-console-ng-2.0.0.jarjar包

5.将jar包复制出来

1
2
cd /usr/local
cp rocketmq-externals-master/rocketmq-console/target/rocketmq-console-ng-2.0.0.jar .

6.启动rocketmq-console-ng-2.0.0.jar

1
nohup java -jar rocketmq-console-ng-2.0.0.jar &

7.验证安装

浏览器访问http://<IP>:9877

看到如下页面安装成功:
image.png