以下步骤均在安装docker-compose插件情况下进行,若未安装docker-compose插件请先安装docker-compose插件
一、建立以下目录文件
二、docker-compose.yml
version: "3" services: mqnamesrv: image: foxiswho/rocketmq:4.7.0 container_name: mqnamesrv ports: - 9876:9876 environment: JAVA_OPT: -server -Xms256m -Xmx256m command: sh mqnamesrv mqbroker: image: foxiswho/rocketmq:4.7.0 container_name: mqbroker ports: - 10911:10911 - 10909:10909 volumes: - ./broker.conf:/usr/local/dockerCompose/rocketmq/conf/broker.conf environment: JAVA_OPT_EXT: -server -Xms256m -Xmx256m -Xmn128m NAMESRV_ADDR: mqnamesrv:9876 command: sh mqbroker -n mqnamesrv:9876 -c /usr/local/dockerCompose/rocketmq/conf/broker.conf mqconsole: image: styletang/rocketmq-console-ng container_name: mqconsole ports: - 19876:8080 environment: JAVA_OPTS: -Drocketmq.namesrv.addr=mqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=falses
三、修改broker.conf
brokerClusterName = DefaultCluster brokerName = broker-a brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH # 主机IP brokerIP1 = 192.168.80.132
四、在docker-compose.yml同级目录执行以下命令进行安装启动
docker-compose up
五、查看是否启动成功:
docker ps
六、浏览器访问检验
出现以上界面则说明安装启动成功