I have two nodes running, first.abc.com and second.abc.com, when try to execute
ejabberdctl --node
getting a crash error as mentioned below
"Can't set long node name!\nPlease check your configuration"
I could able to see two nodes running using admin interface and using ejabberd source 2.0.1 version, if I try same with short node name ejabberd@localhost it works fine but not in the cluster environment
Please let me know what is wrong with the command
Try this change
I think I found the problem. Can you try a small change on your ejabberdctl script? You can see where that script is installed in your system with "which ejabberdctl".
Badlop, I have made the
Badlop,
I have made the suggested changes and the output is little weird, on the first node ieejabberd@first.abc.com if I run
/sbin/ejabberdctl --nodeejabberd@first.abc.com connected-users
it throw an error
RPC failed on the node 'ejabberd@first.abc.cocm': nodedown
but same work if I run forejabberd@second.abc.com on the first node ie
/sbin/ejabberdctl --nodeejabberd@second.abc.com connected-users
works fine - list the online users
and made same changes of ejabberdctl on second node and the found the same behavior that is in second node I'm able to list online users for first nodeejabberd@first.abc.com but throw an error 'RPC failed node down' for ejabberd@second.abc.com
Also i tried to understand the changes... but given up since it's hard to start with out understanding the basic
But the admin interface able to lists the online users on both the nodes correctly
Here is how my /sbin/ejabberdctl looks like
#!/bin/sh
# define default configuration
POLL=true
SMP=auto
ERL_MAX_PORTS=32000
ERL_PROCESSES=250000
ERL_MAX_ETS_TABLES=1400
# define default environment variables
NODE=ejabberd
#HOST=localhost
HOST=first.tutorvista.com
ERLANG_NODE=$NODE@$HOST
ROOTDIR=/
EJABBERD_CONFIG_PATH=$ROOTDIR/etc/ejabberd/ejabberd.cfg
LOGS_DIR=$ROOTDIR/var/log/ejabberd/
EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$ERLANG_NODE
# read custom configuration
CONFIG=$ROOTDIR/etc/ejabberd/ejabberdctl.cfg
[ -f "$CONFIG" ] && . "$CONFIG"
# parse command line parameters
ARGS=
while [ $# -ne 0 ] ; do
PARAM=$1
shift
case $PARAM in
--) break ;;
--node) ERLANG_NODE=$1; shift ;;
--config) EJABBERD_CONFIG_PATH=$1 ; shift ;;
--ctl-config) CONFIG=$1 ; shift ;;
--logs) LOGS_DIR=$1 ; shift ;;
--spool) EJABBERD_DB=$1 ; shift ;;
*) ARGS="$ARGS $PARAM" ;;
esac
done
NAME=-name
[ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] && NAME=-sname
ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES"
# define additional environment variables
EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin
EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs
EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib
EJABBERD_BIN_PATH=$ROOTDIR/var/lib/ejabberd/priv/bin
EJABBERD_LOG_PATH=$LOGS_DIR/ejabberd.log
SASL_LOG_PATH=$LOGS_DIR/sasl.log
DATETIME=`date "+%Y%m%d-%H%M%S"`
ERL_CRASH_DUMP=$LOGS_DIR/erl_crash_$DATETIME.dump
ERL_INETRC=$ROOTDIR/etc/ejabberd/inetrc
HOME=$ROOTDIR/var/lib/ejabberd
# export global variables
export EJABBERD_CONFIG_PATH
export EJABBERD_MSGS_PATH
export EJABBERD_LOG_PATH
export EJABBERD_SO_PATH
export EJABBERD_BIN_PATH
export ERL_CRASH_DUMP
export ERL_INETRC
export ERL_MAX_PORTS
export ERL_MAX_ETS_TABLES
export HOME
[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB
[ -d $LOGS_DIR ] || mkdir -p $LOGS_DIR
# Compatibility in ZSH
#setopt shwordsplit 2>/dev/null
# start server
start ()
{
erl \
$NAME $ERLANG_NODE \
-noinput -detached \
-pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \
-s ejabberd \
-sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\} \
$ERLANG_OPTS $ARGS "$@"
}
# attach to server
debug ()
{
echo "--------------------------------------------------------------------"
echo ""
echo "IMPORTANT: we will attempt to attach an INTERACTIVE shell"
echo "to an already running ejabberd node."
echo "If an ERROR is printed, it means the connection was not succesfull."
echo "You can interact with the ejabberd node if you know how to use it."
echo "Please be extremely cautious with your actions,"
echo "and exit immediately if you are not completely sure."
echo ""
echo "To detach this shell from ejabberd, press:"
echo " control+c, control+c"
echo ""
echo "--------------------------------------------------------------------"
echo "Press any key to continue"
read foo
echo ""
erl \
$NAME debug-${ERLANG_NODE} \
-remsh $ERLANG_NODE \
$ERLANG_OPTS $ARGS "$@"
}
# start interactive server
live ()
{
echo "--------------------------------------------------------------------"
echo ""
echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode."
echo "All log messages will be shown in the command shell."
echo "You can interact with the ejabberd node if you know how to use it."
echo "Please be extremely cautious with your actions,"
echo "and exit immediately if you are not completely sure."
echo ""
echo "To exit this LIVE mode and stop ejabberd, press:"
echo " q(). and press the Enter key"
echo ""
echo "--------------------------------------------------------------------"
echo "Press any key to continue"
read foo
echo ""
erl \
$NAME $ERLANG_NODE \
$ERLANG_OPTS \
-pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \
-s ejabberd \
$ERLANG_OPTS $ARGS "$@"
}
# common control function
ctl ()
{
erl \
$NAME ctl-${ERLANG_NODE} \
-noinput \
-pa $EJABBERD_EBIN \
-s ejabberd_ctl -extra $ERLANG_NODE $@
result=$?
case $result in
0) :;;
*)
echo ""
echo "Commands to start an ejabberd node:"
echo " start Start an ejabberd node in server mode"
echo "Press any key to continue"
read foo
echo ""
erl \
$NAME debug-${ERLANG_NODE} \
-remsh $ERLANG_NODE \
$ERLANG_OPTS $ARGS "$@"
}
# start interactive server
live ()
{
echo "--------------------------------------------------------------------"
echo ""
echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode."
echo "All log messages will be shown in the command shell."
echo "You can interact with the ejabberd node if you know how to use it."
echo "Please be extremely cautious with your actions,"
echo "and exit immediately if you are not completely sure."
echo ""
echo "To exit this LIVE mode and stop ejabberd, press:"
echo " q(). and press the Enter key"
echo ""
echo "--------------------------------------------------------------------"
echo "Press any key to continue"
read foo
echo ""
erl \
$NAME $ERLANG_NODE \
$ERLANG_OPTS \
-pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \
-s ejabberd \
$ERLANG_OPTS $ARGS "$@"
}
# common control function
ctl ()
{
erl \
$NAME ctl-${ERLANG_NODE} \
-noinput \
-pa $EJABBERD_EBIN \
-s ejabberd_ctl -extra $ERLANG_NODE $@
result=$?
case $result in
0) :;;
*)
echo ""
echo "Commands to start an ejabberd node:"
echo " start Start an ejabberd node in server mode"
echo " debug Attach an interactive Erlang shell to a running ejabberd node"
echo " live Start an ejabberd node in live (interactive) mode"
echo ""
echo "Optional parameters when starting an ejabberd node:"
echo " --config file Config file of ejabberd: $EJABBERD_CONFIG_PATH"
echo " --ctl-config file Config file of ejabberdctl: $CONFIG"
echo " --logs dir Directory for logs: $LOGS_DIR"
echo " --spool dir Database spool dir: $EJABBERD_DB"
echo "";;
esac
return $result
}
# display ctl usage
usage ()
{
ctl
exit
}
case $ARGS in
' start') start;;
' debug') debug;;
' live') live;;
*) ctl $ARGS;;
esac