一、环境准备 1、JDK1.8 2、安装maven: https://maven.apache.org/download.cgi 2.1 下载好如图压缩包后放到目录下解压,/usr/local 2.2 配置maven环境变量
vi /etc/profile
放入文件:
export MAVEN_HOME=/usr/local/apache-maven-3.8.5
export PATH=$MAVEN_HOME/bin:$PATH
刷新配置:
source /etc/profile
二、安装rocketMq 1、下载地址:https://github.com/apache/rocketmq 2、上传到服务器后解压,进入rocketmq目录下编译;
mvn -Prelease-all -DskipTests clean install -U
等待出现BUILD SUCCESS即可
3、修改/rocketmq-master/distribution/target/rocketmq-4.9.4-SNAPSHOT/rocketmq-4.9.4-SNAPSHOT目录下broker.conf
vim conf/broker.conf
#IP替换为自己服务器具体的IP
brokerIP1 = IP
namesrvAddr = IP:9876
##监听端口
listenPort = 10911
#需放开这两个端口的防火墙
4、调小jvm堆大小,修改/rocketmq-master/distribution/target/rocketmq-4.9.4-SNAPSHOT/rocketmq-4.9.4-SNAPSHOT/bin目录下的runserver.sh
runbroker.sh 5、添加环境变量
vim /etc/profile
添加:
export NAMESRV_ADDR=服务器IP:9876
重新加载环境变量:source /etc/profile
6、启动MQ
mkdir log
nohup bin/mqnamesrv > log/mqname.log 2>&1 &
nohup bin/mqbroker -n 服务器地址:9876 -c conf/broker.conf autoCreateTopicEnable=true > log/borker.log 2>&1 &
若启动失败,日志中出现:
nohup: failed to run command ‘bin/mqbroker’: Permission denied
则对当前总目录进行授权:sudo chmod -R xxx #某一目录
若出现找不到启动类或No such file or directory:
Error: Could not find or load main class org.apache.rocketmq.namesrv.NamesrvStartup
则核对编译后的目录,高版本rocketMQ目录在:
/rocketmq-master/distribution/target/rocketmq-4.9.4-SNAPSHOT/rocketmq-4.9.4-SNAPSHOT
7、启动成功,会有如下两个进程 :
三 、安装控制面板:
|