You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hadoop.apache.org by cho ju il <tj...@kgrid.co.kr> on 2014/11/24 07:14:42 UTC
How to use a number of file system?
I operates a three Hadoop cluster.
Hadoop cluster is not configured Federation.
Each is different Hadoop clusters.
Service applications are accessible to each of the Hadoop cluster.
I use something like this?
Configuration conf1 = new Configuration();
conf1.addResource( new Path("core-site-zone1.xml") );
conf1.addResource( new Path("hdfs-site-zone1.xml") );
FileSystem dfsZone1 = FileSystem.get(conf1);
Configuration conf2 = new Configuration();
conf2.addResource( new Path("core-site-zone2.xml") );
conf2.addResource( new Path("hdfs-site-zone2.xml") );
FileSystem dfsZone2 = FileSystem.get(conf2);
Configuration conf3 = new Configuration();
conf3.addResource( new Path("core-site-zone3.xml") );
conf3.addResource( new Path("hdfs-site-zone3.xml") );
FileSystem dfsZone3 = FileSystem.get(conf3);
## sample
## core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>viewfs:///</value>
</property>
<property>
<name>fs.viewfs.impl</name>
<value>org.apache.hadoop.fs.viewfs.ViewFileSystem</value>
</property>
<property>
<name>fs.viewfs.mounttable.default.link./hdfs1</name>
<value>hdfs://ns01/hdfs1</value>
</property>
</configuration>
## hdfs-site.xml
<configuration> <!-- namespace --> <property> <name>dfs.nameservices</name> <value>ns01</value> </property> <property> <name>dfs.ha.namenodes.ns01</name> <value>nn01,nn02</value> </property>
<!-- zone1 --> <property> <name>dfs.namenode.rpc-address.ns01.nn01</name> <value>namenode01:40000</value> </property> <property> <name>dfs.namenode.http-address.ns01.nn01</name> <value>namenode01:40070</value> </property> <property> <name>dfs.namenode.rpc-address.ns01.nn02</name> <value>namenode02:40000</value> </property> <property> <name>dfs.namenode.http-address.ns01.nn02</name> <value>namenode02:40070</value> </property> <property> <name>dfs.client.failover.proxy.provider.ns01</name> <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value> </property>
<property> <name>dfs.blocksize</name> <value>134217728</value> </property> <property> <name>dfs.replication</name> <value>2</value> </property>
</configuration>