<html><head></head><body bgcolor="#FFFFFF"><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, 何斌 <<a href="mailto:hebin7611@hotmail.com">hebin7611@hotmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:微软雅黑
}
--></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><div id="SkyDrivePlaceholder"></div>> Date: Fri, 6 Jul 2012 18:34:07 +0100<br>> From: <a href="mailto:tim@rabbitmq.com">tim@rabbitmq.com</a><br>> To: <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>> CC: <a href="mailto:hebin7611@hotmail.com">hebin7611@hotmail.com</a><br>> Subject: Re: [rabbitmq-discuss] Plz give me help about EPMD: Non-local peer connected<br>> <br>> Hi there,<br>> <br>> On 06/07/2012 06:53, 何斌 wrote:<br>> > Hi all,<br>> ><br>> > I installed
RabbotMQ & tried to start it.<br>> ><br>> > But I always got error as following:<br>> ><br>> <br>> Ok so first of all, let's see if we can get you to start a stand alone <br>> distributed Erlang node successfully. Normally stack traces like that <br>> occur when the host environment isn't set up quite right (from Erlang's <br>> perspective).<br>> <br>> We need to be able to run `erl -sname rabbit` on the command line and <br>> see the Erlang emulator start successfully. It should look something <br>> like this:<br>> <br>> ##############<br>> <br>> t4@malachi:systest $ erl -sname rabbit<br>> Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] <br>> [hipe] [kernel-poll:false]<br>> <br>> Eshell V5.9.1 (abort with ^G)<br>> (rabbit@malachi)1><br>> <br>> ##############<br>> <br>> Can you start Erlang like that successfully? I'm assuming not, but <br>> please let us k
now.<br>> <br>> I'm also interested in understanding what your hosts configuration <br>> (e.g., /etc/hosts) looks like. On some Operating Systems (such as CentOS <br>> for example), failing to set an explicit host name prevents you from <br>> starting a distributed Erlang node.<br>> <br>> > {error_logger,{{2012,7,6},{13,32,21}},"Protocol: ~p: register error:<br>> > ~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>> > {error_logger,{{2012,7,6},{13,32,21}},crash_report,[[{initial_call,{net_kernel,init,
['Argument__1']}},{pid,<0.20.0>},{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>> > ors,[net_sup,kernel_sup,<0.9.0>]},{messages,[]},{links,[#Port<0.90>,<0.17.0>]},{dictionary,[{longnames,false}]},{trap_exit,true},{status,running},{heap_size,987},{stack_size,24},{reductions,551}],[]]}<br>> > {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>> > {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>> > {error_logger,{{2012,7,6},{13,32,21}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]}<br>> > {"Kern el pid<br>> > terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"}<br>> ><br>> > Crash dump was written to: erl_crash.dump<br>> > Kernel pid terminated (application_controller)<br>> > ({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}})<br>> ><br>> ><br>> > I ran it on a server with public IP 183.*.*.* .<br>> ><br>> > In Erlang src, I found that epmd checks connection src.<br>> ><br>> > /* Determine if connection is from localhost */<br>> > if (getpeername(s->fd,(struct sockaddr*) &si,&st) ||<br>> > s
t < sizeof(si)) {<br>> > /* Failure to get peername is regarded as non local host */<br>> > s->local_peer = EPMD_FALSE;<br>> > } else {<br>> > /* Only 127.x.x.x and connections from the host's IP address<br>> > allowed, no false positives */<br>> > s->local_peer =<br>> > (((((unsigned) ntohl(si.sin_addr.s_addr)) & 0xFF000000U) ==<br>> > 0x7F000000U) ||<br>> > (getsockname(s->fd,(struct sockaddr*) &di,&st) ?<br>> > EPMD_FALSE : si.sin_addr.s_addr == di.s in_addr.s_addr));<br>> > }<br>> > dbg_tty_printf(g,2,(s->local_peer) ? "Local peer connected" :<br>> > "Non-local peer connected");<br>> ><br>> ><br>> > But unfortunately, si.sin_addr.s_addr was 183.*.*.*, while<br>> > di.sin_addr.s_addr was 127.0.0.1<br>> ><br>&
gt; > My log:Checking peer address, getsockname ret: 0, si_addr=0xb7??????,<br>> > di_addr=0x7f000001<br>> ><br>> ><br>> <br>> I could be wrong, but I suspect this is a red herring. You can restart <br>> epmd with -d to get debugging information as well, but I suspect this <br>> isn't relevant.<br>> <br>> Is there any way to force RabbitMQ server connect epmd via a specified<br>> > address?<br>> ><br>> <br>> I'm not really sure what you mean by this, but I'm fairly confident that <br>> it is not necessary to even attempt to do something like that. Erlang <br>> should be able to start up nodes with `-sname <name>` or `-name <br>> <name>@<host>` and if either doesn't work, a little tweaking of the host <br>> configuration should solve it.<br>> <br>> Based on your original comment (starting rabbitmq but always getting an <br>> error) my understanding is that you're trying to start
rabbit on this <br>> machine and it fails. AFAIK when a distributed Erlang node connects to <br>> EPMD on the localhost it should be treated as such. The rabbitmq-server <br>> script starts rabbit up with `-sname rabbit` which implies that the node <br>> name will be rabbit@<hostname> so you should make sure that `erl -sname <br>> rabbit` works first of all.<br></div>                                            </div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>rabbitmq-discuss mailing list</span><br><span><a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a></span><br><span><a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a></span><br></div></blockquote></body></html>