数据管理与分析-创建分布式消息服务RocketMQ

时间:2023-11-01 16:18:01

创建分布式消息服务RocketMQ

采用容器部署方式:

  1. 获取镜像

    镜像由部署介质里面统一提供,解压文件,直接执行压缩包内的“batchloadimage.sh”脚本,将相关镜像全部加载到服务器。

    如果下载没有权限,联系运维人员获取镜像文件或相关账号密码。

  2. 启动nameserv
    docker run -d --restart=always -p 9876:9876 --name rmqserver 192.168.12.124:7080/ecs-component/yuanian/rocketmq-namesrv:4.7.1
  3. 添加broker配置文件。

    在宿主机上创建配置文件“broker.conf”

    brokerClusterName = DefaultClusterbrokerName = broker-abrokerId = 0deleteWhen = 04fileReservedTime = 48brokerRole = ASYNC_MASTERflushDiskType = ASYNC_FLUSH# 增加此列,否则非本机无法注册rocketmqbrokerIP1 = 192.168.2.187#该项配置是开启acl安全认证配置,开启后,需要注意rocketmq_console与项目服务的配置,否则会导致MQ访问鉴权失败,默认不开启。aclEnable=false
  4. 启动broker
    docker run -d --restart=always -p 10911:10911 -p 10909:10909 --name yn-mqbroker \-e "NAMESRV=192.168.2.187:9876" \-v 'pwd'/broker.conf:/opt/conf/broker.conf -v 'pwd'/plain_acl.yml:/opt/conf/plain_acl.yml  192.168.12.124:7080/ecs-component/yuanian/rocketmq-broker:4.7.1
  5. 启动rocket-console

    RocketMQ的acl未开启情况下,启动命令:

    docker run -d --restart=always -p 8081:8081 --name yn-mqconsole -e "NAMESRV_ADDR=192.168.2.187:9876" 192.168.12.124:7080/ecs-component/yuanian/rocketmq:console-4.7.0

    RocketMQ的acl已开启情况下,启动命令:

    docker run -d --restart=always -p 8081:8081 --name yn-mqconsole -e "NAMESRV_ADDR=192.168.2.187:9876" -e "MQ_CAL_OPT=--rocketmq.config.loginRequired=true  --rocketmq.config.loginName=loginName --rocketmq.config.password=password --rocketmq.config.accessKey=rocketmq2 --rocketmq.config.secretKey=12345678" 192.168.12.124:7080/ecs-component/yuanian/rocketmq:console-4.7.0
support.huaweicloud.com/dbms-dma/dbms_20.html