rocketMq 压缩包版安装与配置

下载rocketmq-all-4.7.1-bin-release.zip

上传到服务器 /app/rocketmq

,并且解压

# mkdir -p /app/rocketmq
# tar -zxvf rocketmq-all-4.7.1-bin-release.zip
[root@localhost app]# cd rocketmq
[root@localhost rocketmq]# ls
data  rocketmq-all-4.7.1-bin-release  rocketmq-all-4.7.1-bin-release.zip

 

mq的主要配置文件路径:/app/rocketmq/rocketmq-all-4.7.1-bin-release/conf

找到 broker.conf

 

 这里配置文件,主要修改为如下配置

[root@localhost conf]# vi 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 = rocketmq-cluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
listenPort=18200
brokerIP1=192.168.1.252 # 这个是因为机器存在多网卡时,对外指定IP
namesrvAddr=192.168.1.252:9876 #访问server的地址
defaultTopicQueueNums=8
autoCreateTopicEnable=false
autoCreateSubscriptionGroup=false
storePathRootDir=/app/rocketmq/data/store-a
storePathCommitLog=/app/rocketmq/data/store-a/commitlog
storePathConsumerQueue=/app/rocketmq/data/store-a/consumequeue
storePathIndex=/app/rocketmq/data/store-a/index
storeCheckpoint=/app/rocketmq/data/store-a/checkpoint
abortFile=/app/rocketmq/data/store-a/abort
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000

 

配置命令行

如果不适用该配置,那么在执行命令行时,都需要增加指定server地址。

[root@localhost conf]# vi /etc/profile

在末行增加

export ROCKETMQ_HOME=/app/rocketmq/rocketmq-all-4.7.1-bin-release
export PATH=$ROCKETMQ_HOME/bin:$PATH

export NAMESRV_ADDR=192.168.1.252:9876

配置生效

[root@localhost conf]# source /etc/profile

 

启动服务

cd /app/rocketmq/rocketmq-all-4.7.1-bin-release

nohup sh bin/mqnamesrv &
nohup sh bin/mqbroker -c conf/broker.conf &

 

启动查询基本命令

 

创建组group与主题topic

参数:

-n 指定 服务器

-t 指定主题

-g 指定组

本机情况下可不用-n

mqadmin updateTopic -c rocketmq-cluster -t TOPIC-SYS-BUSINESS-OPENAPI-ORDERLY  -n "192.168.3.252:9876;192.168.1.253:9876"
mqadmin updateTopic -c rocketmq-cluster -t TOPIC-SYS-BUSINESS-OPENAPI  -n "192.168.3.252:9876;192.168.1.253:9876"
mqadmin updateSubGroup  -c rocketmq-cluster -g GID-QUEUE-BUSINESS-OPENAPI  -n "192.168.3.252:9876;192.168.1.253:9876"

mqadmin updateTopic -c 集群名称固定(rocketmq-cluster) -t 名称 

mqadmin updateTopic -c rocketmq-cluster -t TOPIC-SYS-BUSINESS-OPENAPI-ORDERLY 
mqadmin updateTopic -c rocketmq-cluster -t TOPIC-SYS-BUSINESS-OPENAPI 
mqadmin updateSubGroup  -c rocketmq-cluster -g GID-QUEUE-BUSINESS-OPENAPI 

 

操作MQ消息队列相关信息

1、查看某个消费组的消息堆积情况, Diff 为消息堆积数, 为0说明没有消息堆积。

mqadmin consumerProgress -g GID-QUEUE-BUSINESS-OPENAPI 
mqadmin consumerProgress -g GID-LOG

2、查看某个topic的状态

mqadmin topicStatus -t TOPIC-SYS-BUSINESS-OPENAPI-ORDERLY 
mqadmin topicStatus -t TOPIC-SYS-MESSAGE

3、topic 列表

mqadmin  topicList 

4、集群列表

mqadmin clusterList

5、删除topic

mqadmin deleteTopic -t mq_demo_topic

6、删除group

mqadmin deleteSubGroup  -c rocketmq-cluster -g mq_demo_group

 

posted on 2022-11-14 11:35  陈惟鲜的博客  阅读(256)  评论(0编辑  收藏  举报

导航