title: Distributed RabbitMQ Nodes don't recognize each other
body: <p>I'm working on a RabbitMQ distributed POC and I'm stuck at the basics of clustering the nodes.<br>
  I'm trying to follow the rabbit's <a href="http://www.rabbitmq.com/clustering.html" rel="nofollow">tutorial</a> on clustering so this is my reference.<br>
  After installing erlang (R14B04) and rabbit (2.8.2-1) I've copied the <code>.erlang.cookie</code> file contents from one node to the other two.<br>
  I wasn't sure about how to get erlang to notice this change to I had to restart the machines themselves (pretty brute force but I don't know erlang at all).<br>
  In addtion I opened in iptables 4369 and 5 additional ports for communications and placed under <code>
  /usr/lib64/erlang/bin/sys.config</code> the following config:  </p>
  
  <pre><code>{kernel,[{inet_dist_listen_min, XX00},{inet_dist_listen_max,XX05}]}]
  </code></pre>
  
  <p>Then another restart (dumb I know) to verify erlang takes these into consideration but still when I run:  </p>
  
  <pre><code>rabbitmqctl cluster rabbit@HostName1
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>Clustering node rabbit@HostName2 with [rabbit@HostName1] ...
  Error: {no_running_cluster_nodes,[rabbit@HostName1],
                                   [rabbit@HostName1]}
  </code></pre>
  
  <p>There is a chance my fiddling with the erlang.cookie or with the ports did not succeed but I don't know how to check them. I tried typing <code>erl</code> in the cmd and then <code>erl_epmd:names()</code> or other commands to get more information but I'm probably way off in erlang land.  </p>
  
  <p>Would truly appreciate any help  </p>
  
  <p><strong>Update:</strong><br>
  I tried pinging two erlang nodes manually and got <code>pang</code> back.<br>
  I did the following:<br>
    Connected to two nodes, stopped rabbitmq (wasn't sure if needed but to be sure), started erlang like so (<code>erl -sname dilbert</code> and <code>erl -sname dilbert2</code>) when the erlang command line started i ran <code>node().</code> on each of them and got <code>dilbert@HostName1</code> and <code>dilbert2@HostName2</code> respectively. I then tried to run <code>net_adm:ping('dilbert').</code> and <code>net_adm:ping('dilbert@HostName1').</code> with the single quote and without them from both nodes (changed names of course) and got on all 8 cases <code>pang</code>.<br>
  When I ran <code>nodes().</code> on one of the machines I got back an empty array.<br>
  I've also tried to allow all traffic in the firewall (<a href="http://pastebin.com/KLre0vXp" rel="nofollow">script</a>) and then try to run the above   commands (don't worry they're back on now) and still got back <code>pang</code>.<br>
  <strong>Update2:</strong><br>
  For some reason I had cookies mismatch which I needed to resolve (thanks @kjw0188 for the suggestion [I ran <code>erlang:get_cookie().</code> in the erlang command line]).<br>
  This did not help and I needed to stop iptables completely (not sure why but I'll figure it soon) and load the erlang node with <code>-name dilbert@my-ip</code> because my rackspace servers have no dns-name. This finally enabled me to get a pong and see the nodes see each other (<code>nodes().</code> returns a non-empty array after the ping).<br>
  The problem I'm facing now is how to instruct RabbitMQ to use -name instead of -sname when starting erlang.</p>