===============================================
2017/10/24_第1次修改 ccb_warlock
===============================================
背景:开发人员部署rabbitmq(v3.6.10)时采用的是安装rpm包的方式,但是测试人员提供的部署手册中采取的是编译安装的启动方式。
当时提供的手册,部署rabbitmq的方式如下:
rpm -Uvh http://download.Fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
yum install erlang -y
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-3.6.10-1.el7.noarch.rpm
yum install -y rabbitmq-server-3.6.10-1.el7.noarch.rpm
#启动
/usr/lib/rabbitmq/lib/rabbitmq_server-3.6.10/sbin/rabbitmq-server -detached
rpm包通用的服务启动命令:systemctl start rabbitmq-server
rabbitmq编译启动命令:/usr/lib/rabbitmq/lib/rabbitmq_server-3.6.10/sbin/rabbitmq-server -detached
由于园区停电的原因,发现了验证环境的rabbitmq当时配的不是开机启动。
本来想的是/usr/lib/rabbitmq/lib/rabbitmq_server-3.6.10/sbin/rabbitmqctl stop先关闭目前的服务,然后在用systemctl start rabbitmq-server这样来启动,再通过systemctl enable rabbitmq-server来配置开机启动。
结果systemctl start rabbitmq-server启动报错。
查看rabbitmq服务状态
systemctl status rabbitmq-server -l
rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 一 2017-10-23 23:46:05 CST; 10s ago
Process: 26394 ExecStop=/usr/sbin/rabbitmqctl stop (code=exited, status=0/SUCCESS)
Process: 26094 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 26094 (code=exited, status=1/FAILURE)
Status: "Exited."
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: * epmd reports: node 'rabbit' not running at all
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: no other nodes on localhost
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: * suggestion: start the node
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: current node details:
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: - node name: 'rabbitmq-cli-90@localhost'
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: - home dir: .
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: - cookie hash: 5nJnhEE/zsuKM6LVTCYNGg==
10月 23 23:46:05 localhost.localdomain systemd[1]: Failed to start RabbitMQ broker.
10月 23 23:46:05 localhost.localdomain systemd[1]: Unit rabbitmq-server.service entered failed state.
10月 23 23:46:05 localhost.localdomain systemd[1]: rabbitmq-server.service failed.
接着查看系统日志
journalctl -xe
10月 23 23:46:00 localhost.localdomain rabbitmq-server[26094]: {rabbit_boot_steps,'-run_boot_steps/1-lc$^0/1-0-',1,
10月 23 23:46:00 localhost.localdomain rabbitmq-server[26094]: [{file,"src/rabbit_boot_steps.erl"},{line,26}]}]}}
10月 23 23:46:00 localhost.localdomain rabbitmq-server[26094]: Log files (may contain more information):
10月 23 23:46:00 localhost.localdomain rabbitmq-server[26094]: /var/log/rabbitmq/rabbit@localhost.log
10月 23 23:46:00 localhost.localdomain rabbitmq-server[26094]: /var/log/rabbitmq/rabbit@localhost-sasl.log
10月 23 23:46:01 localhost.localdomain rabbitmq-server[26094]: {"init terminating in do_boot",{could_not_start,rabbit,{{badmatch,{error,{{{badmatch,{error,{"/var/lib/rabbitmq/mnesia/rabbit@localhost/msg_store_transient/0.rdq",eacces}}},[{rabbit_msg_store,init,1,[{file,"src/rabbit_msg_store.erl"},{line,726}]},{gen_server2,init_it,6,[{file,"src/gen_server2.erl"},{line,554}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]},{child,undefined,msg_store_transient,{rabbit_msg_store,start_link,[msg_store_transient,"/var/lib/rabbitmq/mnesia/rabbit@localhost",,undefined,{#Fun<rabbit_variable_queue.0.118228399>,ok}]},transient,30000,worker,[rabbit_msg_store]}}}},[{rabbit_variable_queue,start_msg_store,2,[{file,"src/rabbit_variable_queue.erl"},{line,482}]},{rabbit_variable_queue,start,1,[{file,"src/rabbit_variable_queue.erl"},{line,467}]},{rabbit_priority_queue,start,1,[{file,"src/rabbit_priority_queue.erl"},{line,92}]},{rabbit_amqqueue,recover,0,[{file,"src/rabbit_amqqueue.erl"},{line,238}]},{rabbit,recover,0,[{file,"src/rabbit.erl"},{line,799}]},{rabbit_boot_steps,'-run_step/2-lc$^1/1-1-',1,[{file,"src/rabbit_boot_steps.erl"},{line,49}]},{rabbit_boot_steps,run_step,2,[{file,"src/rabbit_boot_steps.erl"},{line,49}]},{rabbit_boot_steps,'-run_boot_steps/1-lc$^0/1-0-',1,[{file,"src/rabbit_boot_steps.erl"},{line,49}]},{rabbit_boot_steps,run_step,2,[{file,"src/rabbit_boot_steps.erl"},{line,49}]},{rabbit_boot_steps,'-run_boot_steps/1-lc$^0/1-0-',1,[{file,"src/rabbit_boot_steps.erl"},{line,26}]}]}}}
10月 23 23:46:03 localhost.localdomain rabbitmq-server[26094]: Crash dump was written to: erl_crash.dump
10月 23 23:46:03 localhost.localdomain rabbitmq-server[26094]: init terminating in do_boot ()
10月 23 23:46:03 localhost.localdomain systemd[1]: rabbitmq-server.service: main process exited, code=exited, status=1/FAILURE
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: Stopping and halting node rabbit@localhost
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: Error: unable to connect to node rabbit@localhost: nodedown
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: DIAGNOSTICS
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: ===========
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: attempted to contact: [rabbit@localhost]
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: rabbit@localhost:
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: * connected to epmd (port 4369) on localhost
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: * epmd reports: node 'rabbit' not running at all
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: no other nodes on localhost
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: * suggestion: start the node
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: current node details:
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: - node name: 'rabbitmq-cli-90@localhost'
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: - home dir: .
10月 23 23:46:05 localhost.localdomain rabbitmqctl[26394]: - cookie hash: 5nJnhEE/zsuKM6LVTCYNGg==
10月 23 23:46:05 localhost.localdomain systemd[1]: Failed to start RabbitMQ broker.
-- Subject: Unit rabbitmq-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit rabbitmq-server.service has failed.
--
-- The result is failed.
10月 23 23:46:05 localhost.localdomain systemd[1]: Unit rabbitmq-server.service entered failed state.
10月 23 23:46:05 localhost.localdomain systemd[1]: rabbitmq-server.service failed.
10月 23 23:46:05 localhost.localdomain polkitd[777]: Unregistered Authentication Agent for unix-process:26088:2339220 (system bus name :1.72, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_CN.UTF-8) (disconnected from bus)
lines 1200-1233/1233 (END)
解决方案:
/var/lib/rabbitmq/mnesia 目录下存在rabbit@localhost.pid、rabbit@localhost、rabbit@localhost-plugins-expand,删除这3项后,再使用systemctl start rabbitmq-server启动,发现不报错了。