Rabbitmq添加用户错误:Error: unable to perform an operation on node ‘rabbitmq3@k8s-master1‘. Please see dia

本文记录了一次在测试单节点RabbitMQ时遇到的无法添加用户的问题及解决过程。错误信息显示节点未运行,但检查后发现并非如此。最终通过确认环境变量和使用正确路径的命令解决了问题,成功添加并设置了用户权限。
摘要由CSDN通过智能技术生成

1、错误信息描述

今天在测试单节点rabbitmq时发现错误信息,记录一下

[root@k8s-master1 sbin]# rabbitmqctl add_user admin 123456
Error: unable to perform an operation on node 'rabbitmq3@k8s-master1'. 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 rabbitmq3@k8s-master1
 * If target node is configured to use long node names, don't forget to use --longnames with CLI tools

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

attempted to contact: ['rabbitmq3@k8s-master1']

rabbitmq3@k8s-master1:
  * connected to epmd (port 4369) on k8s-master1
  * epmd reports: node 'rabbitmq3' not running at all
                  other nodes on k8s-master1: [mq1]
  * suggestion: start the node

Current node details:
 * node name: 'rabbitmqcli-832-rabbitmq3@k8s-master1'
 * effective user's home directory: /root
 * Erlang cookie hash: mG6tHqVyZ4ibmooTpymD9A==

2、问题解决

  1. 根据其他网友提供的方法,配置/etc/hosts域名解析;添加127.0.0.1和本机ip
[root@k8s-master1 sbin]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 k8s-master1
192.168.6.20 k8s-master1

我这里没有用,因为不是这个问题导致的

  1. 根据第一步配置完成后,发现依然还是报这个错误,最后想起来之前搭建过rabbitmq的环境并且配置了环境变量;
  2. 恍然大悟,原来我这里使用了其他环境的命令进行设置
  3. 使用当前环境(目录位置命令进行配置)
[root@k8s-master1 sbin]# ./rabbitmqctl add_user admin 123456
Adding user "admin" ...
Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.
[root@k8s-master1 sbin]# ./rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...
[root@k8s-master1 sbin]# ./rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
Setting permissions for user "admin" in vhost "/" ...
[root@k8s-master1 sbin]# ./rabbitmqctl list_users
Listing users ...
user    tags
admin   [administrator]
guest   [administrator]
[root@k8s-master1 sbin]# 

最后给推荐一下个人博客:
个人博客
rabbitmq基础环境搭建

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值