简体   繁体   English

如何使用WebHDFS knox groovy库下载文件?

[英]How can I download a file using the WebHDFS knox groovy library?

The WebHDFS examples shows how to list files and folders in hdfs, make a directory and upload a file using BigInsights WebHDFS? WebHDFS 示例显示了如何使用BigInsights WebHDFS列出hdfs中的文件和文件夹,创建目录并上传文件?

How can I adapt the examples to download a file for BigInsights WebHDFS? 如何修改示例以下载BigInsights WebHDFS的文件?

The knox api documentation provides many more examples, eg 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()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在云上使用BigInsights的webHDFS时出现RSA premaster秘密错误 - RSA premaster secret error when using webHDFS from BigInsights on cloud 如何从Retrieve and Rank(Solr)下载所有文档? - How can I download all documents from Retrieve and Rank (Solr)? 如何从IBM Bluemix下载日志文件? - How to download a log file from IBM Bluemix? 如何从 IBM Cloud/Bluemix 上的 Cloud Foundry 下载/拉取已部署的应用程序和服务? - How I can download/pull deployed apps and services from Cloud Foundry on IBM Cloud/Bluemix? 如何从IBM Cloud Git Repos和问题跟踪存储库下载原始文件? - How do I download a raw file from my IBM Cloud Git Repos and Issue Tracking repository? 如何在IBM Cloud Functions Action定制包中安装定制第三方库? - How can i install custom third party library in IBM Cloud functions action custom package? 如何使用project-lib python将二进制文件保存到项目资产中? - How can I save a binary file to my project assets using project-lib python? 如何仅使用 IPython Notebook 引用 ApacheSpark 的库? - How can I reference libraries for ApacheSpark using IPython Notebook only? 如何直接上传和下载文件到Virtual Server使用终端 - How upload and download file direct to Virtual Server use Terminal 如何下载在 Watson Studio 中创建的文本转语音文件 - How to download a text to speech file created in Watson Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM