• RocketMq: Windows环境-单机部署和伪集群、集群部署


    关于默认端口

    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

    1. # Licensed to the Apache Software Foundation (ASF) under one or more
    2. # contributor license agreements. See the NOTICE file distributed with
    3. # this work for additional information regarding copyright ownership.
    4. # The ASF licenses this file to You under the Apache License, Version 2.0
    5. # (the "License"); you may not use this file except in compliance with
    6. # the License. You may obtain a copy of the License at
    7. #
    8. # http://www.apache.org/licenses/LICENSE-2.0
    9. #
    10. # Unless required by applicable law or agreed to in writing, software
    11. # distributed under the License is distributed on an "AS IS" BASIS,
    12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13. # See the License for the specific language governing permissions and
    14. # limitations under the License.
    15. brokerClusterName = DefaultCluster
    16. brokerName = broker-a
    17. brokerId = 0
    18. deleteWhen = 04
    19. fileReservedTime = 48
    20. brokerRole = ASYNC_MASTER #当前节点为master,即单主
    21. flushDiskType = ASYNC_FLUSH
    22. autoCreateTopicEnable = true
    23. brokerIP1=172.29.176.1
    24. namesrvAddr=172.29.176.1:9876
    25. defaultTopicQueueNums=4
    26. autoCreateSubscriptionGroup=true
    27. listenPort=10911
    28. mapedFileSizeCommitLog=1073741824
    29. mapedFileSizeConsumeQueue=300000
    30. diskMaxUsedSpaceRatio=88
    31. storePathRootDir=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store
    32. storePathCommitLog=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/commitlog
    33. storePathConsumeQueue=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/consumequeue
    34. storePathIndex=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/index
    35. storeCheckpoint=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/checkpoint
    36. abortFile=D:/rocketMq/rocketmq-all-5.0.0-bin-release/store/abort
    37. maxMessageSize=65536

    创建相应的目录:

    1. cd D:/rocketMq/rocketmq-all-5.0.0-bin-release
    2. mkdir store
    3. mkdir logs
    4. cd store
    5. 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\rocketmq-all-5.0.0-b
  • 相关阅读:
    [ACTF2020 新生赛]Include 1
    23种设计模式之---单例模式
    【Qt QML】Qt5.15.2 qml添加自定义控件报错“Xxxx is not a type“
    3D模型转换工具HOOPS Exchange如何实现OBJ格式轻量化?
    PPLiteSeg实时语义分割预测结果输出控制无人车转向角度方向实现沿车道无人驾驶
    把 ”中台“ 的思想迁移到代码中去
    Java HashCode哈希值的基础概述
    使用TPDSS连接GaussDB数据库
    ROS2——动作(十一)
    丢失vcruntime140_1.dll怎么解决,vcruntime140_1.dll怎么安装?
  • 原文地址:https://blog.csdn.net/weixin_42405670/article/details/128132864