Hadoop官方文档翻译(9)

HDFS can be accessed from applications in many different ways. Natively, HDFS provides a FileSystem Java API for applications to use. A C language wrapper for this Java API and REST API is also available. In addition, an HTTP browser and can also be used to browse the files of an HDFS instance. By using NFS gateway, HDFS can be mounted as part of the client’s local file system.

应用可以通过很多方式访问HDFS。HDFS本身提供FileSystem Java API 给应用使用。C语言封装JAVA API和REST API也是可以使用。此外,HTTP浏览器也可以用来浏览HDFS实例的文件。通过使用NFS网关,HDFS能被安装作为本地文件系统的一部分。

FS Shell

HDFS allows user data to be organized in the form of files and directories. It provides a commandline interface called FS shell that lets a user interact with the data in HDFS. The syntax of this command set is similar to other shells (e.g. bash, csh) that users are already familiar with. Here are some sample action/command pairs:

HDFS允许用户数据已文件盒目录的形式来组织。他提供称为FS shell的命令行接口让用户与HDFSJ交互数据。这命令行的语法跟其他用户已经熟悉的shell相似。这里是一些命令操作的例子

Action

 

Command

 

Create a directory named /foodir

 

bin/hadoop dfs -mkdir /foodir

 

Remove a directory named /foodir

 

bin/hadoop fs -rm -R /foodir

 

View the contents of a file named /foodir/myfile.txt

 

bin/hadoop dfs -cat /foodir/myfile.txt

 

FS shell is targeted for applications that need a scripting language to interact with the stored data.

FS shell的目标是让一些使用脚本的应用能与HDFS进行数据交互。

DFSAdmin

The DFSAdmin command set is used for administering an HDFS cluster. These are commands that are used only by an HDFS administrator. Here are some sample action/command pairs:

DFSAdmin命令集是用来管理HDFS集群。这些命令只能被HDFS管理员使用,下面是一些例子:

Action

 

Command

 

Put the cluster in Safemode

 

bin/hdfs dfsadmin -safemode enter

 

Generate a list of DataNodes

 

bin/hdfs dfsadmin -report

 

Recommission or decommission DataNode(s)

 

bin/hdfs dfsadmin -refreshNodes

 
Browser Interface

A typical HDFS install configures a web server to expose the HDFS namespace through a configurable TCP port. This allows a user to navigate the HDFS namespace and view the contents of its files using a web browser.

一个通常的HDFS安装会配置一个web服务通过一个配置好的TCP端口来暴露HDFS命名空间。它允许用户看到HDFS命名空间的导航和使用web浏览器来查看他的文件内容。

Space Reclamation(空间回收) File Deletes and Undeletes(文件的删除和恢复)

If trash configuration is enabled, files removed by  is not immediately removed from HDFS. Instead, HDFS moves it to a trash directory (each user has its own trash directory under /user/<username>/.Trash). The file can be restored quickly as long as it remains in trash.

Most recent deleted files are moved to the current trash directory (/user/<username>/.Trash/Current), and in a configurable interval, HDFS creates checkpoints (under /user/<username>/.Trash/<date>) for files in current trash directory and deletes old checkpoints when they are expired. See  about checkpointing of trash.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/d3408e714afa302e1adbd1938d50e09d.html