不用这么麻烦吧。<div><br></div><div>用gproc将ABC都注册到同一个Key就可以了。<br><br><div class="gmail_quote">2013/1/9 Wang Wei <span dir="ltr"><<a href="mailto:wgwi@sxu.edu.cn" target="_blank">wgwi@sxu.edu.cn</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>1. 在A进程之上再弄个D进程,监控A的心跳.<br>
      2. A,D都跑同样的gl,之间共享数据(加个rabbitmq或者mneniz),又相互监控<br>
      <br>
                                                                 王炜<br>
      于 2013/1/9 12:08, 郎咸武 写道:<br>
    </div>
    <blockquote type="cite"><div><div class="h5">假如有三台服务器A,B,C做一个集群。
      <div>在其中A 服务器上运行下面代码。</div>
      <div>这是 三台服务器都能使用 gl进程发送消息。</div>
      <div><br>
      </div>
      <div><b>问题是: </b>A 服务器挂掉后,B和C 两台服务器都不能正常使用.</div>
      <div><br>
      </div>
      <div>请问有什么好的方法避免这个问题?</div>
      <div>
        <div><br>
        </div>
        <div>谢谢各位</div>
        <div>
          <br>
        </div>
        <div>郎咸武</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div>  1 -module(global_t).                                  
                                                                       
                                                                       
                                               </div>
          <div>  2 </div>
          <div>  3 -compile(export_all).</div>
          <div>  4 </div>
          <div>  5    </div>
          <div>  6 start() -></div>
          <div>  7     Pid = spawn(?MODULE, loop, []),</div>
          <div>  8     global:register_name(gl, Pid). </div>
          <div>  9 </div>
          <div> 10 </div>
          <div> 11 loop() -></div>
          <div> 12     io:format("loop~n", []),</div>
          <div> 13     receive </div>
          <div> 14         {Pid,Any} -></div>
          <div> 15             io:format("~p~n", [{Pid,Any}]),</div>
          <div> 16             Pid ! okss,</div>
          <div> 17             loop()</div>
          <div> 18     end.</div>
          <div> 19 </div>
          <div> 20 </div>
          <div> 21     </div>
          <div>~                                                        
                                                                       
                                                                       
                                              </div>
          <div>~                                                        
                                                                       
                                                                       
                                              </div>
          <div>~                   </div>
        </div>
        -- <br>
        只为成功找方法,不为失败找理由
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><div class="im"><pre>_______________________________________________
erlang-questions mailing list
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
    </div></blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>