一、docker下载rocketMq镜像
sudo docker pull rocketmqinc/rocketmq
二、创建存储日志和数据的文件夹
cd /usr/local
sudo mkdir rocketmq
三、启动namesrv服务
sudo docker run -d -p 9876:9876 -v /usr/local/rocketmq/data/namesrv/logs:/root/logs -v /usr/local/rocketmq/data/namesrv/store:/root/store --name rmqnamesrv --restart=always -e "MAX_POSSIBLE_HEAP=100000000" rocketmqinc/rocketmq sh mqnamesrv
四、启动broker服务
在/usr/local文件下创建conf文件夹再创建broker.conf 文件,内容如下:
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
namesrvAddr=外网地址:9876
brokerIP1=外网地址
启动broker服务
sudo docker run -d -p 10911:10911 -p 10909:10909 -v /usr/local/data/broker/logs:/root/logs -v /usr/local/rocketmq/data/broker/store:/root/store -v /usr/local/conf/broker.conf:/opt/rocketmq/conf/broker.conf --name rmqbroker --restart=always --link rmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" -e "MAX_POSSIBLE_HEAP=200000000" rocketmqinc/rocketmq sh mqbroker -c /opt/rocketmq/conf/broker.conf
五、安装控制台
sudo docker pull styletang/rocketmq-console-ng
六、启动控制台
sudo docker run -e "JAVA_OPTS=-Drocketmq.config.namesrvAddr=内网地址:9876 -Drocketmq.config.isVIPChannel=false" -p 13000:8080 --restart=always -t styletang/rocketmq-console-ng
?浏览器输入外网地址:13000访问控制台
?
七、外网访问问题
?如果外网访问不了,首先查看端口进程占用情况,容器是否启动,关闭服务器防火墙,开启云服务器的对应端口的网络安全策略
|