RocketMQ安装
RocketMQ安装
RocketMQ版本 5.1.4
前置条件
- 已安装jdk8+[1],并且配置了
JAVA_HOME
验证
java -version
echo $JAVA_HOME
下载RocketMQ
# 官网地址
wget -c https://dist.apache.org/repos/dist/release/rocketmq/5.1.4/rocketmq-all-5.1.4-bin-release.zip
# 如果太慢,使用清华源
wget -c https://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/5.1.4/rocketmq-all-5.1.4-bin-release.zip
解压到指定目录
unzip rocketmq-all-5.1.4-bin-release.zip -d /opt/apps/
cd /opt/apps/
mv rocketmq-all-5.1.4-bin-release rocketmq-5.1.4
配置内存大小
按需配置,默认的内存大小太大了
cd /opt/apps/rocketmq-5.1.4
修改runbroker.sh
vim ./bin/runbroker.sh
修改runserver.sh
vim ./bin/runserver.sh
启动与关闭
参考官网QuickStart
启动NameServer
### 启动namesrv
$ nohup sh bin/mqnamesrv &
### 验证namesrv是否启动成功
$ tail -f ~/logs/rocketmqlogs/namesrv.log
The Name Server boot success...
启动Broker+Proxy
### 先启动broker
$ nohup sh bin/mqbroker -n localhost:9876 --enable-proxy &
### 验证broker是否启动成功, 比如, broker的ip是192.168.1.2 然后名字是broker-a
$ tail -f ~/logs/rocketmqlogs/proxy.log
The broker[broker-a,192.169.1.2:10911] boot success...
关闭服务器
完成实验后,我们可以通过以下方式关闭服务
$ sh bin/mqshutdown broker
The mqbroker(36695) is running...
Send shutdown request to mqbroker with proxy enable OK(36695)
$ sh bin/mqshutdown namesrv
The mqnamesrv(36664) is running...
Send shutdown request to mqnamesrv(36664) OK
---------------
我每一次回头,都感觉自己不够努力,所以我不再回头。
---------------