<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Ah ok great. I'm on CentOS 6, and I found that setting up the
    hostname so that Erlang was *happy* with it took a bit of fiddling
    around.<br>
    <br>
    My configuration looks like this:<br>
    <br>
    t4@iske $ cat /etc/hosts<br>
    127.0.0.1    localhost.localdomain localhost<br>
    127.0.0.1    iske<br>
    ::1    localhost<br>
    <br>
    t4@iske $ cat /etc/sysconfig/network<br>
    NETWORKING=yes<br>
    NETWORKING_IPV6=no<br>
    HOSTNAME=iske<br>
    <br>
    You can check this with system-config-network
    as well. Are you seeing something similar?<br>
    <br>
    Tim<br>
    <br>
    On 07/09/2012 10:13 AM, 何斌 wrote:
    <blockquote cite="mid:SNT115-W144BA91DB06F5BFE83E0ADA6D30@phx.gbl"
      type="cite">
      <style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:微软雅黑
}
--></style>
      <div dir="ltr">
        Hi,<br>
        <br>
        My environment info:<br>
        OS: CentOS 5.6<br>
        Erlang: Compiled from otp_src_R15B01.tar.gz<br>
        RabbitMQ: Compiled from rabbitmq-server-2.8.4.tar.gz<br>
        <br>
        ifconfig:<br>
        eth0      Link encap:Ethernet  HWaddr 84:2B:2B:73:88:28  <br>
                  inet addr:183.*.*.*  Bcast:183.60.44.127 
        Mask:255.255.255.192<br>
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br>
                  RX packets:77904379 errors:0 dropped:0 overruns:0
        frame:0<br>
                  TX packets:65643095 errors:0 dropped:0 overruns:0
        carrier:0<br>
                  collisions:0 txqueuelen:1000 <br>
                  RX bytes:11615134852 (10.8 GiB)  TX bytes:61820973373
        (57.5 GiB)<br>
           &amp;nb sp;      Interrupt:66 Memory:da000000-da012800 <br>
        <br>
        eth0:0    Link encap:Ethernet  HWaddr 84:2B:2B:73:88:28  <br>
                  inet addr:112.*.*.*  Bcast:112.90.57.191 
        Mask:255.255.255.192<br>
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br>
                  Interrupt:66 Memory:da000000-da012800 <br>
        <br>
        eth1      Link encap:Ethernet  HWaddr 84:2B:2B:73:88:29  <br>
                  inet addr:10.20.30.1  Bcast:10.20.30.255 
        Mask:255.255.255.0<br>
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br>
                  RX packets:94328707 errors:0 dropped:0 overruns:0
        frame:0<br>
                   TX packets:78961028 errors:0 dropped:0 overruns:0
        carrier:0<br>
                  collisions:0 txqueuelen:1000 <br>
                  RX bytes:77337167993 (72.0 GiB)  TX bytes:15705231055
        (14.6 GiB)<br>
                  Interrupt:74 Memory:dc000000-dc012800 <br>
        <br>
        eth1:1    Link encap:Ethernet  HWaddr 84:2B:2B:73:88:29  <br>
                  inet addr:10.20.30.251  Bcast:10.20.30.255 
        Mask:255.255.255.0<br>
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br>
                  Interrupt:74 Memory:dc000000-dc012800 <br>
        <br>
        lo        Link encap:Local Loopback  <br>
                   inet addr:127.0.0.1  Mask:255.0.0.0<br>
                  UP LOOPBACK RUNNING  MTU:16436  Metric:1<br>
                  RX packets:2530738 errors:0 dropped:0 overruns:0
        frame:0<br>
                  TX packets:2530738 errors:0 dropped:0 overruns:0
        carrier:0<br>
                  collisions:0 txqueuelen:0 <br>
                  RX bytes:155346660 (148.1 MiB)  TX bytes:155346660
        (148.1 MiB)<br>
        <br>
        <br>
        Thank you again.<br>
        <br>
        <br>
        He Bin<br>
        <br>
        <br>
        <div>
          <hr id="stopSpelling">From: <a class="moz-txt-link-abbreviated" href="mailto:watson.timothy@gmail.com">watson.timothy@gmail.com</a><br>
          Date: Mon, 9 Jul 2012 10:00:33 +0100<br>
          CC: <a class="moz-txt-link-abbreviated" href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
          To: <a class="moz-txt-link-abbreviated" href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
          Subject: Re: [rabbitmq-discuss] Plz give me help about EPMD:
          Non-local peer connected<br>
          <br>
          <div>What OS and rabbit version are you running? I've not seen
            this happen before but I'll investigate.<br>
            <br>
          </div>
          <div>On 9 Jul 2012, at 07:32, 何斌 &lt;<a moz-do-not-send="true"
              href="mailto:hebin7611@hotmail.com">hebin7611@hotmail.com</a>&gt;
            wrote:<br>
            <br>
          </div>
          <blockquote>
            <div>
              <style><!--
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:\005fae\008f6f\0096c5\009ed1;}

