[rabbitmq-discuss] Proper process to change erlang cookie?

Alvaro Videla videlalvaro at gmail.com
Sat Sep 14 18:51:56 BST 2013


You will have one Erlang cookie per user that started a distributed Erlang
VM. Say you run RrabbitMQ as the user "rabbit". Erlang will create a cookie
for that user.

Then with your own user you try to run rabbitmqctl. That will create an
Erlang cookie in your home folder, and that cookie _won't_ match the one
created for RabbitMQ. What you have to do is either make sure both files
have the same content, or set the cookie during startup, or update it
afterwards to match the one of the other node you are trying to connect to.

See: http://www.erlang.org/doc/reference_manual/distributed.html#id83622


On Fri, Sep 13, 2013 at 3:45 PM, Ben Hsu <ben.hsu at criticalmedia.com> wrote:

> Thank you Alvaro,
>
>
> I understand  the difference between rabbitmq-server and rabbitmqctl now.
>
>
> I'm still not able to copy or edit the Erlang cookie without killing the
> process. I see two different .erlang.cookie files: one in /var/lib/rabbitmq
> and one in the users home directory. I copied the first to the second and
> still got the "unable to connect" problem
>
>
> I am running version 3.1.3.1 on CentOS
> -- Ben HsuSent with Airmail <http://airmailapp.com/tracking>
>
> On September 13, 2013 at 7:39:41 PM, Ben Hsu (ben.hsu at criticalmedia.com)
> wrote:
>
> The Erlang cookie belongs to each particular user on your machines.
> The cookie can be found on ~/.erlang.cookie and you need to have the same
> value there for every node in the cluster.
>
> start_app stops the Rabbit application inside the Erlang VM but the VM has
> to be running for that to work.
>
> stop_app will stop the rabbit app, but not the Erlang VM
>
> rabbitmq-server takes care of preparing the env parameters and starting
> the Erlang VM to then run RabbitMQ on it.
>
> Regards,
>
> Alvaro
>
> On Friday, September 13, 2013, Ben Hsu wrote:
>
>> Hello all
>>
>> I need to change the erlang cookie on my RabbitMQ server to get
>> clustering working, and wish to know the correct procedure.
>>
>> I tried doing this:
>>
>> rabbitmqctl stop_app
>> vi /var/lib/rabbitmq/.erlang.cookie
>> rabbitmqctl start_app # this gave me an error message: *Error: unable to
>> connect to node 'rabbit at ben-amqp-test4': nodedown*
>>
>> By trial and error, I found this worked:
>> pkill beam
>> pkill epmd
>> vi /var/lib/rabbitmq/.erlang.cookie
>> rabbitmq-server
>> # now in a separate window, for some reason it didn't work with
>> rabbitmq-server -detached
>> rabbitmqctl start_app
>>
>> That seemed to work, but is ugly, and doesn't feel like the right way of
>> doing it.
>>
>> Also, what is the difference between "rabbitmqctl start_app" and
>> "rabbitmq-server"?
>>
>> Thanks in advance
>>
>> --
>> Ben Hsu
>> Sent with Airmail <http://airmailapp.com/tracking>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130914/8a5cd094/attachment.htm>


More information about the rabbitmq-discuss mailing list