https://www.jianshu.com/p/00099f5a8491
在用户目录下使用ls -al ,找到隐藏文件.erlang.cookie,由于默认文件所属用户为root,当以普通用户身份启动则存在权限问题,通过chown 命令修改文件的所属用户(chown xiaolin.zhang .erlang.cookie ),再次重新启动,正常;
192 为一个错误的host,使用了本地ip 的前缀,dns 解析会存在问题
查看本机的hostName
hostname 结果(192.168.0.XX)
修改hostName
sudo scutil --set LocalHostName localhost
再次查看hostName
scutil --get LocalHostName
在/etc/hosts 下配置 127.0.0.1 hostName 映射
退出当前termainal,重新打开一个,再次启动,正常;
启动rabbitmq : 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.
根据提示查看rabbitmq 状态
[root@Celery sbin]# systemctl status rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2022-10-21 10:40:34 CST; 2s ago
Process: 7776 ExecStop=/usr/sbin/rabbitmqctl shutdown (code=exited, status=69)
Process: 7499 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 7499 (code=exited, status=1/FAILURE)
Oct 21 10:40:34 Celery systemd[1]: Failed to start RabbitMQ broker.
Oct 21 10:40:34 Celery systemd[1]: Unit rabbitmq-server.service entered failed state.
Oct 21 10:40:34 Celery systemd[1]: rabbitmq-server.service failed.
在/var/log/rabbitmq 查看启动过程日志:
...
2022-10-22 15:24:32.680781+08:00 [noti] <0.44.0> Application rabbit exited with reason: {{cannot_read_file,"/var/lib/rabbitmq/mnesia/rabbit@Celery/nodes_running_at_shutdown",eacces},{rabbit,start,[normal,[]]}}
这个错误指出了失败原因,不能读取 /var/lib/rabbitmq/mnesia/rabbit@Celery/nodes_running_at_shutdown, 先查看了下文件是存在的,推测可能是由于权限问题引起,于是查看了下写入日志的用户组和用户,使用rabbitmq 用户组和用户:
查看/var/lib/rabbitmq/mnesia/rabbit@Celery/ 文件权限,nodes_running_at_shutdown 文件 为root 用户组和用户读写的,