一、基础环境
- centos7.6
- rocketmq-all-4.7.1-bin-release.zip
- rocketmq-console-ng-1.0.1.jar
- 本次安装以二进制包方式安装
- jdk1.8
二、安装jdk1.8步骤
2.1、上传文件到指定位置
JAVA_HOME=/data/imas/base_soft/jdk1.8/jdk1.8.0_171
export PATH=$JAVA_HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export JAVA_HOME
如果是arm架构的服务器,在官网下载对应的就行:
https://login.oracle.com/mysso/signon.jsp
二、安装Rocketmq步骤
2.1、创建基础路径
mkdir -p /data/imas/base_soft/rocketmq
2.2、上传软件包
2.3、解压
2.4、修改conf下的broker.conf
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
# nameServer地址.多个分号分割
namesrvAddr=172.42.57.13:9876
# 在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
defaultTopicQueueNums=16
# 是否允许 broker 自动创建topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
# 是否允许 broker 自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
# broker 对外服务的监听端口
listenPort=10911
brokerIP1=172.42.57.13
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
# 检测物理文件磁盘空间
diskMaxUsedSpaceRatio=99
# 存储路径
storePathRootDir=/data/imas/base_soft/rocketmq4.7/data/store
# commitLog 存储路径
storePathCommitLog=/data/imas/base_soft/rocketmq4.7/data/store/commitlog
# 消费队列存储路径存储路径
storePathConsumeQueue=/data/imas/base_soft/rocketmq4.7/data/store/consumequeue
# 消息索引存储路径
storePathIndex=/data/imas/base_soft/rocketmq4.7/data/store/index
# checkpoint 文件存储路径
storeCheckpoint=/data/imas/base_soft/rocketmq4.7/data/store/checkpoint
# abort 文件存储路径
abortFile=/data/imas/base_soft/rocketmq4.7/data/store/abort
# 限制的消息大小
maxMessageSize=65536
2.5、修改启动脚本jvm配置
# 编辑runbroker.sh和runserver.sh修改默认JVM大小
vi runbroker.sh
vi runserver.sh
修改后:
2.6、启动MQ服务
(1)启动NameServer
# 1.启动NameServer
nohup sh bin/mqnamesrv >/dev/null 2>&1 &
# 2.查看启动日志
tail -f ~/logs/rocketmqlogs/namesrv.log
(2)启动Broker
# 1.启动Broker
nohup sh bin/mqbroker -n localhost:9876 -c conf/broker.conf autoCreateTopicEnable=true >/dev/null 2>&1 &
# 2.查看启动日志
tail -f ~/logs/rocketmqlogs/broker.log
查看进程是否正常:
2.7、停止 MQ服务
#停止mq
sh bin/mqshutdown broker
sh bin/mqshutdown namesrv
三、安装rocketmq-console-ng-1.0.1步骤
3.1 上传编译好的jar包:
3.2 启动jar包
nohup java -jar -Drocketmq.config.namesrvAddr=192.168.12.245:9876 -Drocketmq.config.isVIPChannel=false rocketmq-console-ng-1.0.1.jar --server.port=10081 >./console.out 2>&1 &
3.2 访问客户端界面