1、启动失败
启动rabbitmq在启动的过程中,等待了很长一段时间,然后抛出如下错误
解决方案
在linux中的/etc/hosts文件中配置中添加
127.0.0.1 iZwz958xjb4po9lyywffZ
执行下面命令,启动异常
rabbitmq-server start
Job for rabbitmq-server.service failed because the control process exited with error code …
解决方案
问题分析,从node1的启动报错来看,像是集群信息残留。在node2上操作将node1移除集群,node1的rabbitmq服务已经down掉了,所以数据库无法同步更新,记载的仍是旧的集群信息(数据库记录里自身节点仍属于集群),而node2和node3的数据库记录已经更新(数据库信息里面集群不包含node1节点了)。
那么就得将这个节点mnesia 数据删掉
2、远程连接
由于guest这个用户,只能在本地访问,所以我们要新增一个用户并赋予权限:
添加用户
rabbitmqctl add_user admin admin
添加权限
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
将admin用户赋管理员权限
rabbitmqctl set_user_tags admin administrator
然后就可以远程访问了,然后可直接配置用户权限等信息。
到此,就可以通过http://ip:15628 使用admin admin 进行登陆了
3、添加用户失败
执行 ./rabbitmqctl add_user admin admin
发生错误
Error: unable to connect to node rabbit@priseapp1: nodedown
DIAGNOSTICS
===========
attempted to contact: [rabbit@priseapp1]
rabbit@priseapp1:
* connected to epmd (port 4369) on priseapp1
* epmd reports node 'rabbit' running on port 25672
* TCP connection succeeded but Erlang distribution failed
* Authentication failed (rejected by the remote node), please check the Erlang cookie
current node details:
- node name: 'rabbitmq-cli-41@priseapp1'
- home dir: /root
- cookie hash: eimqBVhgfn4tf669RRhx0g==
解决方案
根据错误描述-----无法连接到节点兔子@ PrimeApp1:节点
可知,启动脚本有错误,要修改配置,先停止服务。
进入安装文件夹/usr/lib/rabbitmq/bin
修改rabbitmqctl文件
打开rabbitmqctl文件,添加一行Home配置: HOME=/var/lib/rabbitmq \
示例:
#!/bin/sh -e
## The contents of this file are subject to the Mozilla Public License
## Version 1.1 (the "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of the License
## at http://www.mozilla.org/MPL/
##
## Software distributed under the License is distributed on an "AS IS"
## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
## the License for the specific language governing rights and
## limitations under the License.
##
## The Original Code is RabbitMQ.
##
## The Initial Developer of the Original Code is GoPivotal, Inc.
## Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved.
##
# Get default settings with user overrides for (RABBITMQ_)<var_name>
# Non-empty defaults should be set in rabbitmq-env
. `dirname $0`/rabbitmq-env
# Disable erl_crash.dump by default for control scripts.
if [ -z "$ERL_CRASH_DUMP_SECONDS" ]; then
export ERL_CRASH_DUMP_SECONDS=0
fi
# We specify Mnesia dir and sasl error logger since some actions
# (e.g. forget_cluster_node --offline) require us to impersonate the
# real node.
HOME=/var/lib/rabbitmq \
RABBITMQ_USE_LONGNAME=${RABBITMQ_USE_LONGNAME} \
exec ${ERL_DIR}erl \
-pa "${RABBITMQ_HOME}/ebin" \
-noinput +B \
-hidden \
${RABBITMQ_CTL_ERL_ARGS} \
-boot "${CLEAN_BOOT_FILE}" \
-sasl errlog_type error \
-mnesia dir "\"${RABBITMQ_MNESIA_DIR}\"" \
-s rabbit_control_main \
-nodename $RABBITMQ_NODENAME \
-extra "$@"
4、后台启动模式
rabbitmq-server -detached