--></style>
              <div dir="ltr">
                <br>
                Hi Tim,<br>
                <br>
                Thanks for your reply.<br>
                <br>
                I tried "erl -sname rabbit", it's OK.<br>
                <br>
                my /etc/hosts looks like following:<br>
                127.0.0.1    game-01 ZSWY76 localhost.localdomain
                localhost<br>
                ::1        localhost6.localdomain6 localhost6<br>
                <br>
                EPMD can be started successfully, but always reports
                "Non-local peer connected" then force disconnecting
                rabbit-server.<br>
                <br>
                Did I forget any necessory configration for RabbitMQ to
                use loopback interface to connect epmd?<br>
                <br>
                Thanks a lot.<br>
                <br>
                He Bin<br>
                <br>
                <br>
                <div>&gt; Date: Fri, 6 Jul 2012 18:34:07 +0100<br>
                  &gt; From: <a moz-do-not-send="true"
                    href="mailto:tim@rabbitmq.com">tim@rabbitmq.com</a><br>
                  &gt; To: <a moz-do-not-send="true"
                    href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
                  &gt; CC: <a moz-do-not-send="true"
                    href="mailto:hebin7611@hotmail.com">hebin7611@hotmail.com</a><br>
                  &gt; Subject: Re: [rabbitmq-discuss] Plz give me help
                  about EPMD: Non-local peer conne cted<br>
                  &gt; <br>
                  &gt; Hi there,<br>
                  &gt; <br>
                  &gt; On 06/07/2012 06:53, 何斌 wrote:<br>
                  &gt; &gt; Hi all,<br>
                  &gt; &gt;<br>
                  &gt; &gt; I installed RabbotMQ &amp; tried to start
                  it.<br>
                  &gt; &gt;<br>
                  &gt; &gt; But I always got error as following:<br>
                  &gt; &gt;<br>
                  &gt; <br>
                  &gt; Ok so first of all, let's see if we can get you
                  to start a stand alone <br>
                  &gt; distributed Erlang node successfully. Normally
                  stack traces like that <br>
                  &gt; occur when the host environment isn't set up
                  quite right (from Erlang's <br>
                  &gt; perspective).<br>
                  &gt; <br>
                  &gt; We need to be able to run `erl -sname rabbit` on
                  the command line and <br>
                  &gt; see the Erlang emulator start successfully. It
                  should look something <br>
                  &gt; like this:<br>
                  &gt; <br>
                  &gt; ##############<br>
                  &gt; <br>
                  &gt; t4@malachi:systest $ erl -sname rabbit<br>
                  &gt; Erlang R15B01 (erts-5.9.1) [source] [64-bit]
                  [smp:2:2] [async-threads:0] <br>
                  &gt; [hipe] [kernel-poll:false]<br>
                  &gt; <br>
                  &gt; Eshell V5.9.1 (abort with ^G)<br>
                  &gt; (rabbit@malachi)1&gt;<br>
                  &gt; <br>
                  &gt; ##############<br>
                  &gt; <br>
                  &gt; Can you start Erlang like that successfully? I'm
                  assuming not, but <br>
                  &gt; please let us k now.<br>
                  &gt; <br>
                  &gt; I'm also interested in understanding what your
                  hosts configuration <br>
                  &gt; (e.g., /etc/hosts) looks like. On some Operating
                  Systems (such as CentOS <br>
                  &gt; for example), failing to set an explicit host
                  name prevents you from <br>
                  &gt; starting a distributed Erlang node.<br>
                  &gt; <br>
                  &gt; &gt;
                  {error_logger,{{2012,7,6},{13,32,21}},"Protocol: ~p:
                  register error:<br>
                  &gt; &gt;
~p~n",["inet_tcp",{{badmatch,{error,epmd_close}},[{inet_tcp_dist,listen,1,[{file,"inet_tcp_dist.erl"},{line,70}]},{net_kernel,start_protos,4,[{file,"net_kernel.erl"},{line,1314}]},{net_kernel,start_protos,3,[{file,"net_kernel.erl"},{line,1307}]},{net_kernel,init_node,2,[{file,"net_kernel.erl"},{line,1197}]},{net_kernel,init,1,[{file,"net_kernel.erl"},{line,357}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}]}<br>
                  &gt; &gt;
                  {error_logger,{{2012,7,6},{13,32,21}},crash_report,[[{initial_call,{net_kernel,init,

['Argument__1']}},{pid,&lt;0.20.0&gt;},{registered_name,[]},{error_info,{exit,{error,badarg},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,320}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}},{ancest<br>
                  &gt; &gt;
ors,[net_sup,kernel_sup,&lt;0.9.0&gt;]},{messages,[]},{links,[#Port&lt;0.90&gt;,&lt;0.17.0&gt;]},{dictionary,[{longnames,false}]},{trap_exit,true},{status,running},{heap_size,987},{stack_size,24},{reductions,551}],[]]}<br>
                  &gt; &gt;
{error_logger,{{2012,7,6},{13,32,21}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfargs,{net_kernel,start_link,[[rabbitmqprelaunch1077,shortnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]}<br>
                  &gt; &gt;
                  {error_logger,{{2012,7,6},{13,32,21}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined},{name,net_sup},

{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}<br>
                  &gt; &gt;
{error_logger,{{2012,7,6},{13,32,21}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]}<br>
                  &gt; &gt; {"Kern el pid<br>
                  &gt; &gt;
terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"}<br>
                  &gt; &gt;<br>
                  &gt; &gt; Crash dump was written to: erl_crash.dump<br>
                  &gt; &gt; Kernel pid terminated
                  (application_controller)<br>
                  &gt; &gt;
({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}})<br>
                  &gt; &gt;<br>
                  &gt; &gt;<br>
                  &gt; &gt; I ran it on a server with public IP
                  183.*.*.* .<br>
                  &gt; &gt;<br>
                  &gt; &gt; In Erlang src, I found that epmd checks
                  connection src.<br>
                  &gt; &gt;<br>
                  &gt; &gt; /* Determine if connection is from localhost
                  */<br>
                  &gt; &gt; if (getpeername(s-&gt;fd,(struct sockaddr*)
                  &amp;si,&amp;st) ||<br>
                  &gt; &gt; s t &lt; sizeof(si)) {<br>
                  &gt; &gt; /* Failure to get peername is regarded as
                  non local host */<br>
                  &gt; &gt; s-&gt;local_peer = EPMD_FALSE;<br>
                  &gt; &gt; } else {<br>
                  &gt; &gt; /* Only 127.x.x.x and connections from the
                  host's IP address<br>
                  &gt; &gt; allowed, no false positives */<br>
                  &gt; &gt; s-&gt;local_peer =<br>
                  &gt; &gt; (((((unsigned) ntohl(si.sin_addr.s_addr))
                  &amp; 0xFF000000U) ==<br>
                  &gt; &gt; 0x7F000000U) ||<br>
                  &gt; &gt; (getsockname(s-&gt;fd,(struct sockaddr*)
                  &amp;di,&amp;st) ?<br>
                  &gt; &gt; EPMD_FALSE : si.sin_addr.s_addr == di.s
                  in_addr.s_addr));<br>
                  &gt; &gt; }<br>
                  &gt; &gt; dbg_tty_printf(g,2,(s-&gt;local_peer) ?
                  "Local peer connected" :<br>
                  &gt; &gt; "Non-local peer connected");<br>
                  &gt; &gt;<br>
                  &gt; &gt;<br>
                  &gt; &gt; But unfortunately, si.sin_addr.s_addr was
                  183.*.*.*, while<br>
                  &gt; &gt; di.sin_addr.s_addr was 127.0.0.1<br>
                  &gt; &gt;<br>
                  &amp; amp; gt; &gt; My log:Checking peer address,
                  getsockname ret: 0, si_addr=0xb7??????,<br>
                  &gt; &gt; di_addr=0x7f000001<br>
                  &gt; &gt;<br>
                  &gt; &gt;<br>
                  &gt; <br>
                  &gt; I could be wrong, but I suspect this is a red
                  herring. You can restart <br>
                  &gt; epmd with -d to get debugging information as
                  well, but I suspect this <br>
                  &gt; isn't relevant.<br>
                  &gt; <br>
                  &gt; Is there any way to force RabbitMQ server connect
                  epmd via a specified<br>
                  &gt; &gt; address?<br>
                  &gt; &gt;<br>
                  &gt; <br>
                  &gt; I'm not really sure what you mean by this, but
                  I'm fairly confident that <br>
                  &gt; it is not necessary to even attempt to do
                  something like that. Erlang <br>
                  &gt; should be able to start up nodes with `-sname
                  &lt;name&gt;` or `-name <br>
                  &gt; &lt;name&gt;@&lt;host&gt;` and if either doesn't
                  work, a little tweaking of the host <br>
                  &gt; configuration should solve it.<br>
                  &gt; <br>
                  &gt; Based on your original comment (starting rabbitmq
                  but always getting an <br>
                  &gt; error) my understanding is that you're trying to
                  start rabbit on this <br>
                  &gt; machine and it fails. AFAIK when a distributed
                  Erlang node connects to <br>
                  &gt; EPMD on the localhost it should be treated as
                  such. The rabbitmq-server <br>
                  &gt; script starts rabbit up with `-sname rabbit`
                  which implies that the node <br>
                  &gt; name will be rabbit@&lt;hostname&gt; so you
                  should make sure that `erl -sname <br>
                  &gt; rabbit` works first of all.<br>
                </div>
              </div>
            </div>
          </blockquote>
          <blockquote>
            <div><span>_______________________________________________</span><br>
              <span>rabbitmq-discuss mailing list</span><br>
              <span><a moz-do-not-send="true"
                  href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a></span><br>
              <span><a moz-do-not-send="true"
href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss"
                  target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a></span><br>
            </div>
          </blockquote>
          <br>
          _______________________________________________
          rabbitmq-discuss mailing list
          <a class="moz-txt-link-abbreviated" href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a>
<a class="moz-txt-link-freetext" href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a></div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
rabbitmq-discuss mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a>
<a class="moz-txt-link-freetext" href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>