当前位置: 首页 > article >正文

rabbitmq 启动异常问题排查

rabbitmq 启动异常问题排查

[root@localhost sbin]# systemctl status rabbitmq -l 
● rabbitmq.service - RabbitMQ Server
   Loaded: loaded (/etc/systemd/system/rabbitmq.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since 二 2024-11-26 10:13:30 CST; 1min 4s ago
  Process: 26452 ExecStart=/usr/local/dhtech/rabbitmq/sbin/rabbitmq-server (code=exited, status=0/SUCCESS)
 Main PID: 26452 (code=exited, status=0/SUCCESS)

11月 26 10:13:28 localhost.localdomain rabbitmq-server[26452]: 2024-11-26 10:13:28.596744+08:00 [erro] <0.127.0>     trap_exit: true
11月 26 10:13:28 localhost.localdomain rabbitmq-server[26452]: 2024-11-26 10:13:28.596744+08:00 [erro] <0.127.0>     status: running
11月 26 10:13:28 localhost.localdomain rabbitmq-server[26452]: 2024-11-26 10:13:28.596744+08:00 [erro] <0.127.0>     heap_size: 987
11月 26 10:13:28 localhost.localdomain rabbitmq-server[26452]: 2024-11-26 10:13:28.596744+08:00 [erro] <0.127.0>     stack_size: 28
11月 26 10:13:28 localhost.localdomain rabbitmq-server[26452]: 2024-11-26 10:13:28.596744+08:00 [erro] <0.127.0>     reductions: 237
11月 26 10:13:28 localhost.localdomain rabbitmq-server[26452]: 2024-11-26 10:13:28.596744+08:00 [erro] <0.127.0>   neighbours:
11月 26 10:13:28 localhost.localdomain rabbitmq-server[26452]: 2024-11-26 10:13:28.596744+08:00 [erro] <0.127.0>
11月 26 10:13:28 localhost.localdomain rabbitmq-server[26452]: 2024-11-26 10:13:28.599509+08:00 [noti] <0.44.0> Application rabbitmq_prelaunch exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{badmatch,{error,{{shutdown,{failed_to_start_child,auth,{"Failed to create cookie file '/home/rabbitmq/.erlang.cookie': enoent",[{auth,init_no_setcookie,0,[{file,"auth.erl"},{line,313}]},{auth,init,1,[{file,"auth.erl"},{line,165}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{child,undefined,net_sup_dynamic,{erl_distribution,start_link,[#{clean_halt => false,name => rabbit_prelaunch_26457@localhost,name_domain => shortnames,net_tickintensity => 4,net_ticktime => 60,supervisor => net_sup_dynamic}]},permanent,false,1000,supervisor,[erl_distribution]}}}}}},{rabbit_prelaunch_app,start,[normal,[]]}}
11月 26 10:13:30 localhost.localdomain rabbitmq-server[26452]: {"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{badmatch,{error,{{shutdown,{failed_to_start_child,auth,{\"Failed to create cookie file '/home/rabbitmq/.erlang.cookie': enoent\",[{auth,init_no_setcookie,0,[{file,\"auth.erl\"},{line,313}]},{auth,init,1,[{file,\"auth.erl\"},{line,165}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,423}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,226}]}]}}},{child,undefined,net_sup_dynamic,{erl_distribution,start_link,[#{clean_halt => false,name => rabbit_prelaunch_26457@localhost,name_domain => shortnames,net_tickintensity => 4,net_ticktime => 60,supervisor => net_sup_dynamic}]},permanent,false,1000,supervisor,[erl_distribution]}}}}}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}
11月 26 10:13:30 localhost.localdomain rabbitmq-server[26452]: Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{badmatch,{error,{{shutdown,{failed_to_start_child,auth,{"Failed to create cookie file '/home/rabbitmq/.erlang.cookie': enoent",[{auth,init_no_setcookie,0,[{file,"auth.erl"},{line,313}]},{auth,init,1,[{file,"auth.erl"},{line,165}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{child,undefined,net_sup_dynamic,{erl_distribution,start_link,[#{clean_halt => false,name => rabbit_prelaunch_26457@localhost,name_domain => shortnames,net_tickintensity => 4,net_ticktime => 60,supervisor => net_sup_dynamic}]},permanent,false,1000,supervisor,[erl_distribution]}}}}}},{rabbit_prelaunch_app,start,[normal,[]]}}})

解决方法:

  1. 查看是否存在文件夹
    ls -ld /home/rabbitmq
  • 没有就创建
    sudo mkdir -p /home/rabbitmq
  • 授予权限
    sudo chown -R rabbitmq:rabbitmq /home/rabbitmq

重启后出现新的问题

[root@localhost home]# systemctl status rabbitmq -l  
● rabbitmq.service - RabbitMQ Server
  Loaded: loaded (/etc/systemd/system/rabbitmq.service; enabled; vendor preset: disabled)
  Active: inactive (dead) since 二 2024-11-26 10:17:50 CST; 6s ago
 Process: 26801 ExecStart=/usr/local/dhtech/rabbitmq/sbin/rabbitmq-server (code=exited, status=0/SUCCESS)
Main PID: 26801 (code=exited, status=0/SUCCESS)

11月 26 10:17:49 localhost.localdomain rabbitmq-server[26801]: 2024-11-26 10:17:49.219046+08:00 [erro] <0.226.0>     trap_exit: true
11月 26 10:17:49 localhost.localdomain rabbitmq-server[26801]: 2024-11-26 10:17:49.219046+08:00 [erro] <0.226.0>     status: running
11月 26 10:17:49 localhost.localdomain rabbitmq-server[26801]: 2024-11-26 10:17:49.219046+08:00 [erro] <0.226.0>     heap_size: 987
11月 26 10:17:49 localhost.localdomain rabbitmq-server[26801]: 2024-11-26 10:17:49.219046+08:00 [erro] <0.226.0>     stack_size: 28
11月 26 10:17:49 localhost.localdomain rabbitmq-server[26801]: 2024-11-26 10:17:49.219046+08:00 [erro] <0.226.0>     reductions: 206
11月 26 10:17:49 localhost.localdomain rabbitmq-server[26801]: 2024-11-26 10:17:49.219046+08:00 [erro] <0.226.0>   neighbours:
11月 26 10:17:49 localhost.localdomain rabbitmq-server[26801]: 2024-11-26 10:17:49.219046+08:00 [erro] <0.226.0>
11月 26 10:17:49 localhost.localdomain rabbitmq-server[26801]: 2024-11-26 10:17:49.230097+08:00 [noti] <0.44.0> Application rabbit exited with reason: {{cannot_log_to_file,"/usr/local/dhtech/rabbitmq/var/log/rabbitmq/rabbit@localhost.log",eacces},{rabbit,start,[normal,[]]}}
11月 26 10:17:50 localhost.localdomain rabbitmq-server[26801]: {"Kernel pid terminated",application_controller,"{application_start_failure,rabbit,{{cannot_log_to_file,\"/usr/local/dhtech/rabbitmq/var/log/rabbitmq/rabbit@localhost.log\",eacces},{rabbit,start,[normal,[]]}}}"}
11月 26 10:17:50 localhost.localdomain rabbitmq-server[26801]: Kernel pid terminated (application_controller) ({application_start_failure,rabbit,{{cannot_log_to_file,"/usr/local/dhtech/rabbitmq/var/log/rabbitmq/rabbit@localhost.log",eacces},{rabbit,start,[normal,[]]}}})

解决办法:

sudo chown -R rabbitmq:rabbitmq /usr/local/dhtech/rabbitmq/var/log/rabbitmq

重启问题如下:

systemctl status rabbitmq -l  
● rabbitmq.service - RabbitMQ Server
   Loaded: loaded (/etc/systemd/system/rabbitmq.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since 二 2024-11-26 10:18:56 CST; 1s ago
  Process: 26920 ExecStart=/usr/local/dhtech/rabbitmq/sbin/rabbitmq-server (code=exited, status=0/SUCCESS)
 Main PID: 26920 (code=exited, status=0/SUCCESS)

11月 26 10:18:53 localhost.localdomain rabbitmq-server[26920]: 2024-11-26 10:18:53.638986+08:00 [noti] <0.227.0> Logging: switching to configured handler(s); following messages may not be visible in this log output
11月 26 10:18:53 localhost.localdomain rabbitmq-server[26920]: BOOT FAILED
11月 26 10:18:53 localhost.localdomain rabbitmq-server[26920]: ===========
11月 26 10:18:53 localhost.localdomain rabbitmq-server[26920]: Error during startup: {error,
11月 26 10:18:53 localhost.localdomain rabbitmq-server[26920]: {could_not_write_file,
11月 26 10:18:53 localhost.localdomain rabbitmq-server[26920]: "/usr/local/dhtech/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@localhost/cluster_nodes.config",
11月 26 10:18:53 localhost.localdomain rabbitmq-server[26920]: eacces}}
11月 26 10:18:56 localhost.localdomain rabbitmq-server[26920]: {"Kernel pid terminated",application_controller,"{application_start_failure,rabbit,{{could_not_write_file,\"/usr/local/dhtech/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@localhost/cluster_nodes.config\",eacces},{rabbit,start,[normal,[]]}}}"}
11月 26 10:18:56 localhost.localdomain rabbitmq-server[26920]: Kernel pid terminated (application_controller) ({application_start_failure,rabbit,{{could_not_write_file,"/usr/local/dhtech/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@localhost/cluster_nodes.config",eacces},{rabbit,start,[normal,[]]}}})
11月 26 10:18:56 localhost.localdomain rabbitmq-server[26920]: Crash dump is being written to: /usr/local/dhtech/rabbitmq/var/log/rabbitmq/erl_crash.dump...done

解决办法:

  1. 设置权限
sudo chown -R rabbitmq:rabbitmq /usr/local/dhtech/rabbitmq/var/lib/rabbitmq/mnesia 
sudo chmod -R 755 /usr/local/dhtech/rabbitmq/var/lib/rabbitmq/mnesia

重启

sudo systemctl start rabbitmq 
systemctl status rabbitmq -l 

至此Rabbit MQ正常启动

[root@localhost home]# systemctl status rabbitmq -l  
● rabbitmq.service - RabbitMQ Server
   Loaded: loaded (/etc/systemd/system/rabbitmq.service; enabled; vendor preset: disabled)
   Active: active (running) since 二 2024-11-26 10:21:05 CST; 4s ago
 Main PID: 27064 (rabbitmq-server)
   CGroup: /system.slice/rabbitmq.service
           ├─27064 /bin/sh /usr/local/dhtech/rabbitmq/sbin/rabbitmq-server
           ├─27069 /usr/local/lib/erlang/erts-12.3/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -sbwt none -sbwtdcpu none -sbwtdio none -B i -- -root /usr/local/lib/erlang -progname erl -- -home /home/rabbitmq -- -pa  -noshell -noinput -s rabbit boot -boot start_sasl -syslog logger [] -syslog syslog_error_logger false -kernel prevent_overlapping_partitions false
           ├─27076 erl_child_setup 1024
           ├─27103 /usr/local/lib/erlang/erts-12.3/bin/epmd -daemon
           ├─27128 inet_gethost 4
           └─27129 inet_gethost 4

11月 26 10:21:07 localhost.localdomain rabbitmq-server[27064]: TLS Library: OpenSSL - OpenSSL 1.0.2k-fips  26 Jan 2017
11月 26 10:21:07 localhost.localdomain rabbitmq-server[27064]: Doc guides:  https://rabbitmq.com/documentation.html
11月 26 10:21:07 localhost.localdomain rabbitmq-server[27064]: Support:     https://rabbitmq.com/contact.html
11月 26 10:21:07 localhost.localdomain rabbitmq-server[27064]: Tutorials:   https://rabbitmq.com/getstarted.html
11月 26 10:21:07 localhost.localdomain rabbitmq-server[27064]: Monitoring:  https://rabbitmq.com/monitoring.html
11月 26 10:21:07 localhost.localdomain rabbitmq-server[27064]: Logs: /usr/local/dhtech/rabbitmq/var/log/rabbitmq/rabbit@localhost.log
11月 26 10:21:07 localhost.localdomain rabbitmq-server[27064]: /usr/local/dhtech/rabbitmq/var/log/rabbitmq/rabbit@localhost_upgrade.log
11月 26 10:21:07 localhost.localdomain rabbitmq-server[27064]: <stdout>
11月 26 10:21:07 localhost.localdomain rabbitmq-server[27064]: Config file(s): (none)
11月 26 10:21:08 localhost.localdomain rabbitmq-server[27064]: Starting broker... completed with 3 plugins.

http://www.kler.cn/a/415503.html

相关文章:

  • redis命令 及 redis 常见的数据结构
  • 【科研】9如何高效阅读和理解学术论文
  • yt6801 ubuntu有线连接驱动安装
  • 处理流—BufferReader和BufferWrite
  • 【Python入门】Python数据类型
  • 华为开源操作系统openEuler安装部署
  • TransVG 代码配置及一些小细节
  • 《 C++ 点滴漫谈: 二 》编程语言之争:从 C 到 C++,两代语言的技术传承与演化,谁更适合你的项目?
  • 青训营-豆包MarsCode技术训练营试题解析九
  • 软件设计模式复习
  • 火语言RPA流程组件介绍--键盘按键
  • Scala学习记录,统计成绩
  • ADAM优化算法与学习率调度器:深度学习中的关键工具
  • 深入学习MapReduce:原理解析与基础实战
  • 认识redis 及 Ubuntu安装redis
  • Figma入门-约束与对齐
  • 【前端开发】小程序无感登录验证
  • windows下使用WSL
  • AI智算-正式上架GPU资源监控概览 Grafana Dashboard
  • 小程序-基于java+SpringBoot+Vue的戏曲文化苑小程序设计与实现
  • tomcat 8.5.35安装及配置
  • 【Leetcode Top 100】206. 反转链表
  • 消息传递神经网络(Message Passing Neural Networks, MPNN)
  • Unity类银河战士恶魔城学习总结(P150 End Screen结束重启按钮)
  • 学习threejs,使用specularMap设置高光贴图
  • 实习冲刺第三十四天