【问题标题】:Hadoop: binding multiple IP addresses to a cluster NameNodeHadoop:将多个 IP 地址绑定到集群 NameNode
【发布时间】:2019-05-26 01:14:18
【问题描述】:

我在 Softlayer 上有一个四节点 Hadoop 集群。主节点(NameNode)有一个公共 IP 地址用于外部访问和一个私有 IP 地址用于集群访问。从节点(数据节点)具有私有 IP 地址,我试图将其连接到主节点,而无需为每个从节点分配公共 IP 地址。

我意识到将fs.defaultFS 设置为NameNode 的公共地址允许外部访问,除了NameNode 只侦听该地址的传入连接,而不是私有地址。因此,当他们尝试连接 NameNode 的私有 IP 地址时,我在数据节点日志中收到 ConnectionRefused 异常。

我认为解决方案可能是为 NameNode 设置公共和私有 IP 地址,以便保留外部访问权限并允许我的从属节点也连接。

那么有没有一种方法可以将这两个地址都绑定到 NameNode 上,以便它同时监听这两个地址?

编辑:Hadoop 版本 2.4.1。

【问题讨论】:

  • 你可以发布你自己的编辑作为答案 - 然后我可以投票
  • @ikradex 嗨,谢谢您的解决方案,但我仍然遇到问题的一件事是节点管理器仍然无法连接到资源管理器,即使我将值设置为“yarn.nodemanager.bind-host”到 0.0.0.0。对此有什么建议吗??
  • @StarLord 请避免使用 cmets 提问(跟进)问题。如果您有问题,您可以提出一个新问题。当然,您可能想参考这个答案,但请确保问题本身是正确编写的。

标签: java hadoop network-programming cluster-computing distributed-computing


【解决方案1】:

提问者将此编辑到他的问题中作为答案:

在 hdfs-site.xml 中,将dfs.namenode.rpc-bind-host 的值设置为 0.0.0.0 和 Hadoop 将同时监听私有和公共 允许远程访问和数据节点访问的网络接口。

【讨论】:

    【解决方案2】:

    HDFS Support for Multihomed Networks 并在Cloudera HDFS Support for Multihomed Networks 上完成。 Parameters for Multi-Homing for Hortonworks

    <property>
      <name>dfs.namenode.rpc-bind-host</name>
      <value>0.0.0.0</value>
      <description>
        The actual address the RPC server will bind to. If this optional address is
        set, it overrides only the hostname portion of dfs.namenode.rpc-address.
        It can also be specified per name node or name service for HA/Federation.
        This is useful for making the name node listen on all interfaces by
        setting it to 0.0.0.0.
      </description>
    </property>
    

    另外,建议改dfs.namenode.rpc-bind-hostdfs.namenode.servicerpc-bind-hostdfs.namenode.http-bind-hostdfs.namenode.https-bind-host

    默认情况下,HDFS 端点被指定为主机名或 IP 地址。在任何一种情况下,HDFS 守护进程都将绑定到单个 IP 使守护程序无法从其他网络访问的地址。

    解决方案是对服务器端点进行单独设置以强制 绑定通配符 IP 地址 INADDR_ANY 即 0.0.0.0。不提供 具有任何这些设置的端口号。

    注意:在主/从中首选使用主机名而不是 IP 地址 配置文件。

    <property>
      <name>dfs.namenode.rpc-bind-host</name>
      <value>0.0.0.0</value>
      <description>
        The actual address the RPC server will bind to. If this optional address is
        set, it overrides only the hostname portion of dfs.namenode.rpc-address.
        It can also be specified per name node or name service for HA/Federation.
        This is useful for making the name node listen on all interfaces by
        setting it to 0.0.0.0.
      </description>
    </property>
    
    <property>
      <name>dfs.namenode.servicerpc-bind-host</name>
      <value>0.0.0.0</value>
      <description>
        The actual address the service RPC server will bind to. If this optional address is
        set, it overrides only the hostname portion of dfs.namenode.servicerpc-address.
        It can also be specified per name node or name service for HA/Federation.
        This is useful for making the name node listen on all interfaces by
        setting it to 0.0.0.0.
      </description>
    </property>
    
    <property>
      <name>dfs.namenode.http-bind-host</name>
      <value>0.0.0.0</value>
      <description>
        The actual adress the HTTP server will bind to. If this optional address
        is set, it overrides only the hostname portion of dfs.namenode.http-address.
        It can also be specified per name node or name service for HA/Federation.
        This is useful for making the name node HTTP server listen on all
        interfaces by setting it to 0.0.0.0.
      </description>
    </property>
    
    <property>
      <name>dfs.namenode.https-bind-host</name>
      <value>0.0.0.0</value>
      <description>
        The actual adress the HTTPS server will bind to. If this optional address
        is set, it overrides only the hostname portion of dfs.namenode.https-address.
        It can also be specified per name node or name service for HA/Federation.
        This is useful for making the name node HTTPS server listen on all
        interfaces by setting it to 0.0.0.0.
      </description>
    </property>
    

    注意:在开始修改之前,将代理和服务器停止为 关注:

    1. 服务 cloudera-scm-agent 停止
    2. 服务 cloudera-scm-server 停止

    如果您的集群配置了主 NameNode 和辅助 NameNode 比这种修改需要在两个节点中进行。修改 用server and agent stopped 完成

    完成并保存hdfs-site.xml 文件后,启动 NameNodes 上的服务器和代理以及代理 DataNodes(这不会 如果这样做也会伤害集群)使用以下方法:

    1. 服务 cloudera-scm-agent 启动
    2. 服务 cloudera-scm-server 启动

    可以为 IBM BigInsights 实施相同的解决方案:

        To configure HDFS to bind to all the interfaces , add the following configuration variable using Ambari under the section HDFS
    -> Configs ->Advanced -> Custom hdfs-site
    
    
        dfs.namenode.rpc-bind-host = 0.0.0.0
    
        Restart HDFS to apply the configuration change . 
    
        Verify if port 8020 is bound and listening to requests from all the interfaces using the following command. 
    
        netstat -anp|grep 8020
        tcp 0 0 0.0.0.0:8020 0.0.0.0:* LISTEN 15826/java
    

    IBM BigInsights: How to configure Hadoop client port 8020 to bind to all the network interfaces?

    在Cloudera的HDFS配置中有一个属性叫做

    ClouderaHDFS configuration中有一个名为Bind NameNode to Wildcard Address的属性,只需选中该框,它将在0.0.0.0上绑定服务

    then restart hdfs service

     On the Home > Status tab, click  to the right of the service
     name and select Restart. Click Start on the next screen to confirm.
     When you see a Finished status, the service has restarted.
    

    Starting, Stopping, Refreshing, and Restarting a Cluster Starting, Stopping, and Restarting Services

    【讨论】:

      猜你喜欢
      • 2014-07-25
      • 2016-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-08
      • 2012-04-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多