1. 下载源码,maven打包后,进行安装
2. 直接下载二进制码,减压后就行
rocke有9876
非vip通道端口:10911
vip通道端口:10909
10909是VIP通道对应的端口,在JAVA中的消费者对象或者是生产者对象中关闭VIP通道即可无需开放10909端口
如果是broker集群的话,还要开放10912,否则master的消息将无法复制到slave节点
参考:Rocketmq单机版部署_成长的雏鹰的博客-CSDN博客_rocketmq单机部署
目录:
/opt/rocketmq
下载:
wget https://github.com/apache/rocketmq/archive/rocketmq-all-4.3.0.tar.gz
减压:
tar -zxvf rocketmq-all-4.3.0.tar.gz
重命名:
mv rocketmq-rocketmq-all-4.3.0 rocketmq
进入目录:
cd rocketmq
使用MAVEN编译:
mvn -Prelease-all -DskipTests clean install -U
配置环境变量:
vim /etc/profile
export ROCKETMQ=/opt/rocketmq/rocketmq/distribution/target/apache-rocketmq
export PATH=$ROCKETMQ/bin:$PATH
使之生效:
source /etc/profile
创建日志文件夹:
/opt/rocketmq/logs
启动NameServer:
nohup mqnamesrv >/opt/rocketmq/logs/namesrv.log 2>&1 &
开防火墙:
9876
启动Broker:
nohup mqbroker -n 192.172.34.162:9876 >/opt/rocketmq/logs/broker.log 2>&1 &
nohup mqbroker -n 192.172.34.69:9876 >/opt/rocketmq/logs/broker.log 2>&1 &
说明:IP是NameServer的IP
查看启动情况:
ps -ef | grep rocketmq
如果显示结果如上就是正常启动了
关闭:
./mqshutdown namesrv
./mqshutdown broker
简单粗暴的就直接杀死进程就行
异常:
1. 如果出现未成功启动,很大部分就是因为本机的内存小于rocketmq 的默认的内存, 可以查看下服务器本身的内存,在查看下 rocketmq 的nameServ和broker 设置的内存空间根据本机的具体内存大小调配
目录:/opt/rocketmq/rocketmq/distribution/bin
vim runserver.sh
vim runbroker.sh
进入这两个脚本中,修改红框部分的参数,按照本机环境调配
参考:
RocketMQ安装 - 简书
目录:
/usr/local/rocketmq
下载并解压
> wget https://www.apache.org/dyn/closer.cgi?path=rocketmq/4.3.0/rocketmq-all-4.3.0-bin-release.zip
> unzip rocketmq-all-4.3.0-bin-release.zip
broker配置
cd /usr/local/rocketmq/rocketmq-all-4.5.1-bin-release/conf
vi broker.conf
#设置名称服务地址
namesrvAddr=192.172.34.162:9876
#设置brokerIP地址
brokerIP1= 192.172.34.162
#关闭自动创建主题
autoCreateTopicEnable=false
#关闭自动创建订阅组
autoCreateSubscriptionGroup=false
brokerIP1就是对应的是下面这个IP,是以后代码发送消息连接的IP和端口:
修改broker启动内存大小(物理内存大于4g无需修改)
vi /usr/local/rocketmq/rocketmq-all-4.5.1-bin-release/bin/runbroker.sh
找到JAVA_OPT改为如下配置
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
修改nameserver的内存大小(物理内存大于4g无需修改)
vi /usr/local/rocketmq/rocketmq-all-4.5.1-bin-release/bin/runserver.sh
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
启动名称服务
nohup sh /usr/local/rocketmq/rocketmq-all-4.5.1-bin-release/bin/mqnamesrv &
tail -f ~/logs/rocketmqlogs/namesrv.log
启动broker,建议指定配置文件启动
nohup sh /usr/local/rocketmq/rocketmq-all-4.5.1-bin-release/bin/mqbroker -c /usr/local/rocketmq/rocketmq-all-4.5.1-bin-release/conf/broker.conf &
tail -f ~/logs/rocketmqlogs/broker.log
停止服务
sh /usr/local/rocketmq/rocketmq-all-4.5.1-bin-release/bin/mqshutdown broker
sh /usr/local/rocketmq/rocketmq-all-4.5.1-bin-release/bin/mqshutdown namesrv
配置环境变量
vi /etc/profile
export ROCKETMQ=/usr/local/rocketmq/rocketmq-all-4.5.1-bin-release
export PATH=$ROCKETMQ/bin:$PATH
目录:/opt/rocketmq
nohup java -jar rocketmq-console-ng-1.0.0.jar --server.port=12581 --rocketmq.config.namesrvAddr=192.172.34.162:9876 > console.log 2>&1 &
nohup java -jar rocketmq-console-ng-1.0.0.jar --server.port=12581 --rocketmq.config.namesrvAddr=192.172.34.69:9876 > console.log 2>&1 &
nohup java -jar rocketmq-console-ng-1.0.0.jar --server.port=12581 --rocketmq.config.namesrvAddr=192.172.34.93:9876 > console.log 2>&1 &
开墙:
12581
访问:
http://192.172.34.162:12581/#/
http://192.172.34.69:12581/#/
http://192.172.34.93:12581/#/
参考:rocketmq控制台搭建(rocketmq-console) - miaoying - 博客园