执行命令
    docker-compose -f docker-compose.yml up -d

    docker-compose.yml 详细代码

    1. version: '2.3'
    2. services:
    3. namesrv-m:
    4. image: foxiswho/rocketmq:server-4.4.0
    5. container_name: namesrv-m
    6. restart: always
    7. ports:
    8. - 9876:9876
    9. volumes:
    10. - "./namesrv/master/logs:/opt/logs"
    11. - "./namesrv/master/store:/opt/store"
    12. - /etc/localtime:/etc/localtime:ro
    13. environment:
    14. JAVA_OPT_EXT: "-server -Xms300m -Xmx300m -Xmn150m"
    15. namesrv-s:
    16. image: foxiswho/rocketmq:server-4.4.0
    17. container_name: namesrv-s
    18. restart: always
    19. ports:
    20. - 9877:9876
    21. volumes:
    22. - "./namesrv/slave/logs:/opt/logs"
    23. - "./namesrv/slave/store:/opt/store"
    24. - /etc/localtime:/etc/localtime:ro
    25. environment:
    26. JAVA_OPT_EXT: "-server -Xms300m -Xmx300m -Xmn150m"
    27. broker-a-m:
    28. image: foxiswho/rocketmq:broker-4.4.0
    29. container_name: broker-a-m
    30. restart: always
    31. ports:
    32. - 10909:10909
    33. - 10911:10911
    34. volumes:
    35. - "./broker/a-m/logs:/opt/logs"
    36. - "./broker/a-m/store:/opt/store"
    37. - "./broker/a-m/conf/broker-a.conf:/etc/rocketmq/broker.conf"
    38. - /etc/localtime:/etc/localtime:ro
    39. command: mqbroker -c /etc/rocketmq/broker.conf
    40. links:
    41. - namesrv-m:namesrv-m
    42. - namesrv-s:namesrv-s
    43. environment:
    44. JAVA_OPTS: " -Duser.home=/opt"
    45. JAVA_OPT_EXT: "-server -Xms300m -Xmx300m -Xmn150m"
    46. broker-a-s:
    47. image: foxiswho/rocketmq:broker-4.4.0
    48. container_name: broker-a-s
    49. restart: always
    50. ports:
    51. - 10916:10909
    52. - 10915:10915
    53. volumes:
    54. - "./broker/a-s/logs:/opt/logs"
    55. - "./broker/a-s/store:/opt/store"
    56. - "./broker/a-s/conf/broker-b.conf:/etc/rocketmq/broker.conf"
    57. - /etc/localtime:/etc/localtime:ro
    58. command: mqbroker -c /etc/rocketmq/broker.conf
    59. links:
    60. - namesrv-m:namesrv-m
    61. - namesrv-s:namesrv-s
    62. environment:
    63. JAVA_OPTS: " -Duser.home=/opt"
    64. JAVA_OPT_EXT: "-server -Xms300m -Xmx300m -Xmn150m"
    65. console:
    66. image: styletang/rocketmq-console-ng:latest
    67. container_name: console
    68. restart: always
    69. ports:
    70. - 9990:8080
    71. volumes:
    72. - /etc/localtime:/etc/localtime:ro
    73. links:
    74. - namesrv-m:namesrv-m
    75. - namesrv-s:namesrv-s
    76. environment:
    77. JAVA_OPTS: -Drocketmq.config.namesrvAddr=namesrv-m:9876;namesrv-s:9877 -Dcom.rocketmq.sendMessageWithVIPChannel=false

    RocketMq控制台端口9990(yml里配置)
    http://10.40.7.57:9990