2014-11-24 3 views
4

우선, HortonWorks Sandbox를 Hadoop dist로 사용하고 있습니다. 사용자 정의 구성이 전혀 없습니다.hdfs에서 디렉토리를 나열하는 데 사용할 호스트와 포트

은 일단 샌드 박스에 연결, 나는 일을 HDFS 디렉토리의 파일을 나열 할 수 있어요 :

[[email protected] ~]# hadoop fs -ls hdfs:///user/guest

을하지만 호스트와 포트를 지정하려고하면 나는 오류 만 얻을 :

[[email protected] ~]# hadoop fs -ls hdfs://localhost:8020/user/guest ls: Call From sandbox.hortonworks.com/10.0.2.15 to localhost:8020 failed on connection exception: java.net.ConnectException: Connexion refusée; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused

[[email protected] ~]# hadoop fs -ls hdfs://localhost:9000/user/guest ls: Call From sandbox.hortonworks.com/10.0.2.15 to localhost:9000 failed on connection exception: java.net.ConnectException: Connexion refusée; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused

나는 올바른 호스트 및 포트를 알게되면 사용, 내 자바 전화에서 사용할 수 있습니다 :

Path pt = new Path("hdfs://host:port/user/guest/test-text-file.txt");

답변

8

core-site.xml이 재산 fs.defaultFS의 값을 확인 네임 노드 데몬이 때 바인딩해야되는 IP 주소/호스트 이름 및 포트를 포함 시작됩니다.

hadoop fs -ls hdfs://sandbox.hortonworks.com:8020/user/guest 

아니면 수 :

난 당신이 호튼 웍스 샌드 박스를 사용하는 것은, 여기에 속성이 core-site.xml에하고 그래서, 당신이 뭔가를 시도 할 수 /etc/hadoop/conf/core-site.xml

<property> 
    <name>fs.defaultFS</name> 
    <value>hdfs://sandbox.hortonworks.com:8020</value> 
</property> 

에있는 것을 볼 수 또한 내 주소록에 /etc/hosts의 해당 항목에서 sandbox.hortonworks.com의 IP 주소를 다음과 같이 바꿉니다.

127.0.0.1  localhost.localdomain localhost 
192.168.1.3 sandbox.hortonworks.com sandbox 

그래서, 나뿐만 아니라이 시도 할 수 :이 완전한 답변

hadoop fs -ls hdfs://192.168.1.3:8020/user/guest 
+0

감사합니다. 튜토리얼에서 포트 9000 또는 "localhost : 8020"에 대한 이야기가 나쁘다 (http://hortonworks.com/hadoop-tutorial/using-commandline-manage-files-hdfs/). – Tristan

관련 문제