因为在本地使用rocketmq,资源开销实在太大,8+4G,所有选择了个docker版本,用了不到2G。
如下步骤。
在服务器上建立一个目录 rocketmq_docker
1、建立目录。
logs==日志
store==实质性的存储
conf==配置文件
mkdir conf logs store 或 mkdir logs mkdir store mkdir conf
2、进入conf目录。新建broker.conf 文件
[root@251 conf]# vi conf/broker.conf brokerClusterName = DefaultCluster brokerName = broker-a brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH # 主机IP brokerIP1 = 192.168.3.251
3、编排文件docker-compose
因条件有限,所以做了限制内存,否则,我机器内存肯定不足。
mqnamesrv 主机服务
mqbroker 控制端
mqconsole 视图工具
[root@251 rocketmq_docker]# vi 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: - ./conf/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: - 28080:8080 environment: JAVA_OPTS: -Drocketmq.namesrv.addr=mqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=falses
4、运行测试
#后台运行,否则一旦退出,容器也退出了。 docker-compose up -d
5、查看容器
docker ps -a 结果如下 [root@251 rocketmq_docker]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 30961066da86 foxiswho/rocketmq:4.7.0 "sh mqbroker -n mqna…" 13 minutes ago Up 13 minutes 0.0.0.0:10909->10909/tcp, 9876/tcp, 10912/tcp, 0.0.0.0:10911->10911/tcp mqbroker 0cc075720d46 styletang/rocketmq-console-ng "sh -c 'java $JAVA_O…" 13 minutes ago Up 13 minutes 0.0.0.0:28080->8080/tcp mqconsole 15726aeb3984 foxiswho/rocketmq:4.7.0 "sh mqnamesrv" 13 minutes ago Up 13 minutes 10909/tcp, 0.0.0.0:9876->9876/tcp, 10911-10912/tcp mqnamesrv
6、测试访问
因为编排文件时,我们指定接口时28080,所以访问的时候,这样
http://192.168.3.251:28080/#/
7、如何执行mqadmin命令?
创建队列,topic。。
标签:compose,0.0,mqnamesrv,tcp,conf,docker,rocketmq From: https://www.cnblogs.com/a393060727/p/16976914.html