httpfs安裝指南

httpfs安裝指南
安裝環境
Linux
maven3
jdk1.6
本地的maven源(有些依賴的jar包Cloudera已不再維護)

  • 1.下載httfs源碼包

https://github.com/cloudera/httpfs
使用git下載
git clone https://github.com/cloudera/httpfs.git

  • 2.修改pom.xml文件

在<dependencies>中增加依賴
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>${cdh.hadoop.version}</version>
</dependency>

  • 3.下載所需要的依賴,

mvn clean:install
其中有些依賴的jar包已不在Cloudera的源上了,需要自己設置maven源,在~/.m2/setting.xml中增加自己的源

  • 4.編譯打包

mvn package -Pdist
生成的hadoop-hdfs-httpfs-0.20.2-cdh3u6.tar.gz包在target目錄下

  • 5.修改hadoop集羣的所有機器的core-site.xml文件

在其中加入以下內容
<property>
<name>hadoop.proxyuser.httpfs.hosts</name>
<value>httpfs-host.foo.com</value>
</property>
<property>
<name>hadoop.proxyuser.httpfs.groups</name>
<value>*</value>
</property>
重啓hadoop集羣

  • 6.在要安裝httpfs的機器上創建httpfs用戶

useradd --create-home --shell /bin/bash httpfs 
passwd httpfs

  • 7.安裝httpfs

將hadoop-hdfs-httpfs-0.20.2-cdh3u6.tar.gz包複製到/home/httpfs目錄下解壓
進入到解壓出來的目錄hadoop-hdfs-httpfs-0.20.2-cdh3u6
將現網集羣的hadoop配置文件core-site.xml和hdfs-site.xml複製到/home/httpfs/hadoop-hdfs-httpfs-0.20.2-cdh3u6/etc/hadoop目錄下

  • 8.修改httpfs-site.xml

在其中加入
<property>
<name>httpfs.proxyuser.httpfs.hosts</name>
<value>*</value>
</property>
<property>
<name>httpfs.proxyuser.httpfs.groups</name>
<value>*</value>
</property>

  • 9.啓動httpfs

使用httpfs用戶啓動
/home/httpfs/hadoop-hdfs-httpfs-0.20.2-cdh3u6/sbin/httpfs.sh start

  • 10.檢查

檢查進程是否存在:jps看看有沒有Bootstrap進程
查看logs目錄下httpfs.log和其他log有無異常信息

  • 11.curl測試

上傳文件
curl -i -X PUT "http://172.16.61.154:14000/webhdfs/v1/tmp/testfile?user.name=bdws&op=create"
根據返回回來的URL再次put
curl -i -X PUT -T test.txt --header "Content-Type: application/octet-stream" "http://172.16.61.154:14000/webhdfs/v1/tmp/testfile?op=CREATE&user.name=bdws&data=true"
下載文件
curl -i "http://172.16.61.154:14000/webhdfs/v1/tmp/testfile?user.name=bdws&op=open" 
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: hadoop.auth="u=bdws&p=bdws&t=simple&e=1400181237161&s=F5K1C44TbM/tMjbdFUpM+zExtso="; Version=1; Path=/
Content-Type: application/octet-stream
Content-Length: 20
Date: Thu, 15 May 2014 09:13:57 GMT

this is a test file

  • 12.參考:

Hadoop HDFS over HTTP 0.20.2-cdh3u6 - Server Setup
http://cloudera.github.io/httpfs/ServerSetup.html
WebHDFS說明,很詳細包括命令的使用
http://zhangjie.me/webhdfs/
Apache hadoop webhdfs api文檔
http://hadoop.apache.org/docs/r1.0.4/webhdfs.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章