论坛首页 Java企业应用论坛

[HDFS] 主控节点的双IP解决方案

浏览 1824 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-05-26   最后修改:2010-02-06
需求:Master服务器有两个网卡,一个内网地址,一个外网地址。现在监听9000端口,那么其他节点可通过内网或是外网地址都可以连接到这台NameNode.

在程序中,监听0.0.0.0地址,可以使程序监听某端口上的任意IP,不过事实没有那么简单,经过反复折腾,发现windows是可以这样监听,但是Linux不行,大伙可以试试。

在linux中,在启动Namenode时,可以通过日志看到监听服务起来之后,又退出了。日志如下:
2009-05-26 12:29:50,771 INFO org.apache.hadoop.ipc.Server: IPC Server handler 0 on 54310: starting
2009-05-26 12:29:50,772 INFO org.apache.hadoop.ipc.Server: IPC Server handler 1 on 54310: starting
2009-05-26 12:29:50,772 INFO org.apache.hadoop.ipc.Server: IPC Server handler 2 on 54310: starting
2009-05-26 12:29:50,772 INFO org.apache.hadoop.ipc.Server: IPC Server handler 3 on 54310: starting
2009-05-26 12:29:50,772 INFO org.apache.hadoop.ipc.Server: IPC Server handler 4 on 54310: starting
2009-05-26 12:29:50,773 INFO org.apache.hadoop.ipc.Server: IPC Server handler 5 on 54310: starting
2009-05-26 12:29:50,773 INFO org.apache.hadoop.ipc.Server: IPC Server handler 6 on 54310: starting
2009-05-26 12:29:50,773 INFO org.apache.hadoop.ipc.Server: IPC Server handler 7 on 54310: starting
2009-05-26 12:29:50,773 INFO org.apache.hadoop.ipc.Server: IPC Server handler 8 on 54310: starting
2009-05-26 12:29:50,777 INFO org.apache.hadoop.ipc.Server: IPC Server handler 9 on 54310: starting
2009-05-26 12:29:50,797 INFO org.mortbay.util.ThreadedServer: Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=5
0070]
2009-05-26 12:29:50,801 INFO org.mortbay.http.SocketListener: Stopped SocketListener on 0.0.0.0:50070
2009-05-26 12:29:50,802 INFO org.mortbay.util.Container: Stopped org.mortbay.jetty.servlet.WebApplicationHandler@57ea52
2009-05-26 12:29:50,887 INFO org.mortbay.util.Container: Stopped WebApplicationContext[/static,/static]
2009-05-26 12:29:50,887 INFO org.mortbay.util.Container: Stopped org.mortbay.jetty.servlet.WebApplicationHandler@39c8c1
2009-05-26 12:29:50,947 INFO org.mortbay.util.Container: Stopped WebApplicationContext[/logs,/logs]
2009-05-26 12:29:50,947 INFO org.mortbay.util.Container: Stopped org.mortbay.jetty.servlet.WebApplicationHandler@126a29c
2009-05-26 12:29:51,014 INFO org.mortbay.util.Container: Stopped WebApplicationContext[/,/]
2009-05-26 12:29:51,014 INFO org.mortbay.util.Container: Stopped org.mortbay.jetty.Server@109de5b
2009-05-26 12:29:51,051 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: Number of transactions: 0 Total time for transacti
ons(ms): 0 Number of syncs: 0 SyncTimes(ms): 0
2009-05-26 12:29:51,052 WARN org.apache.hadoop.hdfs.server.namenode.FSNamesystem: ReplicationMonitor thread received InterruptedExce
ption.java.lang.InterruptedException: sleep interrupted
2009-05-26 12:29:51,056 INFO org.apache.hadoop.ipc.Server: Stopping server on 54310
2009-05-26 12:29:51,057 INFO org.apache.hadoop.ipc.Server: IPC Server handler 0 on 54310: exiting
2009-05-26 12:29:51,057 INFO org.apache.hadoop.ipc.Server: IPC Server handler 1 on 54310: exiting
2009-05-26 12:29:51,057 INFO org.apache.hadoop.ipc.Server: IPC Server handler 2 on 54310: exiting
2009-05-26 12:29:51,057 INFO org.apache.hadoop.ipc.Server: IPC Server handler 3 on 54310: exiting
2009-05-26 12:29:51,057 INFO org.apache.hadoop.ipc.Server: IPC Server handler 4 on 54310: exiting
2009-05-26 12:29:51,057 INFO org.apache.hadoop.ipc.Server: IPC Server handler 5 on 54310: exiting
2009-05-26 12:29:51,058 INFO org.apache.hadoop.ipc.Server: IPC Server handler 7 on 54310: exiting
2009-05-26 12:29:51,058 INFO org.apache.hadoop.ipc.Server: Stopping IPC Server listener on 54310
2009-05-26 12:29:51,058 INFO org.apache.hadoop.ipc.Server: IPC Server handler 6 on 54310: exiting
2009-05-26 12:29:51,058 INFO org.apache.hadoop.ipc.Server: IPC Server handler 8 on 54310: exiting
2009-05-26 12:29:51,058 INFO org.apache.hadoop.ipc.Server: IPC Server handler 9 on 54310: exiting

  那么这个情况,在windows中,是不会出现的,Linux上解决的办法是关闭IPV6.
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics