板卡掉电以后发现rabbitmq服务被停了,重启之:
root@firefly:/var/lib/rabbitmq/mnesia# cd /usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin/
root@firefly:/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:
root@firefly:/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/rabbit@firefly-plugins-expand",
{cannot_delete,
"/var/lib/rabbitmq/mnesia/rabbit@firefly-plugins-expand",
eacces}]}}
Log files (may contain more information):
/var/log/rabbitmq/rabbit@firefly.log
/var/log/rabbitmq/rabbit@firefly-sasl.log
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/rabbit@firefly-plugins-expand",{cannot_delete,"/var/lib/rabbitmq/mnesia/rabbit@firefly-plugins-expand",eacces}]}}}}
提示无法删除文件夹/var/lib/rabbitmq/mnesia/rabbit@firefly-plugins-expand
上网查找类似错误,说是文件权限问题,发现报错文件夹属性为root:root
root@firefly:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin# cd /var/lib/rabbitmq/mnesia/
root@firefly:/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 rabbit@firefly/
-rw-rw-r-- 1 rabbitmq rabbitmq 5 May 31 00:57 rabbit@firefly.pid
drwxr-xr-x 2 root root 4096 May 31 01:44 rabbit@firefly-plugins-expand/
修改文件夹权限: chown -R rabbitmq:rabbitmq rabbit@firefly-plugins-expand/
重启仍然报错!!!!
发现mnesia的属性也是root:
root@firefly:/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/root@firefly:/var/lib/rabbitmq# chown -R rabbitmq:rabbitmq mnesia/
重启服务OK:
root@firefly:/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/
root@firefly:/var/lib/rabbitmq#
root@firefly:/var/lib/rabbitmq#
root@firefly:/var/lib/rabbitmq#
root@firefly:/var/lib/rabbitmq# cd /usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin
root@firefly:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin# service rabbitmq-server start
* Starting message broker rabbitmq-server
...done.
查看进程,正常
root@firefly:/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 rabbit@firefly -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/rabbit@firefly.log"} -rabbit sasl_error_logger {file,"/var/log/rabbitmq/rabbit@firefly-sasl.log"} -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/rabbit@firefly-plugins-expand" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/var/lib/rabbitmq/mnesia/rabbit@firefly"
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