springboot rabbitMQ 启动报错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot rabbitMQ 启动报错相关的知识,希望对你有一定的参考价值。

参考技术A Caused by: org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s)

:[vip_seller_classplan_domain_queue_for_realloacate]

org.springframework.context.ApplicationContextException: Failed to start

bean 'org.springframework.amqp.rabbit.config.internalRabbitListenerEndpointRegistry';

nested exception is org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup

如果看见这个 caused by  先不用多想了, 去把 mq 的 queue 加上

Failed to declare queue(s)

:[vip_seller_classplan_domain_queue_for_realloacate]

就是 [xxxx]  里的xxxx

之后重启。

Rabbitmq启动报错

板卡掉电以后发现rabbitmq服务被停了,重启之:

[email protected]:/var/lib/rabbitmq/mnesia# cd /usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin/
[email protected]:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin# service rabbitmq-server start
* Starting message broker rabbitmq-server
* FAILED - check /var/log/rabbitmq/startup_\{log, _err\}
   ...fail!
 
发现失败!!!!!
 
查看报错log:
[email protected]:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin# cat /var/log/rabbitmq/startup_log
 
 
BOOT FAILED
===========
 
Error description:
   {error,
       {cannot_delete_plugins_expand_dir,
           ["/var/lib/rabbitmq/mnesia/[email protected]",
            {cannot_delete,
                "/var/lib/rabbitmq/mnesia/[email protected]",
                eacces}]}}
 
Log files (may contain more information):
   /var/log/rabbitmq/[email protected]
   /var/log/rabbitmq/[email protected]
 
Stack trace:
   [{rabbit_plugins,prepare_plugins,3,
                    [{file,"src/rabbit_plugins.erl"},{line,123}]},
    {rabbit,‘-boot/0-fun-1-‘,0,[{file,"src/rabbit.erl"},{line,332}]},
    {rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,354}]},
    {init,start_it,1,[]},
    {init,start_em,1,[]}]
 
{"init terminating in do_boot",{rabbit,failure_during_boot,{error,{cannot_delete_plugins_expand_dir,["/var/lib/rabbitmq/mnesia/[email protected]",{cannot_delete,"/var/lib/rabbitmq/mnesia/[email protected]",eacces}]}}}}
 

提示无法删除文件夹/var/lib/rabbitmq/mnesia/[email protected]

 
上网查找类似错误,说是文件权限问题,发现报错文件夹属性为root:root
[email protected]:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin# cd /var/lib/rabbitmq/mnesia/
[email protected]:/var/lib/rabbitmq/mnesia# ll
total 20
drwxr-xr-x 4 root     root     4096 May 31 01:44 ./
drwxr-xr-x 3 rabbitmq rabbitmq 4096 May 30 22:25 ../
drwxr-xr-x 4 rabbitmq rabbitmq 4096 May 31 01:50 [email protected]/
-rw-rw-r-- 1 rabbitmq rabbitmq    5 May 31 00:57 [email protected]
drwxr-xr-x 2 root     root     4096 May 31 01:44 [email protected]/
 
修改文件夹权限: chown -R rabbitmq:rabbitmq [email protected]/
 
重启仍然报错!!!!
发现mnesia的属性也是root:
[email protected]:/var/lib/rabbitmq# ll
total 1212
drwxr-xr-x  3 rabbitmq rabbitmq    4096 May 30 22:25 ./
drwxr-xr-x 46 root     root        4096 May 21 05:45 ../
-r--------  1 rabbitmq rabbitmq      20 May 21 00:00 .erlang.cookie
-rw-r-----  1 rabbitmq rabbitmq 1220937 May 31 01:52 erl_crash.dump
drwxr-xr-x  4 root     root        4096 May 31 01:44 mnesia/
 

修改之: chown -R rabbitmq:rabbitmq mnesia/[email protected]:/var/lib/rabbitmq# chown -R rabbitmq:rabbitmq mnesia/

 
重启服务OK:
[email protected]:/var/lib/rabbitmq# ll
total 1212
drwxr-xr-x  3 rabbitmq rabbitmq    4096 May 30 22:25 ./
drwxr-xr-x 46 root     root        4096 May 21 05:45 ../
-r--------  1 rabbitmq rabbitmq      20 May 21 00:00 .erlang.cookie
-rw-r-----  1 rabbitmq rabbitmq 1220937 May 31 01:52 erl_crash.dump
drwxr-xr-x  4 rabbitmq rabbitmq    4096 May 31 01:44 mnesia/
[email protected]:/var/lib/rabbitmq#
[email protected]:/var/lib/rabbitmq#
[email protected]:/var/lib/rabbitmq#
[email protected]:/var/lib/rabbitmq# cd /usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin
[email protected]:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin# service rabbitmq-server start
* Starting message broker rabbitmq-server
   ...done.
 
查看进程,正常
[email protected]:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin# ps -aux|grep rabbitmq
rabbitmq   884  0.0  0.0   1804   248 ?        S    01:48   0:00 /usr/lib/erlang/erts-5.10.4/bin/epmd -daemon
rabbitmq  2170  0.0  0.0   1392   444 ?        S    01:55   0:00 /bin/sh /usr/sbin/rabbitmq-server
rabbitmq  2179 13.4  1.3 111216 26808 ?        Sl   01:55   0:07 /usr/lib/erlang/erts-5.10.4/bin/beam.smp -W w -K true -A30 -P 1048576 -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbitmq -- -pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin/../ebin -noshell -noinput -s rabbit boot -sname [email protected] -boot start_sasl -kernel inet_default_connect_options [{nodelay,true}] -sasl errlog_type error -sasl sasl_error_logger false -rabbit error_logger {file,"/var/log/rabbitmq/[email protected]"} -rabbit sasl_error_logger {file,"/var/log/rabbitmq/[email protected]"} -rabbit enabled_plugins_file "/etc/rabbitmq/enabled_plugins" -rabbit plugins_dir "/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin/../plugins" -rabbit plugins_expand_dir "/var/lib/rabbitmq/mnesia/[email protected]" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/var/lib/rabbitmq/mnesia/[email protected]"
rabbitmq  2310  0.0  0.0   1776   252 ?        Ss   01:55   0:00 inet_gethost 4
rabbitmq  2311  0.0  0.0   1840   512 ?        S    01:55   0:00 inet_gethost 4
root      2325  2.0  0.0   3776   668 pts/0    S+   01:56   0:00 grep --color=auto rabbitmq

以上是关于springboot rabbitMQ 启动报错的主要内容,如果未能解决你的问题,请参考以下文章

SpringBoot+RabbitMQ启动出现报错问题总结org.springframework.amqp.AmqpConnectException: java.net.ConnectExceptio

SpringBoot启动类报错,有啥办法解决吗

springboot 整合rabbitMQ报错

springboot集成RabbitMQ,Eclipse开发集成RabbitMq,IDEA集成RabbitMQ报错 socket close

SpringBoot整合RabbitMQ报错 org.springframework.amqp.AmqpIOException: java.io.IOException

rabbitmq升级服务 启动报错