使用docker安装RabbitMq是很方便的,就一条命令的事情。
docker run -d -p 15672:15672 -p 5672:5672 --name gj-rabbit --restart always rabbitmq:3-management
安装完成docker ps查看启动的容器
[root@root ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9aacec5f49e0 rabbitmq:3-management "docker-entrypoint.s?? About a minute ago Up About a minute 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp gj-rabbit
adf46953e1a8 gitlab/gitlab-ce "/assets/wrapper" 2 days ago Up 2 days (healthy) 0.0.0.0:443->443/tcp, 0.0.0.0:2222->22/tcp, 0.0.0.0:88->80/tcp gitlab
48e34f384559 mysql:5.7 "docker-entrypoint.s?? 3 months ago Up 2 days 0.0.0.0:3306->3306/tcp, 33060/tcp
登录网址进行访问:http://47.105.198.54:15672
如果访问不了需要检查端口是否放开
查看防火墙状态
systemctl status firewalld
开启防火墙
systemctl start firewalld
查看80端口是否被放开
firewall-cmd --query-port=80/tcp
重启防火墙
systemctl restart firewalld
关闭防火墙
systemctl stop firewalld
开启端口
firewall-cmd --add-port=1992/tcp --permanent
修改RabbitMq的密码
RabbitMq默认的用户名与密码都是guest
进入容器
[root@root ~]# docker exec -it 容器id bash
查看当前用户列表
root@my-rabbit:/# rabbitmqctl list_users
image.png
修改密码
root@my-rabbit:/# rabbitmqctl change_password guest 'xxx'
新增用户
#新增用户admin,密码也为admin
rabbitmqctl add_user admin admin
网友评论