rabbitmq添加用户遇到问题解决方法

当我配置完rabbitmq之后想添加一个用户并且设置为管理员时,遇到了一些问题

[root@localhost ~]# rabbitmqctl add_user zhouniy 123456
Error: unable to perform an operation on node 'rabbit@localhost'. Please see diagnostics information and suggestions below.

Most common reasons for this are:

 * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
 * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
 * Target node is not running

In addition to the diagnostics info below:

 * See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more
 * Consult server logs on node rabbit@localhost
 * If target node is configured to use long node names, don't forget to use --longnames with CLI tools

DIAGNOSTICS
===========

attempted to contact: [rabbit@localhost]

rabbit@localhost:
  * connected to epmd (port 4369) on localhost
  * epmd reports: node 'rabbit' not running at all
                  no other nodes on localhost
  * suggestion: start the node

Current node details:
 * node name: 'rabbitmqcli-2204-rabbit@localhost'
 * effective user's home directory: /var/lib/rabbitmq
 * Erlang cookie hash: RfbZNbhvxscoJBPZS60saQ==

经过搜索分析,得出的结论是rabbitmqcli并没有启动,需要重新启动rabbitmq服务

# 首先查询进程
[root@localhost ~]# ps -ef | grep rabbitmq
rabbitmq   2160      1  0 15:19 ?        00:00:00 /usr/lib64/erlang/erts-11.2.2.10/bin/epmd -daemon
root       2252   2086  0 15:23 pts/0    00:00:00 grep --color=auto rabbitmq

# 杀掉mq进程
[root@localhost ~]# ps -ef | grep rabbitmq | grep -v grep | awk '{print $2}' | xargs kill -9

# 启动mq进程
[root@localhost ~]# rabbitmq-server -detached

# 查看mq进程是否启动
[root@localhost ~]# ps -ef | grep rabbitmq
rabbitmq   2316      1 45 15:23 ?        00:00:11 /usr/lib64/erlang/erts-11.2.2.10/bin/beam.smp -W w -K true -A 128 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -B i -- -root /usr/lib64/erlang -progname erl -- -home /var/lib/rabbitmq -- -pa  -noshell -noinput -s rabbit boot -boot start_sasl -lager crash_log false -lager handlers [] -noshell -noinput
rabbitmq   2447   2316  0 15:23 ?        00:00:00 erl_child_setup 1024
rabbitmq   2482      1  0 15:23 ?        00:00:00 /usr/lib64/erlang/erts-11.2.2.10/bin/epmd -daemon
rabbitmq   2515   2447  0 15:23 ?        00:00:00 inet_gethost 4
rabbitmq   2516   2515  0 15:23 ?        00:00:00 inet_gethost 4
root       2577   2086  0 15:24 pts/0    00:00:00 grep --color=auto rabbitmq

# 启动rabbitmqcli
[root@localhost ~]# rabbitmqctl start_app
Starting node rabbit@localhost ...

# 查看rabbitmqcli状态
[root@localhost ~]# rabbitmqctl status
Status of node rabbit@localhost ...
Runtime

此时就可以使用下面的命令完成添加管理员的操作了

[root@localhost ~]# rabbitmqctl add_user zhaibozhou 123456
Adding user "zhaibozhou" ...
[root@localhost ~]# rabbitmqctl set_user_tags zhaibozhou administrator
Setting tags for user "zhaibozhou" to [administrator] ...
[root@localhost ~]# sudo rabbitmqctl set_permissions -p "/" zhaibozhou ".*" ".*" ".*"
Setting permissions for user "zhaibozhou" in vhost "/" ...
# 查看用户列表
[root@localhost ~]# rabbitmqctl list_users
Listing users ...
user	tags
zhaibozhou	[administrator]
admin	[administrator]
guest	[administrator]

问题解决了!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值