用Docker 构建RabbitMQ shovel
2021-06-18 11:07 蛮荒古神 阅读(138) 评论(0) 编辑 收藏 举报
1.用Docker启动两个RabbitMQ节点
docker run -d --name=rabbitmqa -p 5772:5672 -p 15772:15672 -e RABBITMQ_NODENAME=rabbitmqa -h rabbitmqa rabbitmq:3.6.9-management
docker run -d --name=rabbitmqb -p 5773:5672 -p 15773:15672 -e RABBITMQ_NODENAME=rabbitmqb -h rabbitmqb rabbitmq:3.6.9-management
2.开启shovel插件
docker exec rabbitmqa bash -c "rabbitmq-plugins enable rabbitmq_shovel"
docker exec rabbitmqa bash -c "rabbitmq-plugins enable rabbitmq_shovel_management"
docker exec rabbitmqb bash -c "rabbitmq-plugins enable rabbitmq_shovel"
docker exec rabbitmqb bash -c "rabbitmq-plugins enable rabbitmq_shovel_management"
3.获得两个RabbitMQ节点的IP
docker inspect --format='{{ .NetworkSettings.IPAddress }}' rabbitmqa
docker inspect --format='{{ .NetworkSettings.IPAddress }}' rabbitmqb
4.编辑rabbitmq.config文件,在附件中
5.替换Docker容器中的rabbitmq.config文件
只需替换source节点的配置文件
docker cp /home/robbie/Downloads/rabbitmq.config 017bf80d9b22:/etc/rabbitmq/rabbitmq.config
6.重启docker容器
docker restart rabbitmqa
docker restart rabbitmqb