两个均是HDFS HA集群间的数据拷贝问题
背景描述:目前存在2个集群:配置分辨为: dfs.nameservices:myclouder1 , dfs.nameservices:myclouder2;
因为两个集群不在同一个机房中,现在需要两个集群间进行通信,即使用distcp 拷贝数据;
问题描述:
hadoop distcp hftp://myclouder1/tmp hdfs://myclouder2/tmp
此命令在myclouder1的namenode下执行,通过本地hadoop的配置defaultFS可以识别到myclouder1对应的ip主机,但是没有myclouder2的配置,要如何知道myclouder2对应的是哪些ip或主机呢?需进行哪些配置,望大神们指点迷经
备注:我已了解可以通过,指定机器的active状态的namenode节点,进行数据传输;但是是namenode的状态经常发生切换,比较不智能;
本帖最后由 sstutu 于 2018-2-11 21:42 编辑
在hosts里面,配置下myclouder2对应的ip地址。然后执行下命令试试。
那就需要修改配置了。
修改下hdfs-site.xml,例子如下
<configuration>
<!-- services -->
<property>
<name>dfs.nameservices</name>
<value>serviceId1,serviceId2</value>
</property>
<!-- serviceId2 properties -->
<property>
<name>dfs.client.failover.proxy.provider.nameservices2</name>
<value>org.apache.hadoop.hdfs.server
.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
<property>
<name>dfs.ha.namenodes.serviceId2</name>
<value>nn201,nn202</value>
</property>
<property>
<name>dfs.namenode.rpc-address.serviceId2.nn201</name>
<value>nn201.pro.net:8020</value>
</property>
<property>
<name>dfs.namenode.servicerpc-address.serviceId2.nn201</name>
<value>nn201.pro.net:54321</value>
</property>
<property>
<name>dfs.namenode.http-address.serviceId2.nn201</name>
<value>nn201.pro.net:50070</value>
</property>
<property>
<name>dfs.namenode.https-address.serviceId2.nn201</name>
<value>nn201.prod.com:50470</value>
</property>
<property>
<name>dfs.namenode.rpc-address.serviceId2.nn202</name>
<value>nn202.pro.net:8020</value>
</property>
<property>
<name>dfs.namenode.servicerpc-address.serviceId2.nn202</name>
<value>nn202.pro.net:54321</value>
</property>
<property>
<name>dfs.namenode.http-address.serviceId2.nn202</name>
<value>nn202.pro.net:50070</value>
</property>
<property>
<name>dfs.namenode.https-address.serviceId2.nn202</name>
<value>nn202.prod.net:50470</value>
</property>
<!—- serviceId1 -->
<property>
<name>dfs.client.failover.proxy.provider.nameservices1</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.
ConfiguredFailoverProxyProvider</value>
</property>
<property>
<name>dfs.ha.namenodes.nameservices1</name>
<value>nn101,nn102</value>
</property>
<property>
<name>dfs.namenode.rpc-address.serviceId1.nn101</name>
<value>nn101.poc.net:8020</value>
</property>
<property>
<name>dfs.namenode.servicerpc-address.serviceId1.nn101</name>
<value>nn101.poc.net:54321</value>
</property>
<property>
<name>dfs.namenode.http-address.serviceId1.nn101</name>
<value>nn101.poc.net:50070</value>
</property>
<property>
<name>dfs.namenode.https-address.serviceId1.nn101</name>
<value>nn101.poc.net:50470</value>
</property>
<property>
<name>dfs.namenode.rpc-address.serviceId1.nn102</name>
<value>nn102.poc.net:8020</value>
</property>
<property>
<name>dfs.namenode.servicerpc-address.serviceId1.nn102</name>
<value>nn102.poc.net:54321</value>
</property>
<property>
<name>dfs.namenode.http-address.serviceId1.nn102</name>
<value>nn102.poc.net:50070</value>
</property>
<property>
<name>dfs.namenode.https-address.serviceId1.nn102</name>
<value>nn102.poc.net:50470</value>
</property>
…
</configuration>
推薦參考:
https://stackoverflow.com/questions/26849308/distcp-between-nameservice1-and-nameservice2
https://henning.kropponline.de/2015/03/15/distcp-two-ha-cluster/
页:
[1]