1.先下载二进制文件
下载 | RocketMQ
2.下载后,进行解压
unzip rocketmq-all-4.6.1-bin-release.zip
3.修改JVM配置
进到/datadrive/rocketmq-all-4.6.1-bin-release/bin下编辑runserver.sh
与 runbroker.sh
文件
根据个人虚拟机大小进行修改
vi runserver.sh
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m -XX:PermSize=64m -XX:MaxPermSize=128m"
vi runbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m -XX:PermSize=64m -XX:MaxPermSize=128m"
4.配置RocketMQ环境变量
vi /etc/profile
export ROCKETMQ=/datadrive/rocketmq-all-4.6.1-bin-release
export PATH=$PATH:$ROCKETMQ/bin
更新一下配置
source /etc/profile
5.启动NAMESERVER
启动命令
cd /datadrive/rocketmq-all-4.6.1-bin-release
nohup sh bin/mqnamesrv >/dev/null 2>&1 &
启动的时候,必须要在安装目录下:
关闭命令:
cd /datadrive/rocketmq-all-4.6.1-bin-release
sh bin/mqshutdown namesrv //停止 nameserver
查看日志:namesrv.log
tail -f ~/logs/rocketmqlogs/namesrv.log
6.启动BROKER
启动命令:
nohup sh bin/mqbroker -n 你的公网IP:9876 &
cd /datadrive/rocketmq-all-4.6.1-bin-release
nohup sh bin/mqbroker -n 192.168.220.131:9876 -c conf/broker.conf autoCreateTopicEnable=true &
查看日志:
tail -f ~/logs/rocketmqlogs/broker.log
关闭命令:
cd /datadrive/rocketmq-all-4.6.1-bin-release
sh bin/mqshutdown broker //停止 broker