步骤1:拉取镜像
docker pull rabbitmq:management
步骤2:运行
docker run -d –-name rabbit -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -p 15672:15672 -p 5672:5672 -p 25672:25672 -p 61613:61613 -p 1883:1883 rabbitmq:management
-e:设置环境变量:
RABBITMQ_DEFAULT_USER:指定web管理平台的用户名
RABBITMQ_DEFAULT_PASS:指定web管理平台的用户名
如果不指定,则默认使用guest/guest(默认guest无法远程登陆,只能localhost:15672登陆)
小插曲:
docker: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:61613 -> 0.0.0.0:0: listen tcp 0.0.0.0:61613: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
以管理员身份运行一下命令,然后再执行docker run命令即可
net stop winnat
net start winnat
成功
应用连接报错:
ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile
目前还没有解决
关于rabbitmq用户设置tag说明:
management
User can access the management plugin
policymaker
User can access the management plugin and manage policies and parameters for the vhosts they have access to.
monitoring
User can access the management plugin and see all connections and channels as well as node-related information.
administrator文章来源:https://www.toymoban.com/news/detail-624157.html
User can do everything monitoring can do, manage users, vhosts and permissions, close other user's connections, and manage policies and parameters for all vhosts.文章来源地址https://www.toymoban.com/news/detail-624157.html
# Don't forget to grant the user permissions to some virtual hosts!
rabbitmqctl help set_permissions
# 新增用户
rabbitmqctl add_user YOUR_USERNAME YOUR_PASSWORD
# Setting tags for user "admin" to [administrator]
rabbitmqctl set_user_tags YOUR_USERNAME administrator
# Setting permissions for user "admin" in vhost "/"
rabbitmqctl set_permissions -p / YOUR_USERNAME ".*" ".*" ".*"
# 删除用户
rabbitmqctl delete_user YOUR_USERNAME
到了这里,关于Docker安装RabbitMQ镜像的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!