docker rocketmq 安装及使用

rocketmq docker hub地址

https://hub.docker.com/r/foxiswho/rocketmq/

风.fox
所有信息 都是 在 mac 系统 执行成功

docker compose 一键生成

风.fox

注意 使用 一键生成时候,要保证 987610909,10911,8180 不被占用,如果占用,请自行更改 docker-compose.yml 的端口号

执行

git clone  https://github.com/foxiswho/docker-rocketmq.git

cd docker-rocketmq

cd rmq


chmod +x  start.sh

./start.sh

将会一键生成3个容器
如果输出如下信息,表名 创建成功

Creating rmqnamesrv ... done
Creating rmqbroker  ... done
Creating rmqconsole ... done

浏览器访问

localhost:8180

配置文件 在 rmq/rmq/brokerconf 目录下,成功后会自动映射配置文件rmq/brokerconf/broker.conf 到 容器内部 路径/etc/rocketmq/broker.conf
注意 如果你的微服务或者项目在开发的时候没有放入docker中或者与rocketmq容器不能直接用IP访问,
那么请把broker.conf中的 #brokerIP1=192.168.0.253 前面#号去掉,并且把后面的IP地址改成你的rocketmq容器宿主机IP地址,
否则报 com.alibaba.rocketmq.remoting.exception.RemotingConnectException: connect to <172.0.0.120:10909> failed

这里写图片描述

其他案例

https://github.com/foxiswho/docker-nacos-sentinel-rocketmq-rabbitmq

https://github.com/foxiswho/docker-consul-fabio-apollo-rocketmq-rabbitmq

K8S 案例

https://github.com/foxiswho/k8s-nacos-sentinel-rocketmq-zipkin-elasticsearch-redis-mysql

以下是单独启动容器

以下是单独启动容器

以下是单独启动容器

启动 rocketmq server 容器

docker run -d -p 9876:9876 --name rmqserver  foxiswho/rocketmq:server

启动 rocketmq broker 容器

docker run -d -p 10911:10911 -p 10909:10909 --name rmqbroker --link rmqserver:namesrv -e "NAMESRV_ADDR=namesrv:9876" -e "JAVA_OPTS=-Duser.home=/opt"  -e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" foxiswho/rocketmq:broker

broker 配置文件位置 (容器内)

/etc/rocketmq/broker.conf

使用自己的配置文件

请全部复制到shell 中执行

docker run -d -p 10911:10911 -p 10909:10909 --name rmqbroker --link rmqserver:namesrv \
-e "NAMESRV_ADDR=namesrv:9876" \
-e "JAVA_OPTS=-Duser.home=/opt"  \
-e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" \
-v /User/fox/rmq/conf/broker.conf:/etc/rocketmq/broker.conf \
foxiswho/rocketmq:broker

/User/fox/rmq/conf/broker.conf 为我的本地配置文件目录

启动 rocketmq console 容器

docker run --name rmqconsole -p 8180:8080 --link rmqserver:namesrv -e "JAVA_OPTS=-Drocketmq.namesrv.addr=namesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" -t styletang/rocketmq-console-ng

浏览器访问

localhost:8180

这里写图片描述

发布了377 篇原创文章 · 获赞 144 · 访问量 164万+
展开阅读全文

阿里云Docker rocketMQ镜像服务日志报错,浏览器无法访问rocketMQ控制台

11-25

Caused by: org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to <null> failed at org.apache.rocketmq.remoting.netty.NettyRemotingClient.invokeSync(NettyRemotingClient.java:357) at org.apache.rocketmq.client.impl.MQClientAPIImpl.getBrokerClusterInfo(MQClientAPIImpl.java:1147) at org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl.examineBrokerClusterInfo(DefaultMQAdminExtImpl.java:269) at org.apache.rocketmq.tools.admin.DefaultMQAdminExt.examineBrokerClusterInfo(DefaultMQAdminExt.java:212) at org.apache.rocketmq.console.service.client.MQAdminExtImpl.examineBrokerClusterInfo(MQAdminExtImpl.java:175) at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at org.apache.rocketmq.console.aspect.admin.MQAdminAspect.aroundMQAdminMethod(MQAdminAspect.java:63) at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy71.examineBrokerClusterInfo(Unknown Source) at org.apache.rocketmq.console.task.DashboardCollectTask.collectBroker(DashboardCollectTask.java:167) ... 21 common frames omitted [2018-11-10 17:38:30.033] ERROR Unexpected error occurred in scheduled task. java.lang.RuntimeException: org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to <null> failed at com.google.common.base.Throwables.propagate(Throwables.java:160) at org.apache.rocketmq.console.task.DashboardCollectTask.collectTopic(DashboardCollectTask.java:156) at org.apache.rocketmq.console.task.DashboardCollectTask$$FastClassBySpringCGLIB$$c818b8cd.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at org.apache.rocketmq.console.aspect.admin.MQAdminAspect.aroundMQAdminMethod(MQAdminAspect.java:63) at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ^C^V[root@iz2zeck5vyquf6cmusfyqlz ~]# ![图片说明](https://img-ask.csdn.net/upload/201811/25/1543150316_643736.jpg) 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览