本文主要是介绍Linux安装rocketmq,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
#1.下载rocketmq安装包
wget https://github.com/apache/rocketmq/archive/rocketmq-all-4.7.1.tar.gz
#2.解压
tar -zxvf rocketmq-all-4.7.1.tar.gz
#3.将解压包拷贝到指定目录
mv rocketmq-rocketmq-all-4.7.1 /data/local/rocketmq
#4.安装maven插件
#下载安装包
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
#解压
tar -zxvf apache-maven-3.6.3-bin.tar.gz
#将解压包拷贝到指定目录
mv apache-maven-3.6.3 /data/local/maven
#新增maven镜像
vim /data/local/apache-maven-3.6.3/conf/setting.xml
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
#5.配置环境变量
#修改/etc/profile文件
vi /etc/profile
#最后一行添加
export PATH=$PATH:/data/local/maven/bin
#使配置文件生效:
source /etc/profile
#6.编译rocketmq
在rocketmq目录下执行 mvn -Prelease-all -DskipTests clean install -U
mkdir logs
#7.启动rocketmq
cd /data/local/rocketmq/distribution/target/rocketmq-4.7.1/rocketmq-4.7.1/bin
#启动 nameserver
nohup sh mqnamesrv >/data/local/rocketmq/logs/mqnamesrv.log 2>&1 &
#启动 nameserver
nohup sh mqbroker -n localhost:9876 >/data/local/rocketmq/logs/broker.log 2>&1 &
#查看rocketmq服务
ps aux|grep rocketmq
#8.关闭rocketmq
cd /data/local/rocketmq/distribution/target/rocketmq-4.7.1/rocketmq-4.7.1
#停止 broker
sh bin/mqshutdown broker
#停止 nameserver
sh bin/mqshutdown namesrv
这篇关于Linux安装rocketmq的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!