hadoop hdfs cli
dfs-tool的Python项目详细描述
Dfs_工具
它是一个hdfs cli工具。您可以使用它来管理hdfs文件系统。
它调用WebHDFSapi。
配置
你需要放一个配置文件。默认情况下,配置文件位于~/.dfs_tool/config.json
,但是您可以通过设置环境变量DFS_TOOL_CFG
配置如下:
{"api_base_uri":"https://my_hdfs_cluster.com/gateway/ui/webhdfs/v1/","username":"superman","password":"mypassword","io_chunk_size":16777216}
api_base_url
:您需要将webhdfs端点放在这里username
:您需要指定您的hdfs帐户用户名password
:您需要指定您的hdfs帐户密码io_chunk_size
:可选,如果未设置,则默认值为1048576。它是用于从hdfs下载数据或将数据上载到hdfs的块大小,如果您的带宽很高,您可能希望提高此值
支持的命令
dfs_tool ls <remote_path> -- list directory or file
dfs_tool download <remote_filename> <local_path> -- download file
dfs_tool cat <remote_filename> -- cat a file
dfs_tool mkdir <remote_dir_name> -- make a directory
dfs_tool rm -R <remote_path> -- remove a file or directory
dfs_tool upload <local_filename> <remote_path> -- upload file
dfs_tool mv <source_location> <destination_location> -- move file or directory