HDFS支持多宿主网络并且是在Cloudera HDFS支持多宿主网络上完成的。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-host
、
dfs.namenode.servicerpc-bind-host
、
dfs.namenode.http-bind-host
和
dfs.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. service cloudera-scm-agent stop
2. service cloudera-scm-server stop
如果您的集群配置了主要和次要NameNodes,则此修改需要在两个节点上进行。修改是在“服务器和代理停止”的情况下完成的。
在完成并保存hdfs-site.xml文件后,使用以下命令启动NameNodes上的服务器和代理以及DataNodes上的代理(如果也这样做,不会对集群造成伤害):
1. service cloudera-scm-agent start
2. service cloudera-scm-server start
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: 如何配置Hadoop客户端端口8020以绑定到所有网络接口?
在HDFS配置中,Cloudera有一个名为Bind NameNode to Wildcard Address
的属性,只需勾选该框即可将服务绑定在0.0.0.0上。
然后重新启动hdfs服务
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.
开始,停止,刷新和重启集群启动,停止和重新启动服务