假如有三台服务器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>