0

The WebHDFS examples shows how to list files and folders in hdfs, make a directory and upload a file using BigInsights WebHDFS?

How can I adapt the examples to download a file for BigInsights WebHDFS?

4

1 回答 1

0

knox api文档提供了更多示例,例如

import groovy.json.JsonSlurper
import org.apache.hadoop.gateway.shell.Hadoop
import org.apache.hadoop.gateway.shell.hdfs.Hdfs

gateway = "https://localhost:8443/gateway/sample"
username = "bob"
password = "bob-password"
dataFile = "README"

session = Hadoop.login( gateway, username, password )
text = Hdfs.get( session ).from( "/tmp/example/README" ).now().string
file = new File('README') 
file << text
session.shutdown()
于 2016-07-21T21:30:12.460 回答