Erlang/OTP Forums

Author Message

<  RabbitMQ mailing list  ~  possible bug starting rabbit with NODENAME set?

Guest
Posted: Thu May 15, 2008 4:42 pm Reply with quote
Guest
rabbitmq-server 1.3.0, Debian Etch, erlang version doesn't seem to matter (R12B-2 and R11B-5)

When NODENAME is set to something other than "rabbit" in /etc/default/rabbitmq,
`/etc/init.d/rabbitmq start` always fails (while broker is actually started)




My temporary fix is this (startup will take some time to allow the original start to time
out):

# diff -uN rabbitmq-server-orig rabbitmq-server
--- rabbitmq-server-orig 2008-05-15 11:11:22.000000000 -0500
+++ rabbitmq-server 2008-05-15 11:16:25.000000000 -0500
@@ -28,6 +28,7 @@
start_rabbitmq () {
set +e
su rabbitmq -s /bin/sh -c "$DAEMON start_all ${NODE_COUNT}" >
/var/log/rabbitmq/startup.log 2> /var/log/rabbitmq/startup.err
+ /usr/sbin/rabbitmqctl -n $NODENAME status >/dev/null 2>&1
case "$?" in
0)
echo SUCCESS;;
@@ -42,7 +43,8 @@

stop_rabbitmq () {
set +e
- su rabbitmq -s /bin/sh -c "$DAEMON stop_all" > /var/log/rabbitmq/shutdown.log 2>
/var/log/rabbitmq/shutdown.err
+ #su rabbitmq -s /bin/sh -c "$DAEMON stop_all" > /var/log/rabbitmq/shutdown.log 2>
/var/log/rabbitmq/shutdown.err
+ /usr/sbin/rabbitmqctl -n $NODENAME stop
if [ $? != 0 ] ; then
echo FAILED - check /var/log/rabbitmq/shutdown.log, .err
exit 0








Here are the screen shots:

# cat /etc/default/rabbitmq
NODENAME=wabbit

# /etc/init.d/rabbitmq-server start
Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup.log, .err

# cat /var/log/rabbitmq/startup.*
Starting all nodes...
Starting node 0....
RabbitMQ 1.3.0 (AMQP 8-0)
Copyright (C) 2007-2008 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit
Technologies Ltd.
Licensed under the MPL. See http://www.rabbitmq.com/

Logging to "/var/log/rabbitmq/wabbit.log"
SASL logging to "/var/log/rabbitmq/wabbit-sasl.log"

starting database ...done
starting core processes ...done
starting recovery ...done
starting persister ...done
starting builtin applications ...done
starting TCP listeners ...done

broker running

rabbit_multi action start_all failed:
cannot_get_pid



rabbitmq 14717 0.6 0.7 14056 7768 ? Sl 15:55 0:00
//usr/lib/erlang/erts-5.5.5/bin/beam -W w -K true -A30 -- -root //usr/lib/erlang -progname
erl -- -home /var/lib/rabbitmq -pa /usr/sbin/../ebin -noshell -noinput -s rabbit -sname
wabbit -boot start_sasl -kernel inet_default_listen_options [{sndbuf,16384},{recbuf,4096}]
-rabbit tcp_listeners [{"0.0.0.0", 5672}] -sasl errlog_type error -kernel error_logger
{file,"/var/log/rabbitmq/wabbit.log"} -sasl sasl_error_logger
{file,"/var/log/rabbitmq/wabbit-sasl.log"} -os_mon start_cpu_sup true -os_mon
start_disksup false -os_mon start_memsup false -os_mon start_os_sup false -mnesia dir
"/var/lib/rabbitmq/mnesia/wabbit" -noshell -noinput


Also, note rabbitmqctl behavior looked erroneous to me (but my expectation might be wrong
here - I thought when NODENAME was set in /etc/default/rabbitmq, I didn't need to
explicitly set -n):

# rabbitmqctl status
Status of node rabbit@host1 ...
{badrpc,nodedown}
done.

# rabbitmqctl -n wabbit status
Status of node wabbit@host1 ...
[{running_applications,[{rabbit,"RabbitMQ","1.3.0"},
{mnesia,"MNESIA CXC 138 12","4.3.5"},
{os_mon,"CPO CXC 138 46","2.1.2.1"},
{sasl,"SASL CXC 138 11","2.1.5.1"},
{stdlib,"ERTS CXC 138 10","1.14.5"},
{kernel,"ERTS CXC 138 10","2.11.5"}]},
{nodes,[wabbit@host1]},
{running_nodes,[wabbit@host1]}]
done.




_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
Guest
Posted: Thu May 15, 2008 8:14 pm Reply with quote
Guest
Dmitriy,

Dmitriy Samovskiy wrote:
>
> rabbitmq-server 1.3.0, Debian Etch, erlang version doesn't seem to matter (R12B-2 and R11B-5)
>
> When NODENAME is set to something other than "rabbit" in /etc/default/rabbitmq,
> `/etc/init.d/rabbitmq start` always fails (while broker is actually started)

Well spotted. The problem is two-fold. Firstly, rabbitmq-multi does not
pay any attention to the settings of NODENAME, NODE_IP_ADDRESS and
NODE_PORT. Secondly - and that's what is actually causing the error you
reported - setting any of these vars in /etc/default/rabbitmq will
override any settings provided by rabbitmq-multi.

I have filed bugs to get these fixed.


Matthias.

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
Guest
Posted: Fri May 16, 2008 7:06 am Reply with quote
Guest
Edwin,

Edwin Fine wrote:
> On this topic, does RabbitMQ have to use a short name (-sname) for its
> node name? I had issues trying to use -name instead of -sname.

changing rabbitmq-server to use -name instead of -sname works fine for
me, though rabbitmq-multi would need some tweaking to get working again
after such a change.

What problems did you encounter?


Matthias.

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
Guest
Posted: Fri May 16, 2008 9:36 pm Reply with quote
Guest
Matthias,

I can also successfully run /usr/sbin/rabbitmq-server from the command line if I change -sname to -name. I just have to make sure that I change the actual mnesia dir to match the NODENAME.

But I think that in addition to the rabbit_multi script, rabbit_multi.erl will need some serious tweaking. I think it was written with local clustering in mind and did not adequately consider the effect of using fully-qualified domain names with -name.

This is my analysis of the code and behavior. If I am mistaken, I am sure you will point out where and why Smile

Firstly, rabbit_multi.erl hard-codes the node name "rabbit":

Guest
Posted: Fri May 16, 2008 10:22 pm Reply with quote
Guest
Edwin,

Edwin Fine wrote:
> I can also successfully run /usr/sbin/rabbitmq-server from the command
> line if I change -sname to -name. I just have to make sure that I change
> the actual mnesia dir to match the NODENAME.

By default the mnesia dir is based on the NODENAME. By "change" do you
mean "rename", so you retain the existing data across the move? That
wouldn't be a good idea - mnesia can get very confused if you its dirs
between nodes.

> But I think that in addition to the rabbit_multi script,
> rabbit_multi.erl will need some serious tweaking. I think it was written
> with local clustering in mind and did not adequately consider the effect
> of using fully-qualified domain names with -name.

Correct.

As a bit of background, rabbitmq-multi was introduced to give people a
quick and easy way to set up a cluster on their local machine. It was
never intended to cope with more complex set ups. There is all kinds of
tweaking a user may want to do to their cluster and the rabbit start up
in general. The scripts can only ever cater for a subset of that.

It's usually not that hard to construct your own scripts to start up
rabbit in the particular way that suits your environment, so we would
expect users to do just that.

> Firstly, rabbit_multi.erl hard-codes the node name "rabbit":

I filed a bug for that a few days ago.

> localnode would strip off everything after the "@" anyway. Now if
> rabbit@myexample.com <mailto:rabbit@myexample.com> were running
> locally, but using -name, the rpc call would fail because erlang
> would want the full node name.

As I said above, the scripts and supporting code were designed for
-sname, not -name. However, they can probably be adjusted to cope with
the latter. We will look into that.

> Just prior to this, to add insult to injury, the code blasts any
> environment values that might have existed.

Indeed. I filed a bug for that a few days ago too.

> I respectfully suggest that some more thought needs to go into
> rabbit_multi.erl and perhaps the startup/node name architecture.

Thanks for your analysis. Most of the points you raised should be
addressed in the next RabbitMQ release.


Matthias.

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
Guest
Posted: Sat May 17, 2008 2:40 am Reply with quote
Guest
Matthias

Quote:
By default the mnesia dir is based on the NODENAME. By "change" do you mean "rename", so you retain the existing data across the move? That wouldn't be a good idea - mnesia can get very confused if you its dirs between nodes.

Yes, I meant rename the directory on disk, but just within the same filesystem. Actually, I did a cp -R so the original directory was untouched. As it turns out, mnesia didn't seem to mind, so maybe I just got lucky this time. Even so, this is not a production system so I don't mind too much if I have to reinitialize RabbitMQ.


Quote:

Quote:
Firstly, rabbit_multi.erl hard-codes the node name "rabbit":


I filed a bug for that a few days ago.

I haven't looked very hard
Guest
Posted: Sat May 17, 2008 4:36 am Reply with quote
Guest
Edwin,

Edwin Fine wrote:
> Yes, I meant rename the directory on disk, but just within the same
> filesystem. Actually, I did a cp -R so the original directory was
> untouched. As it turns out, mnesia didn't seem to mind, so maybe I just
> got lucky this time.

There are a few discussions online on why just moving the dir won't
work. See
http://www.erlang.org/pipermail/erlang-questions/2002-January/004254.html,
for example.

> I haven't looked very hard for this, but is there a bug tracker for
> RabbitMQ that I can get to, and look for reported bugs so as not bug Wink
> you guys unnecessarily?

The bug tracker isn't public. It will be one day; we just need to find
the time to make the switch.

> I want to use -name because I will have applications running on a
> fully-qualified node (-name) that will be doing rpc:call()s to the
> rabbit node (to access the queue management functions), and I can't do
> that if Rabbit is running -sname and my stuff is running -name.

Understood. -name is of course useful; we'll see whether the scripts can
be made to support it more easily.


Matthias.


_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
Guest
Posted: Sat May 17, 2008 4:41 am Reply with quote
Guest
Thanks for the info!!

On Sat, May 17, 2008 at 12:36 AM, Matthias Radestock <matthias@lshift.net (matthias@lshift.net)> wrote:
Quote:
Edwin,

Edwin Fine wrote:
Quote:
Yes, I meant rename the directory on disk, but just within the same filesystem. Actually, I did a cp -R so the original directory was untouched. As it turns out, mnesia didn't seem to mind, so maybe I just got lucky this time.


There are a few discussions online on why just moving the dir won't work. See http://www.erlang.org/pipermail/erlang-questions/2002-January/004254.html, for example.

Quote:
I haven't looked very hard

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum