[rabbitmq-discuss] Question about erlang cookie

Anton Sizov a.sysoff at gmail.com
Tue Jul 23 09:23:28 BST 2013


1) Probably installation created files with rabbitmq user ownes. It is not 
good practice to run rabbitmq server with root privileges. RabbitMQ need 
rights to read/write to mnesia and log dirs only. You can run RMQ with non 
root user.

2) Default place for .erlang.cookie file is user home directory. Probably 
at the installation RMQ places cookie in its installation dir 
(/var/lib/rabbitmq). Read 
http://www.erlang.org/doc/reference_manual/distributed.html and 
http://www.rabbitmq.com/clustering.html for more info about erlang cookie.

3) Your understanding is correct. RMQ uses only one cookie file. To be 
consistent you can delete one of them. Start with that placed in user home 
dir. Probably RMQ creates cookie in home dir when started not with rabbitmq 
user or not with init script (service rabbitmq strarted). I use precompiled 
RMQ package that place in /opt dir. 

4) You doesn't I think. Different cookies can be the reason of such 
problems. To help you, it necessary to know
- how you start rabbitmq node (1 and 2)
- try to start nodes not in cluster on different servers with the same 
cookie and with the full name resolving (-name flag instead of -sname). 
Then try to get status of each node from it server and from another.

[server1]# rabbitmq -n rabbtimq at server1 status
[server1]# rabbitmq -n rabbtimq at server2 status
[server2]# rabbitmq -n rabbtimq at server1 status
[server2]# rabbitmq -n rabbtimq at server2 status

It is minimum of actions to start resolve your problem.

On Tuesday, July 2, 2013 1:42:37 PM UTC+3, Priyanki Vashi wrote:
> Hi there ,
> I had a question about erlang cookie, which gets generated when we start 
> rabbitmq server. The situation is as follows.
> 1) Even if I did not created any user named 'rabbitmq', there are files, 
> which are owned by this user. Does the installation or startup of 
> rabbitmq-server does this ? Also is it OK to use root user to do server 
> administration operation or will it be considered not so good practice ? 
> 2) I use root user to start and stop rabbitmq server and when I start the 
> server, I see that a file .erlang.cookie gets generated in root home dir. 
> That is correct as per my understanding but I also see that there is 
> another file with the same .erlang.cookie gets generated in 
> /var/lib/rabbitmq
> 3) Also these two erlang cookies are different from each other. Why there 
> are two erlang cookie files gets generated ? What is the importance ?
> My theoretical understanding is there should be only one erlang cookie 
> should get generated and that one should be in home dir of user, which 
> starts the rabbitmq-server.
> Is this correct understanding or ? 
> 4) Also do I need to configure different values of epmd ports when I want 
> to run cluster with two physical nodes or it's OK to keep it as default ? 
>     I thought NO need to change but then since I am running into these 
> problems thought of asking. 
> I would like to understand this bcoz, I tried to setup a cluster on two 
> different physical machines and as per the guidelines gives in 'rabbitmq in 
> action', before joining nodes running on different physical machines in the 
> cluster, the erlang cookie should be sync meaning that both the nodes 
> should have same erlang cookie so I tried to copy cookie from first node to 
> second and tried to restart second node but then I had problems with 
> restarting the node or even stopping the node and I get error. I also 
> checked the latest log file and it says 
> "=ERROR REPORT==== 2-Jul-2013::19:48:28 ===
> ** Connection attempt from disallowed node rabbitmqctl40424 at nazgul **" , 
> which I believe is due to the fact that erlang cookie, which it had 
> originally when I started the node has changed now and hence it does not 
> allow me to stop the node. Is my understanding correct here or ?
> Error mesaage while stopping or restarting the node after copying erlang 
> cookie from first node to second one.
> Error: unable to connect to node rabbit_2 at nazgul: nodedown
> ===========
> nodes in question: [rabbit_2 at nazgul]
> hosts, their running nodes and ports:
> - nazgul: [{rabbit_2,58454},{rabbit,38771},{rabbitmqctl40424,60952}]
> current node details:
> - node name: rabbitmqctl40424 at nazgul
> - home dir: /var/lib/rabbitmq
> - cookie hash: ad/NgkXjjR95x3cMejxwqg==
> Thank you in advance and please guide me so that I understand what had 
> gone wrong here.
> Best Regards,
> Priyanki.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130723/d4137dcc/attachment.htm>

More information about the rabbitmq-discuss mailing list