泛微E10(e-cology)运维管理平台安装周边服务消息队列rabbitmq启动失败解决办法
服务器:Ubuntu 22.04.3 LTS
泛微ECOLOGY运维管理平台: e-monitor-V5.0.6.020230917-RC
因为泛微E10运维管理平台对ubuntu 22.04版本兼容不好,安装之前,编辑rabbitmq自动化运维(ansible)安装包:/opt/e-monitor/ecology/tools/ansible-rabbitmq-3.7.7.zip修改后,安装的对应版本为:
Erlang版本:Erlang 24.2.1
RabbitMQ版本:RabbitMQ 3.8.16
安装周边服务时,提示消息队列rabbitmq安装失败,如图:
原因及解决方法:
查看/opt/e-monitor/package/ansible-rabbitmq/ansible-rabbitmq 自动化运维记录文件,发现执行到启动rabbitmq-server服务时,提示任务失败,相关执行记录如下:
- TASK [weaver.rabbitmq : Start service rabbitmq-server, if not started] *********
- fatal: [mqeef76]: FAILED! => {"changed": false, "msg": "Unable to restart service rabbitmq-server: Job for rabbitmq-server.service failed because the control process exited with error code.\nSee "systemctl status rabbitmq-server.service" and "journalctl -xeu rabbitmq-server.service" for details.\n"}
- NO MORE HOSTS LEFT *************************************************************
- PLAY RECAP *********************************************************************
- mqeef76 : ok=27 changed=7 unreachable=0 failed=1 skipped=12 rescued=0 ignored=1
复制代码
根据运行记录,发现是在启动 rabbitmq 服务时出现在错误,于是我们在手工运行一次启动命令:- service rabbitmq-server start
- systemctl start rabbitmq-server
复制代码
发现果然启动错误,我们根据提示,执行了 journalctl -xe ,定位到详细的报错日志信息;
通过这个执行到命令行后,会打印出非常多的问题信息,让我们继续往下定位到ERROR处:
- Feb 13 15:37:50 mqeef76 rabbitmq-server[26481]: Configuring logger redirection
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: 15:37:51.676 [error] Error parsing configuration:
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: 15:37:51.689 [error] File operation error: eacces. Target: /etc/rabbitmq/rabbitmq.conf. Function: get_file. Process: rabbit_prelaunch_sup.
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: 15:37:51.695 [error] - Could not open file (/etc/rabbitmq/rabbitmq.conf) for Reason undefined
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: 15:37:51.695 [error] Are these files using the Cuttlefish format?
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: 15:37:51.698 [error]
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: 15:37:51.698 [error] BOOT FAILED
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: BOOT FAILED
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: 15:37:51.698 [error] ===========
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: ===========
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: 15:37:51.698 [error] Error during startup: {error,failed_to_parse_configuration_file}
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: Error during startup: {error,failed_to_parse_configuration_file}
- Feb 13 15:37:51 mqeef76 rabbitmq-server[26481]: 15:37:51.698 [error]
复制代码
查看打印出来的前四条错误信息为:- [error] Error parsing configuration:
- [error] File operation error: eacces. Target: /etc/rabbitmq/rabbitmq.conf. Function: get_file. Process: rabbit_prelaunch_sup.
- [error] - Could not open file (/etc/rabbitmq/rabbitmq.conf) for Reason undefined
- [error] Are these files using the Cuttlefish format?
复制代码
接下来,我们来检查RabbitMQ配置文件中是否存在任何错误。你可以使用以下命令检查配置文件的语法是否正确:- rabbitmqctl eval 'file:consult([{config_file}, {silent, true}]).'
复制代码 或者查看 rabbitmq 状态
运行这两条命令显示结果相同,显示内容如下:
- Error: unable to perform an operation on node 'rabbit@mqeef76'. 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 rabbit@mqeef76
- * If target node is configured to use long node names, don't forget to use --longnames with CLI tools
- DIAGNOSTICS
- ===========
- attempted to contact: [rabbit@mqeef76]
- rabbit@mqeef76:
- * connected to epmd (port 4369) on mqeef76
- * epmd reports: node 'rabbit' not running at all
- no other nodes on mqeef76
- * suggestion: start the node
- Current node details:
- * node name: 'rabbitmqcli-24-rabbit@mqeef76'
- * effective user's home directory: /opt/weaver/rabbitmq
- * Erlang cookie hash: uwA6pPy2Z6X3QNPinvgy9w==
复制代码 通过以上错误信息,检查 /etc/rabbitmq/rabbitmq.conf 配置文件有没有错误,发现abbitmq.conf文件权限为640,把权限改为644,再次运行“service rabbitmq-server start”命令启动服务,发现已启动正常。
重新安装rabbitmq办法:
删除上次安装目录和信息残留,即删除rabbitmq目录和已有 mnesia 信息
- rm -rf /opt/weaver/rabbitmq
- rm -rf /var/lib/rabbitmq
复制代码
注:
安装日志文件:/opt/e-monitor/package//logs/install.log
rabbitmq账号密码文件:
/opt/e-monitor/package/ansible-rabbitmq/rabbitmq.yml
/opt/e-monitor/package/config/db.properties
相关命令:
# 查看erlang版本
erl -version
Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 12.2.1
# 查看RabbitMQ版本号:
进入在escript目录下可以获取到版本号
- # cd /usr/lib/rabbitmq/lib/rabbitmq_server-3.8.16/escript/
- # rabbitmqctl version
- 3.8.16
复制代码
# 检查RabbitMQ运行状态
rabbitmqctl status
# 查找RabbitMQ的安装路径
whereis rabbitmq
rabbitmq: /usr/lib/rabbitmq /etc/rabbitmq
# 启动 rabbitmq 服务
service rabbitmq-server start
systemctl start rabbitmq-server
# 关闭 rabbitmq 服务
service rabbitmq-server stop
# 重启 rabbitmq 服务
service rabbitmq-server restart
# 查看 rabbitmq 状态
service rabbitmq-server status
# 查看 rabbitmq 进程
我们可以通过ps -ef|grep rabbitmq命令来看 rabbitmq服务是否是启动
ps -ef | grep rabbitmq
|
|