当前位置:   article > 正文

rabbitmq集群搭建报错:[error] Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only

.erlang.cookie must be accessible by owner only

1.背景描述

在创建rabbitmq集群时,需要将当前节点的.erlang.cookie文件数据修改为第一个节点的.erlang.cookie文件内容,这里为了防止手动vim修改导致数据末尾的自动换行符的引入,我使用了文件的直接替换,随后在重启当前的mq节点服务时,报错如下:

[root@net-test-leel ~]# service rabbitmq-server restart
Redirecting to /bin/systemctl restart rabbitmq-server.service
Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
  • 1
  • 2
  • 3

结果就是rabbitmq启动失败

[root@net-test-leel ~ rabbitmq]# service rabbitmq-server status
Redirecting to /bin/systemctl status rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2023-02-15 03:14:13 CST; 8s ago
  Process: 32656 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)
 Main PID: 32656 (code=exited, status=1/FAILURE)
   Status: "Standing by"

Feb 15 03:14:13 qyyc01-test-ec2240001236.qyyc01.ksyun.com systemd[1]: Failed to start RabbitMQ broker.
Feb 15 03:14:13 qyyc01-test-ec2240001236.qyyc01.ksyun.com systemd[1]: Unit rabbitmq-server.service entered failed state.
Feb 15 03:14:13 qyyc01-test-ec2240001236.qyyc01.ksyun.com systemd[1]: rabbitmq-server.service failed.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

随后,执行reset时报错

[error] Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only
  • 1

2:问题解决

报错的内容是权限问题,当前这个文件只能文件的所有者才能访问,因为这个文件是从其他节点上复制并替换的,所以需要重新赋予权限,在rabbitmq的默认安装路径/var/lib/rabbitmq/下执行如下命令,

sudo chown rabbitmq:rabbitmq .erlang.cookie        
sudo chmod 400 .erlang.cookie
  • 1
  • 2

随后,问题解决,可以正常启动mq了

[root@net-test-leel ~]# service rabbitmq-server restart
Redirecting to /bin/systemctl restart rabbitmq-server.service
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/919295
推荐阅读
相关标签
  

闽ICP备14008679号