4

我们有一个 COSMOS 帐户cosmos.lab.fi-ware.org,可以将文件本地加载到集群上。

但是,我们在远程加载时遇到了问题,我们在指南站点上遵循的说明显示如下:

但是,使用 WebHDFS/HttpFS RESTful API 将允许您上传存在于 FI-LAB 中 Cosmos 全局实例之外的文件。以下示例使用 HttpFS 而不是 WebHDFS(使用 TCP/14000 端口而不是 TCP/50070),并且 curl 用作 HTTP 客户端(但您的应用程序应该实现自己的 HTTP 客户端):

[remote-vm]$ curl -i -X PUT "http://cosmos.lab.fi-ware.org:14000/webhdfs/v1/user/$COSMOS_USER/input_data?op=MKDIRS&user.name=$COSMOS_USER"
[remote-vm]$ curl -i -X PUT ..etc
[remote-vm]$ curl -i -X PUT -T etc..

如您所见,数据上传是一个两步操作,如 WebHDFS 规范中所述:API 的第一次调用直接与 Head Node 对话,指定新文件的创建及其名称;然后头节点发送一个临时重定向响应,在集群中所有现有的数据节点中指定数据节点必须存储的数据,这是第二步的端点。尽管如此,HttpFS 网关实现了相同的 API,但其内部行为发生了变化,使重定向指向头节点本身。

但是,当我们运行这些命令时,我们会返回服务器错误,例如:

~ kari$ -bash: user.name=kdempsey: command not found
HTTP/1.1 100 Continue

HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
Set-Cookie: hadoop.auth=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/
Content-Type: text/html;charset=utf-8
Content-Length: 1275
Date: Fri, 05 Jun 2015 12:58:20 GMT

Apache Tomcat/6.0.32 - Error report<!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}-->

HTTP Status 401 - org.apache.hadoop.security.authentication.client.AuthenticationException: Anonymous requests are disallowed

type Status report

message org.apache.hadoop.security.authentication.client.AuthenticationException: Anonymous requests are disallowed

description This request requires HTTP authentication (org.apache.hadoop.security.authentication.client.AuthenticationException: Anonymous requests are disallowed).

Apache Tomcat/6.0.32

另一个是 500 服务器错误。请提供将文件远程加载到 COSMOS 共享资源中的命令。

最终我们想从我们的 InfluxDB 中获取数据并加载到 COSMOS,如果可能的话,我们希望通过 REST 调用来完成(否则是 python)。

非常感谢,卡里

4

1 回答 1

0

作为 roor 用户,我已经测试了您的帐户,它运行良好:

$ curl -i -X PUT "http://cosmos.lab.fi-ware.org:14000/webhdfs/v1/user/kdempsey/frbtest_deleteme?op=MKDIRS&user.name=kdempsey"
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: hadoop.auth="u=kdempsey&p=kdempsey&t=simple&e=1434045807412&s=iFdK86PWTbJykXymYLS9qZcIE2g="; Version=1; Path=/
Content-Type: application/json
Transfer-Encoding: chunked
Date: Thu, 11 Jun 2015 08:03:27 GMT

{"boolean":true}
$ curl -i -X GET "http://cosmos.lab.fi-ware.org:14000/webhdfs/v1/user/kdempsey/?op=LISTSTATUS&user.name=kdempsey"
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: hadoop.auth="u=kdempsey&p=kdempsey&t=simple&e=1434045881826&s=GkLYQ/BqnBNPFBNL3ZPwkxcwbx8="; Version=1; Path=/
Content-Type: application/json
Transfer-Encoding: chunked
Date: Thu, 11 Jun 2015 08:04:41 GMT

{"FileStatuses":{"FileStatus":[{"pathSuffix":"frbtest_deleteme","type":"DIRECTORY","length":0,"owner":"kdempsey","group":"kdempsey","permission":"755","accessTime":0,"modificationTime":1434009807428,"blockSize":0,"replication":0},{"pathSuffix":"input","type":"DIRECTORY","length":0,"owner":"kdempsey","group":"kdempsey","permission":"755","accessTime":0,"modificationTime":1433508554303,"blockSize":0,"replication":0},{"pathSuffix":"input_data","type":"DIRECTORY","length":0,"owner":"kdempsey","group":"kdempsey","permission":"755","accessTime":0,"modificationTime":1433508958231,"blockSize":0,"replication":0}]}}

如您所见,我创建了一个frbtest_deleteme文件夹,然后列出了您的 HDFS 用户空间 ( /user/kdempsey) 以获取子目录列表;其中,你会发现frbtest_deleteme.

于 2015-06-11T08:06:41.493 回答