开发者社区 > 云原生 > 云消息队列 > 正文

我通过docker-compose搭建的rocketmq,启动是正常的通过Java连接报错什么原因?

"我通过docker-compose搭建的rocketmq,启动是正常的,通过Java连接报错,错误信息如下e6ab9403a152b17c5d967ecbe5ab0bbe.png
我的配置如下:370939cdc52aaa286934b3fe530aff31.png
docker -compose配置如下:version: '3.8'services: rmqnamesrv: image: apache/rocketmq:5.1.0 container_name: rmqnamesrv ports: - 9876:9876 restart: always privileged: true volumes: - ./rocketmq/nameServer/store:/home/rocketmq/store - ./rocketmq/nameServer/logs:/home/rocketmq/logs #- ./rocketmq/nameServer/bin/runserver.sh:/home/rocketmq/rocketmq-5.1.0/bin/runserver.sh environment: - MAX_HEAP_SIZE=256M - HEAP_NEWSIZE=128M command: [""sh"",""mqnamesrv""] broker: image: apache/rocketmq:5.1.0 container_name: rmqbroker ports: - 10909:10909 - 10911:10911 restart: always privileged: true volumes: - ./rocketmq/broker/logs:/home/rocketmq/logs - ./rocketmq/broker/store:/home/rocketmq/store - ./rocketmq/broker/conf/broker.conf:/home/rocketmq/rocketmq-5.1.0/conf/broker.conf # - /usr/local/rocketmq/broker/bin/runbroker.sh:/home/rocketmq/rocketmq-5.1.0/bin/runbroker.sh depends_on: - 'rmqnamesrv' environment: - NAMESRV_ADDR=rmqnamesrv:9876 - MAX_HEAP_SIZE=512M - HEAP_NEWSIZE=256M command: [""sh"",""mqbroker"",""-c"",""/home/rocketmq/rocketmq-5.1.0/conf/broker.conf""] rmqdashboard: image: apacherocketmq/rocketmq-dashboard:latest container_name: rocketmq-dashboard ports: - 8080:8080 restart: always privileged: true depends_on: - 'rmqnamesrv' environment: - JAVA_OPTS= -Xmx256M -Xms256M -Xmn128M -Drocketmq.namesrv.addr=rmqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false
我用的版本是5.1.0这个应该如何修改下,我在网上找了好久,没有一个正确答案的。"

展开
收起
小易01 2023-07-19 20:06:51 151 0
1 条回答
写回答
取消 提交回答
  • 意中人就是我呀!

    "直接用命令可以。参考demo:docker run -d --net mq-net -p 9876:9876 --restart=always --name rmqnamesrv --privileged=true -e ""MAX_POSSIBLE_HEAP=100000000"" -e ""JAVA_OPT_EXT=-Xms512M -Xmx512M -Xmn128m"" apache/rocketmq sh mqnamesrv
    docker run -d --net mq-net -p 10911:10911 -p 10909:10909 -p 10912:10912 -p 8081:8081 --restart=always --name rmqbroker --link rmqnamesrv:namesrv -e ""NAMESRV_ADDR=namesrv:9876"" -e ""MAX_POSSIBLE_HEAP=200000000"" -e ""JAVA_OPT_EXT=-Xms512M -Xmx512M -Xmn128m"" apache/rocketmq sh mqbroker -n 172.19.0.2:9876 -c /home/rocketmq/rocketmq-5.1.3/conf/broker.conf
    我直接拉最新的镜像,所以是5.1.3。
    docker run -d --net mq-net --name rocketmq-dashboard -e ""JAVA_OPTS=-Drocketmq.namesrv.addr=172.19.0.2:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"" -p 8080:8080 -t apacherocketmq/rocketmq-dashboard:latest此回答整理至钉群“群2-Apache RocketMQ 中国开发者钉钉群”。"

    2023-07-19 23:09:38
    赞同 展开评论 打赏

涵盖 RocketMQ、Kafka、RabbitMQ、MQTT、轻量消息队列(原MNS) 的消息队列产品体系,全系产品 Serverless 化。RocketMQ 一站式学习:https://rocketmq.io/

相关产品

  • 云消息队列 MQ
  • 相关电子书

    更多
    应用 Docker 进行持续交付:用技术改变交付路程 立即下载
    从Docker到容器服务 立即下载
    Docker@Alibaba——超大规模Docker化的实战经验 立即下载