通过 systemctl status rabbitmq-server 查看状态如下:
[root@redisANDmq ~]# systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
Active: failed (Result: timeout) since 四 2021-08-05 23:44:37 CST; 3min 1s ago
Main PID: 1491 (code=killed, signal=TERM)
8月 05 23:43:13 redisANDmq rabbitmq-server[1491]: RabbitMQ 3.3.5. Copyright (C) 2007-2014 GoPivotal, Inc.
8月 05 23:43:13 redisANDmq rabbitmq-server[1491]: ## ## Licensed under the MPL. See http://www.rabbitmq.com/
8月 05 23:43:13 redisANDmq rabbitmq-server[1491]: ## ##
8月 05 23:43:13 redisANDmq rabbitmq-server[1491]: ########## Logs: /var/log/rabbitmq/[email protected]
8月 05 23:43:13 redisANDmq rabbitmq-server[1491]: ###### ## /var/log/rabbitmq/[email protected]
8月 05 23:43:13 redisANDmq rabbitmq-server[1491]: ##########
8月 05 23:44:37 redisANDmq systemd[1]: rabbitmq-server.service start operation timed out. Terminating.
8月 05 23:44:37 redisANDmq systemd[1]: Failed to start RabbitMQ broker.
8月 05 23:44:37 redisANDmq systemd[1]: Unit rabbitmq-server.service entered failed state.
8月 05 23:44:37 redisANDmq systemd[1]: rabbitmq-server.service failed.
查看具体错误日志,提示如下错误:
=INFO REPORT==== 5-Aug-2021::23:49:06 ===
msg_store_transient: using rabbit_msg_store_ets_index to provide index
=INFO REPORT==== 5-Aug-2021::23:49:06 ===
msg_store_persistent: using rabbit_msg_store_ets_index to provide index
=WARNING REPORT==== 5-Aug-2021::23:49:06 ===
msg_store_persistent: rebuilding indices from scratch
解决方法:
/var/lib/rabbitmq/mnesia 目录下存在[email protected]、rabbit@xxxx、rabbit@localhost-plugins-expand,删除这3项后,再使用systemctl start rabbitmq-server即可正常启动。
请注意:删除文件后,需要重新添加用户,以及重新设置用户权限。比如:
rabbitmqctl add_user admin password
rabbitmqctl set_user_tags admin administrator