矮子涛涛的日常 - 故障修复
type: channel
link: https://lateresonance.com/index.php/tag/%E6%95%85%E9%9A%9C%E4%BF%AE%E5%A4%8D/
items: CentOS 6 rabbitmq-server无法启动

CentOS 6 rabbitmq-server无法启动
type: item
date: 2020-08-03T06:29:00+00:00
description: 问题现象rabbitmq-server无法启动查看服务器状态service rabbitmq-server status Error: Failed to initialize erlang distribution: { { shutdown, { failed_to_start_child, auth, { "Error when reading /var/lib/rabbitmq/.erlang.cookie: eacces", [{ auth, init_cookie, 0, [{ file, "auth.erl" }, { line, 286 } ] }, { auth, init, 1, [{ file, "auth.erl" }, { line, 140 } ] }, { gen_server, init_it, 6, [{ file, "gen_server.erl" }, { line, 328 } ] }, { proc_lib, init_p_do_apply, 3, [{ file, "proc_lib.erl" }, { line, 240 } ] } ] } } }, { child, undefined, net_sup_dynamic, { erl_distribution, start_link, [ ['rabbitmq-cli-88', shortnames ] ] }, permanent, 1000, supervisor, [erl_distribution] } }.(json语法已经过格式化，实际输出并非完全相同)查看日志文件cat /var/log/rabbitmq/startup_err cat /var/log/rabbitmq/startup_log日志内均返回Error when reading /var/lib/rabbitmq/.erlang.cookie字样分析问题程序启动时报无法找到改文件，那么我们先到该目录下查看文件ls -al /var/lib/rabbitmq/之后查看返回的文件列表我的环境在输出后为[root@gzb ~]# ls -al /var/lib/rabbitmq/ total 16 drwxr-xr-x. 3 root root 4096 Jun 24 2019 . drwxr-xr-x. 21 root root 4096 Aug 3 03:35 .. -r--------. 1 root root 20 Jun 24 2019 .erlang.cookie drwxr-x---. 4 root root 4096 Jun 24 10:21 mnesia这里为.erlang.cookie用户组与用户名为root原因导致的，故需要重新修改权限修复问题chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie service rabbitmq-server start Starting rabbitmq-server: SUCCESS rabbitmq-server.问题解决