httpfs安装指南
安装环境
Linux
maven3
jdk1.6
本地的maven源(有些依赖的jar包Cloudera已不再维护)
https://github.com/cloudera/httpfs
使用git下载
git clone https://github.com/cloudera/httpfs.git
在<dependencies>中增加依赖
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>${cdh.hadoop.version}</version>
</dependency>
mvn clean:install
其中有些依赖的jar包已不在Cloudera的源上了,需要自己设置maven源,在~/.m2/setting.xml中增加自己的源
mvn package -Pdist
生成的hadoop-hdfs-httpfs-0.20.2-cdh3u6.tar.gz包在target目录下
在其中加入以下内容
<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集群
useradd --create-home --shell /bin/bash httpfs
passwd 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目录下
在其中加入
<property>
<name>httpfs.proxyuser.httpfs.hosts</name>
<value>*</value>
</property>
<property>
<name>httpfs.proxyuser.httpfs.groups</name>
<value>*</value>
</property>
使用httpfs用户启动
/home/httpfs/hadoop-hdfs-httpfs-0.20.2-cdh3u6/sbin/httpfs.sh start
检查进程是否存在:jps看看有没有Bootstrap进程
查看logs目录下httpfs.log和其他log有无异常信息
上传文件
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
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
原文地址:http://blog.csdn.net/ganglia/article/details/25902873