RocketMQ 踩坑 docker安装 springboot整合
#不知道为什么,外部文件映射broker.conf文件 后 rmqbroker总是无法启动,此处采用启动rmqbroker容器后进入容器内部修改的方法
#1
#部署RocketMQ #拉取镜像 docker pull foxiswho/rocketmq:server-4.3.2 docker pull foxiswho/rocketmq:broker-4.3.2
#2 #创建nameserver容器 docker create -p 9876:9876 --name rmqserver \ -e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" \ -e "JAVA_OPTS=-Duser.home=/opt" \ -v rmqserver-logs:/opt/logs \ -v rmqserver-store:/opt/store \ foxiswho/rocketmq:server-4.3.2#3 #创建broker容器 docker create -p 10911:10911 -p 10909:10909 --name rmqbroker \ -e "JAVA_OPTS=-Duser.home=/opt" \ -e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" \-v rmqbroker-logs:/opt/logs \ -v rmqbroker-store:/opt/store \ foxiswho/rocketmq:broker-4.3.2
#4 #启动容器并修改broker.conf docker start rmqserver rmqbroker
docker exec -it rmqbroker /bin/bash
cd /etc/rocketmq
vi broker.conf #修改ip addr
exit
#5
#重启两个容器
docker stop rmqbroker rmqserver
docker start rmqserver rmqbroker
#6 #部署RocketMQ的管理工具 docker pull styletang/rocketmq-console-ng:1.0.0 #创建并启动容器 docker run -e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.31.81:9876 - Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 8082:8080 -t styletang/rocketmq-console-ng:1.0.0
#7
#访问
springboot 整合 rocketmq
纪录这次的版本 与 问题
# parent版本
<parent>
<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.0.RELEASE</version> </parent>
#
rocketmq-spring-boot-starter 与 rocketmq-client 版本
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.3.2</version>
</dependency>
#application.properties配置
# Spring boot application
application.name = itcast-rocketmq
rocketmq.name-server=127.0.0.1:9876
rocketmq.producer.group=my-group
注意:不要spring.
不要
spring.rocketmq.nameServer=192.168.31.81:9876
spring.rocketmq.producer.group=tanhua
会报错找不到 rocketmq的容器