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基础环境搭建

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