RocketMq: Windows环境-单机部署和多种主从集群场景部署

本文详细介绍了如何在Windows环境下部署RocketMQ,包括单机部署和双主双从的集群配置。从下载RocketMQ源码、安装JDK和Maven,到修改配置文件、启动Namesrv和Broker,再到调整端口和监控集群状态,每个步骤都有清晰的指导。
摘要由CSDN通过智能技术生成

关于默认端口

broker的默认端口有3个,10911, 10912, 10909

10911是remotingServer使用的监听端口,remotingServer主要处理以下三类消息:

  •     producer发送的消息
  •     conumser在消费失败或者消费超时发送的消息
  •     consumer拉取消息

10912是主broker用于监听从broker请求的监听端口。

10909是fastRemotingServer使用的监听端口,与remotingServer相似,但是不包含处理拉取消息的请求。在vipChannelEnabled开启时,producer,consumer发送消息才发送到fastRemotingServer
 

1. 单机部署

1.1 下载与安装

所需环境: Jdk、Maven

RocketMQ需要maven来编译,所以该环境必须先安装好maven。

(1)下载资源

进入rocketMq的官网,进行资源下载。下载地址为:RocketMq.apache.org

版本说明:

  • Binary和Source和两个的区别在于一个是编译好的(Binary),另一个是没有编译好的(Source)
  • Binary版本已经编译好,是可以直接使用的 RocketMQ 软件包

 (2)安装

将软件解压到本地目录,路径自选。

(3)配置环境变量

  • 变量名:ROCKETMQ_HOME
  • 变量值:D:\rocketMq\rocketmq-all-5.0.0-bin-release

(4)修改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
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER   #当前节点为master,即单主
flushDiskType = ASYNC_FLUSH
autoCreateTopicEnable = true
brokerIP1=172.29.176.1
namesrvAddr=172.29.176.1:9876
defaultTopicQueueNums=4
autoCreateSubscriptionGroup=true
listenPort=10911
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000
diskMaxUsedSpaceRatio=88
storePathRootDir=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store
storePathCommitLog=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/commitlog
storePathConsumeQueue=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/consumequeue
storePathIndex=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/index
storeCheckpoint=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/checkpoint
abortFile=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/abort
maxMessageSize=65536

创建相应的目录:

cd D:/rocketMq/rocketmq-all-5.0.0-bin-release
mkdir store
mkdir logs
cd store
mkdir commitlog

(5)修改RocketMQ的name server 运行端口

在 conf/ 目录下创建 namesrv.properties 文件,并填写以下内容

listenPort=9876

(6)启动 nameserver

进入rocketmq的bin目录执行:

start D:\rocketMq\rocketmq-all-5.0.0-bin-release\bin\mqnamesrv.cmd

启动成功后,弹出的窗口不要关闭

 (7)启动 broker

进入rocketmq的bin目录执行

start D:\rocketMq\rocketmq-all-5.0.0-bin-release\bin\mqbroker.cmd -n 127.0.0.1:9876 -c D:\rocketMq\ro
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值