summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexey Lebedeff <alebedev@mirantis.com>2016-07-22 10:24:28 +0300
committerAlexey Lebedeff <alebedev@mirantis.com>2016-07-22 10:30:18 +0300
commit37d4fc789d89a1ff981bd8d771013014b4d05147 (patch)
tree6a8f9098e8ef9281663bf294789644e0ebea28a5 /scripts
parent0c316fc3b6c135236fb0a267b31595dc5762f9eb (diff)
downloadrabbitmq-server-git-37d4fc789d89a1ff981bd8d771013014b4d05147.tar.gz
Fix longname-mode on hosts without detectable FQDN
Server startup and CLI tools fail in longnames-mode if erlang is not able to determine host FQDN (with at least one dot in it). E.g. this can happen when you want to assemble a cluster using only IP-addresses, and you completely don't care about FQDNs. And it was not possible to alleviate this situation using any options from http://erlang.org/doc/apps/erts/inet_cfg.html Fixes #890
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/rabbitmq-server13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server
index 74337311cd..c99022fcf6 100755
--- a/scripts/rabbitmq-server
+++ b/scripts/rabbitmq-server
@@ -62,6 +62,17 @@ RABBITMQ_EBIN_ROOT="${RABBITMQ_HOME}/ebin"
set +e
+# `net_kernel:start/1` will fail in `longnames` mode when erlang is
+# unable to determine FQDN of a node (with a dot in it). But `erl`
+# itself has some magic that still allow it to start when you
+# explicitly specify host (a.la `erl -name test@localhost`).
+#
+# It's not possible to communicate with this node, unless it's a
+# connection initiator. But as prelaunch IS an initiator, it doesn't
+# matter what we actually put here. But `localhost` sounds good
+# enough.
+RABBITMQ_PRELAUNCH_NODENAME="rabbitmqprelaunch${$}@localhost"
+
# NOTIFY_SOCKET is needed here to prevent epmd from impersonating the
# success of our startup sequence to systemd.
NOTIFY_SOCKET= \
@@ -72,7 +83,7 @@ RABBITMQ_DIST_PORT=$RABBITMQ_DIST_PORT \
-noinput \
-hidden \
-s rabbit_prelaunch \
- ${RABBITMQ_NAME_TYPE} rabbitmqprelaunch$$ \
+ ${RABBITMQ_NAME_TYPE} ${RABBITMQ_PRELAUNCH_NODENAME} \
-extra "${RABBITMQ_NODENAME}"
PRELAUNCH_RESULT=$?