I figured it out by creating the directories at the beginning:

hdfs dfs -mkdir hdfs://Master:9000/my

hdfs dfs -mkdir hdfs://Slave1:9000/your

Thanks.

On Mon, Jun 6, 2016 at 4:44 PM, Ravi Prakash <ravihad...@gmail.com> wrote:

> Perhaps use the "viewfs://" protocol prepended to your path?
>
>
> On Sun, Jun 5, 2016 at 1:10 PM, Kun Ren <ren.h...@gmail.com> wrote:
>
>> Hi Genius,
>>
>> I just configured HDFS Federation, and try to use it(2 namenodes, one is
>> for /my, another is for /your). When I  run the command:
>> hdfs dfs -ls /,
>>
>> I can get:
>> -r-xr-xr-x   - hadoop hadoop          0 2016-06-05 20:05 /my
>> -r-xr-xr-x   - hadoop hadoop          0 2016-06-05 20:05 /your
>>
>> This makes sense. However, when I run the command to create a new
>> directory:
>> hdfs dfs -mkdir /my/test
>>
>> I got error:
>> mkdir: `/my/test': No such file or directory.
>>
>> Even when I run "hdfs dfs -ls /my", still get the no such file or
>> directory error.
>>
>> Does someone tell me how to use the command line to do the file
>> operations with HDFS Federation? Thanks a lot for your help.
>>
>> I attached My core-site.xml and hdfs-site.xml:
>>
>> Core-site.xml:
>>
>> <configuration>
>>
>>        <property>
>>
>>                <name>fs.defaultFS</name>
>>
>>                <value>viewfs:///</value>
>>
>>        </property>
>>
>>        <property>
>>
>>                <name>fs.viewfs.mounttable.default.link./my</name>
>>
>>                <value>hdfs://Master:9000/my</value>
>>
>>        </property>
>>
>>        <property>
>>
>>                <name>fs.viewfs.mounttable.default.link./your</name>
>>
>>                <value>hdfs://Slave1:9000/your</value>
>>
>>        </property>
>>
>>        <property>
>>
>>                <name>hadoop.tmp.dir</name>
>>
>>                <value>file:/home/hadoop/hadoop_build/tmp</value>
>>
>>        </property>
>> </configuration>
>>
>>
>>
>> Hdfs-site.xml:
>>
>> <configuration>
>>
>>     <property>
>>
>>        <name>dfs.replication</name>
>>
>>        <value>1</value>
>>
>>     </property>
>>
>>     <property>
>>
>>        <name>dfs.namenode.name.dir</name>
>>
>>        <value>file:/home/hadoop/hadoop_build/tmp/dfs/name</value>
>>
>>     </property>
>>
>>     <property>
>>
>>        <name>dfs.datanode.data.dir</name>
>>
>>        <value>file:/home/hadoop/hadoop_build/tmp/dfs/data</value>
>>
>>     </property>
>>
>>        <property>
>>
>>                <name>dfs.federation.nameservices</name>
>>
>>                <value>mycluster,yourcluster</value>
>>
>>        </property>
>>
>>        <property>
>>
>>                <name>dfs.namenode.rpc-address.mycluster</name>
>>
>>                <value>Master:9000</value>
>>
>>        </property>
>>
>>        <property>
>>
>>                <name>dfs.namenode.rpc-address.yourcluster</name>
>>
>>                <value>Slave1:9000</value>
>>
>>        </property>
>>
>>        <property>
>>
>>                <name>dfs.namenode.http-address.mycluster</name>
>>
>>                <value>Master:50070</value>
>>
>>        </property>
>>
>>        <property>
>>
>>                <name>dfs.namenode.http-address.yourcluster</name>
>>
>>                <value>Slave1:50070</value>
>>
>>        </property>
>>
>> </configuration>
>>
>
>

Reply via email to