title: rabbitmq TCP connection succeeded but Erlang distribution failed
body: <p>I'm getting below error while joining the cluster</p>
  <pre><code>root@hostname02:~# rabbitmqctl join_cluster --longnames rabbit@hostname01
  Error: unable to perform an operation on node 'rabbit@hostname02'. Please see diagnostics information and suggestions below.
  
  Most common reasons for this are:
  
   * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
   * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
   * Target node is not running
  
  In addition to the diagnostics info below:
  
   * See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more
   * Consult server logs on node rabbit@hostname02
   * If target node is configured to use long node names, don't forget to use --longnames with CLI tools
  
  DIAGNOSTICS
  ===========
  
  attempted to contact: ['rabbit@hostname02']
  
  rabbit@hostname02:
    * connected to epmd (port 4369) on hostname02
    * epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
    * TCP connection succeeded but Erlang distribution failed
  
    * Node name (or hostname) mismatch: node &quot;rabbit@hostname02&quot; believes its node name is not &quot;rabbit@hostname02&quot; but something else.
      All nodes and CLI tools must refer to node &quot;rabbit@hostname02&quot; using the same name the node itself uses (see its logs to find out what it is)
  
  
  Current node details:
   * node name: 'rabbitmqcli-7548-rabbit@hostname02'
   * effective user's home directory: /var/lib/rabbitmq
   * Erlang cookie hash: Uaa+OhOna5fm+J0oPGPAiw==
  
  root@hostname02:~#
  </code></pre>
  <p><code>.erlang.cookie</code> on both the servers are same.</p>
  <p>I cannot see what I am missing here. Can someone help in resolving it.</p>