Monospaced |
Used for commands, HTTP request and responses and code blocks. |
---|---|
<Monospaced> |
User entered values. |
[Monospaced] |
Optional values. When the value is not specified, the default value is used. |
斜体 | 重要短语和词汇。 |
HTTP REST API 支持完整的HDFS FileSystem/FileContext接口。下一节将展示这些操作及其对应的FileSystem/FileContext方法。HTTP Query Parameter Dictionary章节详细说明了参数的默认值和有效值等细节。
OPEN
(参见 FileSystem.open)GETFILESTATUS
(参见 FileSystem.getFileStatus)LISTSTATUS
(参见 FileSystem.listStatus)LISTSTATUS_BATCH
(参见 FileSystem.listStatusIterator)GETCONTENTSUMMARY
(参见 FileSystem.getContentSummary)GETQUOTAUSAGE
(参见 FileSystem.getQuotaUsage)GETFILECHECKSUM
(参见 FileSystem.getFileChecksum)GETHOMEDIRECTORY
(参见 FileSystem.getHomeDirectory)GETDELEGATIONTOKEN
(参见 FileSystem.getDelegationToken)GETTRASHROOT
(参见 FileSystem.getTrashRoot)GETXATTRS
(参见 FileSystem.getXAttr)GETXATTRS
(参见 FileSystem.getXAttrs)GETXATTRS
(参见 FileSystem.getXAttrs)LISTXATTRS
(参见 FileSystem.listXAttrs)CHECKACCESS
(参见 FileSystem.access)GETALLSTORAGEPOLICY
(参见 FileSystem.getAllStoragePolicies)GETSTORAGEPOLICY
(参见 FileSystem.getStoragePolicy)GETSNAPSHOTDIFF
GETSNAPSHOTDIFFLISTING
GETSNAPSHOTTABLEDIRECTORYLIST
GETSNAPSHOTLIST
GETFILEBLOCKLOCATIONS
(参见 FileSystem.getFileBlockLocations)GETECPOLICY
(参见 HDFSErasureCoding.getErasureCodingPolicy)GETSERVERDEFAULTS
(参见 FileSystem.getServerDefaults)GETLINKTARGET
(参见 FileSystem.getLinkTarget)GETFILELINKSTATUS
(参见 FileSystem.getFileLinkStatus)GETSTATUS
(参见 FileSystem.getStatus)GETECPOLICIES
GETECCODECS
GETTRASHROOTS
(参见 FileSystem.getTrashRoots)CREATE
(参见 FileSystem.create)MKDIRS
(参见 FileSystem.mkdirs)CREATESYMLINK
(参见 FileContext.createSymlink)RENAME
(参见 FileSystem.rename)SETREPLICATION
(参见 FileSystem.setReplication)SETOWNER
(参见 FileSystem.setOwner)SETPERMISSION
(参见 FileSystem.setPermission)SETTIMES
(参见 FileSystem.setTimes)RENEWDELEGATIONTOKEN
(参见 DelegationTokenAuthenticator.renewDelegationToken)CANCELDELEGATIONTOKEN
(参见 DelegationTokenAuthenticator.cancelDelegationToken)ALLOWSNAPSHOT
DISALLOWSNAPSHOT
CREATESNAPSHOT
(参见 FileSystem.createSnapshot)RENAMESNAPSHOT
(参见 FileSystem.renameSnapshot)SETXATTR
(参见 FileSystem.setXAttr)REMOVEXATTR
(参见 FileSystem.removeXAttr)SETSTORAGEPOLICY
(参见 FileSystem.setStoragePolicy)SATISFYSTORAGEPOLICY
(参见 ArchivalStorage.satisfyStoragePolicy)ENABLEECPOLICY
(参见 HDFSErasureCoding.enablePolicy)DISABLEECPOLICY
(参见 HDFSErasureCoding.disablePolicy)SETECPOLICY
(参见 HDFSErasureCoding.setErasureCodingPolicy)APPEND
(参见 FileSystem.append)CONCAT
(参见 FileSystem.concat)TRUNCATE
(参见 FileSystem.truncate)UNSETSTORAGEPOLICY
(参见 FileSystem.unsetStoragePolicy)UNSETECPOLICY
(参见 HDFSErasureCoding.unsetErasureCodingPolicy)DELETE
(参见 FileSystem.delete)DELETESNAPSHOT
(参见 FileSystem.deleteSnapshot)WebHDFS 的文件系统方案是“webhdfs://
”。WebHDFS 文件系统 URI 的格式如下。
webhdfs://<HOST>:<HTTP_PORT>/<PATH>
上述WebHDFS URI对应以下HDFS URI。
hdfs://<HOST>:<RPC_PORT>/<PATH>
在REST API中,路径前缀会插入"/webhdfs/v1
"并在末尾附加查询参数。因此,对应的HTTP URL具有以下格式。
http://<HOST>:<HTTP_PORT>/webhdfs/v1/<PATH>?op=...
注意,如果WebHDFS启用了SSL安全连接,那么协议方案应为“swebhdfs://
”。
swebhdfs://<HOST>:<HTTP_PORT>/<PATH>
以下是WebHDFS的HDFS配置选项。
属性名称 | 描述 |
---|---|
dfs.web.authentication.kerberos.principal |
The HTTP Kerberos principal used by Hadoop-Auth in the HTTP endpoint. The HTTP Kerberos principal MUST start with ‘HTTP/’ per Kerberos HTTP SPNEGO specification. A value of “*” will use all HTTP principals found in the keytab. |
dfs.web.authentication.kerberos.keytab |
The Kerberos keytab file with the credentials for the HTTP Kerberos principal used by Hadoop-Auth in the HTTP endpoint. |
dfs.webhdfs.socket.connect-timeout |
How long to wait for a connection to be established before failing. Specified as a time duration, ie numerical value followed by a units symbol, eg 2m for two minutes. Defaults to 60s. |
dfs.webhdfs.socket.read-timeout |
How long to wait for data to arrive before failing. Defaults to 60s. |
当安全功能处于关闭状态时,认证用户即为user.name
查询参数中指定的用户名。如果未设置user.name
参数,服务器可能会将认证用户设为默认的Web用户(如果存在),或者返回错误响应。
当安全机制启用时,认证将通过Hadoop委托令牌或Kerberos SPNEGO进行。如果在delegation
查询参数中设置了令牌,则认证用户为令牌中编码的用户。如果未设置delegation
参数,则用户将通过Kerberos SPNEGO进行认证。
以下是使用curl
命令行工具的示例。
安全关闭时的认证:
curl -i "http://: /webhdfs/v1/ ?[user.name= &]op=..."
在启用安全认证时使用Kerberos SPNEGO进行身份验证:
curl -i --negotiate -u : "http://: /webhdfs/v1/ ?op=..."
在启用安全认证时使用Hadoop委托令牌进行身份验证:
curl -i "http://: /webhdfs/v1/ ?delegation= &op=..."
另请参阅:Authentication for Hadoop HTTP web-consoles
此外,WebHDFS在客户端支持OAuth2协议。目前Namenode和Datanode尚不支持使用OAuth2的客户端,但其他实现了WebHDFS REST接口的后端系统可能支持。
WebHDFS默认支持两种OAuth2授权码模式(用户提供的刷新令牌与访问令牌,或用户提供的凭证),并提供了可插拔机制用于根据OAuth2 RFC规范实现其他OAuth2认证方式或自定义认证。当使用任一内置的授权码机制时,WebHDFS客户端会在必要时自动刷新访问令牌。
OAuth2 应仅针对未使用 Kerberos SPENGO 运行的客户端启用。
OAuth2 code grant mechanism | Description | Value of dfs.webhdfs.oauth2.access.token.provider that implements code grant |
---|---|---|
授权码授权 | 用户提供初始访问令牌和刷新令牌,这些令牌随后分别用于验证WebHDFS请求和获取替换访问令牌。 | org.apache.hadoop.hdfs.web.oauth2.ConfRefreshTokenBasedAccessTokenProvider |
客户端凭证授权 | 用户提供凭证用于获取访问令牌,这些令牌随后用于验证WebHDFS请求。 | org.apache.hadoop.hdfs.web.oauth2.ConfCredentialBasedAccessTokenProvider |
以下属性控制OAuth2认证。
OAuth2 相关属性 | 描述 |
---|---|
dfs.webhdfs.oauth2.enabled |
Boolean to enable/disable OAuth2 authentication |
dfs.webhdfs.oauth2.access.token.provider |
Class name of an implementation of org.apache.hadoop.hdfs.web.oauth.AccessTokenProvider. Two are provided with the code, as described above, or the user may specify a user-provided implementation. The default value for this configuration key is the ConfCredentialBasedAccessTokenProvider implementation. |
dfs.webhdfs.oauth2.client.id |
Client id used to obtain access token with either credential or refresh token |
dfs.webhdfs.oauth2.refresh.url |
URL against which to post for obtaining bearer token with either credential or refresh token |
dfs.webhdfs.oauth2.access.token |
(required if using ConfRefreshTokenBasedAccessTokenProvider) Initial access token with which to authenticate |
dfs.webhdfs.oauth2.refresh.token |
(required if using ConfRefreshTokenBasedAccessTokenProvider) Initial refresh token to use to obtain new access tokens |
dfs.webhdfs.oauth2.refresh.token.expires.ms.since.epoch |
(required if using ConfRefreshTokenBasedAccessTokenProvider) Access token expiration measured in milliseconds since Jan 1, 1970. Note this is a different value than provided by OAuth providers and has been munged as described in interface to be suitable for a client application |
dfs.webhdfs.oauth2.credential |
(required if using ConfCredentialBasedAccessTokenProvider). Credential used to obtain initial and subsequent access tokens. |
要使用SWebHDFS文件系统(即使用swebhdfs协议),需要在客户端指定一个SSL配置文件。该文件必须包含以下3个参数:
SSL属性 | 描述 |
---|---|
ssl.client.truststore.location |
The local-filesystem location of the trust-store file, containing the certificate for the NameNode. |
ssl.client.truststore.type |
(Optional) The format of the trust-store file. |
ssl.client.truststore.password |
(Optional) Password for the trust-store file. |
以下是一个SSL配置文件的示例(ssl-client.xml):
<configuration> <property> <name>ssl.client.truststore.location</name> <value>/work/keystore.jks</value> <description>Truststore to be used by clients. Must be specified.</description> </property> <property> <name>ssl.client.truststore.password</name> <value>changeme</value> <description>Optional. Default value is "".</description> </property> <property> <name>ssl.client.truststore.type</name> <value>jks</value> <description>Optional. Default value is "jks".</description> </property> </configuration>
SSL配置文件必须位于客户端程序的类路径中,且文件名需要在core-site.xml中指定:
<property> <name>hadoop.ssl.client.conf</name> <value>ssl-client.xml</value> <description> Resource file from which ssl client keystore information will be extracted. This file is looked up in the classpath, typically it should be in Hadoop conf/ directory. Default value is "ssl-client.xml". </description> </property>
当代理用户功能启用时,代理用户P可以代表另一个用户U提交请求。除非在认证中提供了委托令牌,否则必须在doas
查询参数中指定用户U的用户名。在这种情况下,用户P和U的信息都必须编码在委托令牌中。
当安全关闭时的代理请求:
curl -i "http://: /webhdfs/v1/ ?[user.name= &]doas= &op=..."
当安全认证开启时,使用Kerberos SPNEGO的代理请求:
curl -i --negotiate -u : "http://: /webhdfs/v1/ ?doas= &op=..."
在安全模式下使用Hadoop委托令牌的代理请求:
curl -i "http://: /webhdfs/v1/ ?delegation= &op=..."
WebHDFS支持一个可选的、可配置的跨站请求伪造(CSRF)防护机制。启用该功能后,发送至NameNode或DataNode的WebHDFS HTTP请求必须包含一个自定义HTTP头部。通过配置属性可以调整受保护的具体HTTP方法以及HTTP头部的名称。头部中发送的具体值无关紧要,只需确保存在该名称的头部即可。
启用CSRF防护还会配置WebHdfsFileSystem
类发送所需的请求头。这确保当使用webhdfs:
URI时,像hdfs dfs
和hadoop distcp
这样的CLI命令能继续正常工作。
启用CSRF防护还会设置NameNode网页界面发送所需的标头。在启用CSRF防护并重启NameNode后,现有NameNode网页界面的用户需要刷新浏览器以重新加载页面并获取新配置。
以下属性控制CSRF防护。
属性 | 描述 | 默认值 |
---|---|---|
dfs.webhdfs.rest-csrf.enabled |
If true, then enables WebHDFS protection against cross-site request forgery (CSRF). The WebHDFS client also uses this property to determine whether or not it needs to send the custom CSRF prevention header in its HTTP requests. | false |
dfs.webhdfs.rest-csrf.custom-header |
The name of a custom header that HTTP requests must send when protection against cross-site request forgery (CSRF) is enabled for WebHDFS by setting dfs.webhdfs.rest-csrf.enabled to true. The WebHDFS client also uses this property to determine whether or not it needs to send the custom CSRF prevention header in its HTTP requests. | X-XSRF-HEADER |
dfs.webhdfs.rest-csrf.methods-to-ignore |
A comma-separated list of HTTP methods that do not require HTTP requests to include a custom header when protection against cross-site request forgery (CSRF) is enabled for WebHDFS by setting dfs.webhdfs.rest-csrf.enabled to true. The WebHDFS client also uses this property to determine whether or not it needs to send the custom CSRF prevention header in its HTTP requests. | GET,OPTIONS,HEAD,TRACE |
dfs.webhdfs.rest-csrf.browser-useragents-regex |
A comma-separated list of regular expressions used to match against an HTTP request’s User-Agent header when protection against cross-site request forgery (CSRF) is enabled for WebHDFS by setting dfs.webhdfs.reset-csrf.enabled to true. If the incoming User-Agent matches any of these regular expressions, then the request is considered to be sent by a browser, and therefore CSRF prevention is enforced. If the request’s User-Agent does not match any of these regular expressions, then the request is considered to be sent by something other than a browser, such as scripted automation. In this case, CSRF is not a potential attack vector, so the prevention is not enforced. This helps achieve backwards-compatibility with existing automation that has not been updated to send the CSRF prevention header. | ^Mozilla.*,^Opera.* |
dfs.datanode.httpserver.filter.handlers |
Comma separated list of Netty servlet-style filter handlers to inject into the Datanode WebHDFS I/O path | org.apache.hadoop.hdfs.server.datanode.web.RestCsrfPreventionFilterHandler |
以下是一个使用curl
命令的示例,其中通过-H
选项在请求中包含自定义头部。
curl -i -L -X PUT -H 'X-XSRF-HEADER: ""' 'http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=CREATE'
WebHDFS支持可选的、可配置的重试策略,用于处理可能超时的大文件弹性复制,或在复制过程中可能发生故障转移的高可用性集群之间复制文件。
以下属性控制WebHDFS的重试和故障转移策略。
属性 | 描述 | 默认值 |
---|---|---|
dfs.http.client.retry.policy.enabled |
If “true”, enable the retry policy of WebHDFS client. If “false”, retry policy is turned off. | false |
dfs.http.client.retry.policy.spec |
Specify a policy of multiple linear random retry for WebHDFS client, e.g. given pairs of number of retries and sleep time (n0, t0), (n1, t1), …, the first n0 retries sleep t0 milliseconds on average, the following n1 retries sleep t1 milliseconds on average, and so on. | 10000,6,60000,10 |
dfs.http.client.failover.max.attempts |
Specify the max number of failover attempts for WebHDFS client in case of network exception. | 15 |
dfs.http.client.retry.max.attempts |
Specify the max number of retry attempts for WebHDFS client, if the difference between retried attempts and failovered attempts is larger than the max number of retry attempts, there will be no more retries. | 10 |
dfs.http.client.failover.sleep.base.millis |
Specify the base amount of time in milliseconds upon which the exponentially increased sleep time between retries or failovers is calculated for WebHDFS client. | 500 |
dfs.http.client.failover.sleep.max.millis |
Specify the upper bound of sleep time in milliseconds between retries or failovers for WebHDFS client. | 15000 |
可以通过WebHDFS协议控制数据的单向传输,仅允许从不安全网络写入数据。要实现此功能,必须确保dfs.datanode.httpserver.filter.handlers
包含org.apache.hadoop.hdfs.server.datanode.web.HostRestrictingAuthorizationFilterHandler
。HostRestrictingAuthorizationFilter
的配置通过以下属性进行控制。
属性 | 描述 | 默认值 |
---|---|---|
dfs.datanode.httpserver.filter.handlers |
Comma separated list of Netty servlet-style filter handlers to inject into the Datanode WebHDFS I/O path | org.apache.hadoop.hdfs.server.datanode.web.RestCsrfPreventionFilterHandler |
dfs.web.authentication.host.allow.rules |
Rules allowing users to read files in the format of user,network/bits,path glob newline or | -separated. Use * for a wildcard of all users or network/bits. |
nothing - defaults to no one may read via WebHDFS |
步骤1:提交一个HTTP PUT请求,不自动跟随重定向且不发送文件数据。
curl -i -X PUT "http://: /webhdfs/v1/ ?op=CREATE [&overwrite= ][&blocksize= ][&replication= ] [&permission= ][&buffersize= ][&noredirect= ]"
通常该请求会被重定向到将要写入文件数据的数据节点。
HTTP/1.1 307 TEMPORARY_REDIRECT Location: http://: /webhdfs/v1/ ?op=CREATE... Content-Length: 0
但是,如果您不希望自动重定向,可以设置noredirect标志。
HTTP/1.1 200 OK Content-Type: application/json {"Location":"http://: /webhdfs/v1/ ?op=CREATE..."}
步骤2:使用Location
头部中的URL(如果指定了noredirect则使用返回的响应)提交另一个HTTP PUT请求,附带要写入的文件数据。
curl -i -X PUT -T"http:// : /webhdfs/v1/ ?op=CREATE..."
客户端会收到一个内容长度为零的201 Created
响应,并在Location
头部中包含文件的WebHDFS URI:
HTTP/1.1 201 Created Location: webhdfs://: / Content-Length: 0
如果未指定权限,新创建的文件将被赋予默认的644权限。服务器端不会应用umask模式(因此在Namenode端设置的"fs.permissions.umask-mode"值配置将不会生效)。
注意采用两步创建/追加操作的原因是为了防止客户端在重定向前发送数据。HTTP/1.1中通过"Expect: 100-continue
"标头解决了这个问题;详见RFC 2616, Section 8.2.3。遗憾的是,某些软件库存在缺陷(例如Jetty 6 HTTP服务器和Java 6 HTTP客户端),未能正确实现"Expect: 100-continue
"功能。两步创建/追加操作是针对这些软件库缺陷的临时解决方案。
另请参阅:overwrite
, blocksize
, replication
, permission
, buffersize
, FileSystem.create
curl -i -X POST "http://: /webhdfs/v1/ ?op=APPEND[&buffersize= ][&noredirect= ]"
通常该请求会被重定向到将要追加文件数据的数据节点:
HTTP/1.1 307 TEMPORARY_REDIRECT Location: http://: /webhdfs/v1/ ?op=APPEND... Content-Length: 0
但是,如果您不希望被自动重定向,可以设置noredirect标志。
HTTP/1.1 200 OK Content-Type: application/json {"Location":"http://<DATANODE>:<PORT>/webhdfs/v1/<PATH>?op=APPEND..."}
Location
头部中的URL(如果指定了noredirect则使用返回的响应)提交另一个HTTP POST请求,附带要追加的文件数据。
curl -i -X POST -T"http:// : /webhdfs/v1/ ?op=APPEND..."
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
关于此操作需要两个步骤的原因说明,请参阅上一节的注释。
另请参阅:buffersize
, FileSystem.append
curl -i -X POST "http://: /webhdfs/v1/ ?op=CONCAT&sources= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:sources
, FileSystem.concat
curl -i -L "http://: /webhdfs/v1/ ?op=OPEN [&offset= ][&length= ][&buffersize= ][&noredirect= ]"
通常该请求会被重定向到可以读取文件数据的数据节点:
HTTP/1.1 307 TEMPORARY_REDIRECT Location: http://: /webhdfs/v1/ ?op=OPEN... Content-Length: 0
但如果您不希望自动重定向,可以设置noredirect标志。
HTTP/1.1 200 OK Content-Type: application/json {"Location":"http://: /webhdfs/v1/ ?op=OPEN..."}
客户端跟随重定向到数据节点并接收文件数据:
HTTP/1.1 200 OK Content-Type: application/octet-stream Content-Length: 22 Hello, webhdfs user!
另请参阅:offset
, length
, buffersize
, FileSystem.open
curl -i -X PUT "http://: /webhdfs/v1/ ?op=MKDIRS[&permission= ]"
客户端会收到包含boolean
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"boolean": true}
如果未指定权限,新创建的目录将默认具有755权限。服务器端不会应用umask模式(因此在Namenode端设置的"fs.permissions.umask-mode"配置值将不会生效)。
另请参阅: permission
, FileSystem.mkdirs
curl -i -X PUT "http://: /webhdfs/v1/ ?op=CREATESYMLINK &destination= [&createParent= ]"
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅: destination
, createParent
, FileSystem.createSymlink
curl -i -X PUT ": /webhdfs/v1/ ?op=RENAME&destination= "
客户端会收到包含boolean
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"boolean": true}
另请参阅:destination
, FileSystem.rename
curl -i -X DELETE "http://: /webhdfs/v1/ ?op=DELETE [&recursive= ]"
客户端会收到包含boolean
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"boolean": true}
另请参阅:recursive
, FileSystem.delete
curl -i -X POST "http://: /webhdfs/v1/ ?op=TRUNCATE&newlength= "
客户端会收到包含boolean
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"boolean": true}
另请参阅:newlength
, FileSystem.truncate
curl -i "http://: /webhdfs/v1/ ?op=GETFILESTATUS"
客户端会收到包含FileStatus
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "FileStatus": { "accessTime" : 0, "blockSize" : 0, "group" : "supergroup", "length" : 0, //以字节为单位,目录为零 "modificationTime": 1320173277227, "owner" : "webuser", "pathSuffix" : "", "permission" : "777", "replication" : 0, "snapshotEnabled" : true "type" : "DIRECTORY" //枚举类型 {文件, 目录, 符号链接} "ecPolicy" : "RS-6-3-1024k" } }
另请参阅:FileSystem.getFileStatus
curl -i "http://: /webhdfs/v1/ ?op=LISTSTATUS"
客户端将收到包含FileStatuses
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 427 { "FileStatuses": { "FileStatus": [ { "accessTime" : 1320171722771, "blockSize" : 33554432, "childrenNum" : 0, "fileId" : 16388, "group" : "supergroup", "length" : 24930, "modificationTime": 1320171722771, "owner" : "webuser", "pathSuffix" : "a.patch", "permission" : "644", "replication" : 1, "storagePolicy" : 0, "type" : "FILE" }, { "accessTime" : 0, "blockSize" : 0, "childrenNum" : 0, "fileId" : 16389, "group" : "supergroup", "length" : 0, "modificationTime": 1320895981256, "owner" : "username", "pathSuffix" : "bar", "permission" : "711", "replication" : 0, "snapshotEnabled" : true "type" : "DIRECTORY" }, ... ] } }
另请参阅: FileSystem.listStatus
curl -i "http://: /webhdfs/v1/ ?op=LISTSTATUS"
客户端将收到包含FileStatuses
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 427 { "FileStatuses": { "FileStatus": [ { "accessTime" : 1320171722771, "blockSize" : 33554432, "childrenNum" : 0, "fileId" : 16390, "group" : "supergroup", "length" : 1366, "modificationTime": 1501770633062, "owner" : "webuser", "pathSuffix" : "", "permission" : "644", "replication" : 1, "storagePolicy" : 0, "type" : "FILE" } ] } }
另请参阅:FileSystem.listStatus
curl -i "http://: /webhdfs/v1/ ?op=LISTSTATUS_BATCH&startAfter= "
客户端会收到包含DirectoryListing
JSON对象的响应,该对象包含一个FileStatuses
JSON对象以及迭代信息:
HTTP/1.1 200 OK Cache-Control: no-cache Expires: Thu, 08 Sep 2016 03:40:38 GMT Date: Thu, 08 Sep 2016 03:40:38 GMT Pragma: no-cache Expires: Thu, 08 Sep 2016 03:40:38 GMT Date: Thu, 08 Sep 2016 03:40:38 GMT Pragma: no-cache Content-Type: application/json X-FRAME-OPTIONS: SAMEORIGIN Transfer-Encoding: chunked Server: Jetty(6.1.26) { "DirectoryListing": { "partialListing": { "FileStatuses": { "FileStatus": [ { "accessTime": 0, "blockSize": 0, "childrenNum": 0, "fileId": 16387, "group": "supergroup", "length": 0, "modificationTime": 1473305882563, "owner": "andrew", "pathSuffix": "bardir", "permission": "755", "replication": 0, "storagePolicy": 0, "type": "DIRECTORY" }, { "accessTime": 1473305896945, "blockSize": 1024, "childrenNum": 0, "fileId": 16388, "group": "supergroup", "length": 0, "modificationTime": 1473305896965, "owner": "andrew", "pathSuffix": "bazfile", "permission": "644", "replication": 3, "storagePolicy": 0, "type": "FILE" } ] } }, "remainingEntries": 2 } }
如果remainingEntries
不为零,表示目录中还有更多条目。要查询下一批数据,请将startAfter
参数设置为当前批次返回的最后一项的pathSuffix
。例如:
curl -i "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=LISTSTATUS_BATCH&startAfter=bazfile"
这将返回下一批目录条目:
HTTP/1.1 200 OK Cache-Control: no-cache Expires: Thu, 08 Sep 2016 03:43:20 GMT Date: Thu, 08 Sep 2016 03:43:20 GMT Pragma: no-cache Expires: Thu, 08 Sep 2016 03:43:20 GMT Date: Thu, 08 Sep 2016 03:43:20 GMT Pragma: no-cache Content-Type: application/json X-FRAME-OPTIONS: SAMEORIGIN Transfer-Encoding: chunked Server: Jetty(6.1.26) { "DirectoryListing": { "partialListing": { "FileStatuses": { "FileStatus": [ { "accessTime": 0, "blockSize": 0, "childrenNum": 0, "fileId": 16386, "group": "supergroup", "length": 0, "modificationTime": 1473305878951, "owner": "andrew", "pathSuffix": "foodir", "permission": "755", "replication": 0, "storagePolicy": 0, "type": "DIRECTORY" }, { "accessTime": 1473305902864, "blockSize": 1024, "childrenNum": 0, "fileId": 16389, "group": "supergroup", "length": 0, "modificationTime": 1473305902878, "owner": "andrew", "pathSuffix": "quxfile", "permission": "644", "replication": 3, "storagePolicy": 0, "type": "FILE" } ] } }, "remainingEntries": 0 } }
批量大小由NameNode上的dfs.ls.limit
选项控制。
另请参阅:FileSystem.listStatusIterator
curl -i "http://: /webhdfs/v1/ ?op=GETCONTENTSUMMARY"
客户端将收到包含ContentSummary
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "ContentSummary": { "directoryCount": 2, "ecPolicy" : "RS-6-3-1024k", "fileCount" : 1, "length" : 24930, "quota" : -1, "spaceConsumed" : 24930, "spaceQuota" : -1, "typeQuota": { "ARCHIVE": { "consumed": 500, "quota": 10000 }, "DISK": { "consumed": 500, "quota": 10000 }, "SSD": { "consumed": 500, "quota": 10000 } } } }
另请参阅:FileSystem.getContentSummary
curl -i "http://: /webhdfs/v1/ ?op=GETQUOTAUSAGE"
客户端会收到包含QuotaUsage
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "QuotaUsage": { "fileAndDirectoryCount": 1, "quota" : 100, "spaceConsumed" : 24930, "spaceQuota" : 100000, "typeQuota": { "ARCHIVE": { "consumed": 500, "quota": 10000 }, "DISK": { "consumed": 500, "quota": 10000 }, "SSD": { "consumed": 500, "quota": 10000 } } } }
另请参阅:FileSystem.getQuotaUsage
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETQUOTA &namespacequota= [&storagespacequota= ]"
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.setQuota
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETQUOTABYSTORAGETYPE &storagetype= &storagespacequota= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.setQuotaByStorageType
curl -i "http://: /webhdfs/v1/ ?op=GETFILECHECKSUM"
通常该请求会被重定向到数据节点:
HTTP/1.1 307 TEMPORARY_REDIRECT Location: http://: /webhdfs/v1/ ?op=GETFILECHECKSUM... Content-Length: 0
不过,如果您不希望自动重定向,可以设置noredirect标志。
HTTP/1.1 200 OK Content-Type: application/json {"Location":"http://: /webhdfs/v1/ ?op=GETFILECHECKSUM..."}
客户端跟随重定向到数据节点,并接收一个FileChecksum
JSON对象:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "FileChecksum": { "algorithm": "MD5-of-1MD5-of-512CRC32", "bytes" : "eadb10de24aa315748930df6e185c0d ...", "length" : 28 } }
另请参阅:FileSystem.getFileChecksum
curl -i "http://: /webhdfs/v1/?op=GETHOMEDIRECTORY"
客户端会收到包含Path
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"Path": "/user/username"}
另请参阅:FileSystem.getHomeDirectory
curl -i "http://: /webhdfs/v1/ ?op=GETTRASHROOT"
客户端会收到一个包含Path
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"Path": "/user/username/.Trash"}
如果路径是加密区域路径且用户有该路径的权限,客户端将收到如下响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"Path": "/PATH/.Trash/username"}
另请参阅:FileSystem.getTrashRoot
有关加密区域中垃圾回收根目录的更多详情,请参阅透明加密指南。
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETPERMISSION [&permission= ]"
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:permission
, FileSystem.setPermission
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETOWNER [&owner= ][&group= ]"
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅: owner
, group
, FileSystem.setOwner
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETREPLICATION [&replication= ]"
客户端会收到包含boolean
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"boolean": true}
另请参阅:replication
, FileSystem.setReplication
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETTIMES [&modificationtime=
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅: modificationtime
, accesstime
, FileSystem.setTimes
curl -i -X PUT "http://: /webhdfs/v1/ ?op=MODIFYACLENTRIES &aclspec= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.modifyAclEntries
curl -i -X PUT "http://: /webhdfs/v1/ ?op=REMOVEACLENTRIES &aclspec= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.removeAclEntries
curl -i -X PUT "http://: /webhdfs/v1/ ?op=REMOVEDEFAULTACL"
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.removeDefaultAcl
curl -i -X PUT "http://: /webhdfs/v1/ ?op=REMOVEACL"
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.removeAcl
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETACL &aclspec= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.setAcl
curl -i "http://: /webhdfs/v1/ ?op=GETACLSTATUS"
客户端将收到包含AclStatus
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "AclStatus": { "entries": [ "user:carla:rw-", "group::r-x" ], "group": "supergroup", "owner": "hadoop", "permission":"775", "stickyBit": false } }
另请参阅:FileSystem.getAclStatus
curl -i "http://: /webhdfs/v1/ ?op=CHECKACCESS &fsaction=
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.access
curl -i "http://: /webhdfs/v1/ ?op=GETSERVERDEFAULTS"
客户端收到一个包含ServerDefaults
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "FsServerDefaults": { "replication": 3, "encryptDataTransfer": "false", "defaultStoragePolicyId":7, "writePacketSize": 65536, "fileBufferSize": 4096, "checksumType": 2, "trashInterval": 10080, "keyProviderUri": "", "blockSize": 134217728, "bytesPerChecksum": 512 } }
另请参阅:FileSystem.getServerDefaults
curl -i "http://: /webhdfs/v1/ ?op=GETLINKTARGET"
客户端将收到包含Path
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"Path": "/user/username/targetFile"}
另请参阅:FileSystem.getLinkTarget
curl -i "http://: /webhdfs/v1/ ?op=GETFILELINKSTATUS"
客户端收到包含FileStatus
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "FileStatus": { "accessTime": 0, "blockSize": 0, "childrenNum":0, "fileId": 16388, "group": "supergroup", "length": 0, "modificationTime": 1681916788427, "owner": "hadoop", "pathSuffix": "", "permission": "777", "replication": 0, "storagePolicy": 0, "symlink": "/webHdfsTest/file", "type": "SYMLINK" } }
另请参阅:FileSystem.getFileLinkInfo
curl -i "http://: /webhdfs/v1/ ?op=GETECPOLICIES"
客户端收到一个包含ECPolicies
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "ErasureCodingPolicies": { "ErasureCodingPolicyInfo": [ { "state": "ENABLED", "policy": { "name": "RS-6-3-1024k", "schema": { "codecName": "rs", "numDataUnits": 6, "numParityUnits": 3, "extraOptions": {} }, "cellSize": 1048576, "id": 1, "replicationPolicy": false, "codecName": "rs", "numDataUnits": 6, "numParityUnits": 3, "systemPolicy": true } } ] } }
curl -i "http://: /webhdfs/v1/ ?op=GETSTATUS"
客户端收到一个包含FsStatus
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "FsStatus": { "used": 29229154304, "remaining": 292893392896, "capacity":322122547200 } }
另请参阅:FileSystem.getStatus
curl -i "http://: /webhdfs/v1/ ?op=GETALLECCODECS"
客户端收到一个包含ECCodecs
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "ErasureCodeCodecs": { "rs": "rs_native, rs_java", "rs-legacy": "rs-legacy_java", "xor":"xor_native, xor_java" } }
curl -i "http://: /webhdfs/v1/ ?op=GETTRASHROOTS &allusers= "
客户端收到一个包含Paths
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "Paths": [{ "blocksize": 0, "owner": "hadoop", "path": "/user/user0/.Trash", "length": 0, "permission": "755", "modification_time": 1693050205747, "isdir": true, "block_replication": 0, "access_time": 0, "group": "supergroup" }, { "blocksize": 0, "owner": "hadoop", "path": "/user/user1/.Trash", "length": 0, "permission": "755", "modification_time": 1693049382962, "isdir": true, "block_replication": 0, "access_time": 0, "group": "supergroup" }] }
另请参阅:FileSystem.getTrashRoots
curl -i "http://: /webhdfs/v1?op=GETALLSTORAGEPOLICY"
客户端将收到包含BlockStoragePolicies
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "BlockStoragePolicies": { "BlockStoragePolicy": [ { "copyOnCreateFile": false, "creationFallbacks": [], "id": 2, "name": "COLD", "replicationFallbacks": [], "storageTypes": ["ARCHIVE"] }, { "copyOnCreateFile": false, "creationFallbacks": ["DISK","ARCHIVE"], "id": 5, "name": "WARM", "replicationFallbacks": ["DISK","ARCHIVE"], "storageTypes": ["DISK","ARCHIVE"] }, { "copyOnCreateFile": false, "creationFallbacks": [], "id": 7, "name": "HOT", "replicationFallbacks": ["ARCHIVE"], "storageTypes": ["DISK"] }, { "copyOnCreateFile": false, "creationFallbacks": ["SSD","DISK"], "id": 10,"name": "ONE_SSD", "replicationFallbacks": ["SSD","DISK"], "storageTypes": ["SSD","DISK"] }, { "copyOnCreateFile": false, "creationFallbacks": ["DISK"], "id": 12, "name": "ALL_SSD", "replicationFallbacks": ["DISK"], "storageTypes": ["SSD"] }, { "copyOnCreateFile": false, "creationFallbacks": ["DISK"], "id": 14, "name": "ALL_NVDIMM", "replicationFallbacks": ["DISK"], "storageTypes": ["NVDIMM"] }, { "copyOnCreateFile": true, "creationFallbacks": ["DISK"], "id": 15, "name": "LAZY_PERSIST", "replicationFallbacks": ["DISK"], "storageTypes": ["RAM_DISK","DISK"] } ] } }
另请参阅:FileSystem.getAllStoragePolicies
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETSTORAGEPOLICY &storagepolicy= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.setStoragePolicy
curl -i -X POST "http://: /webhdfs/v1/ ?op=UNSETSTORAGEPOLICY"
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.unsetStoragePolicy
curl -i "http://: /webhdfs/v1/ ?op=GETSTORAGEPOLICY"
客户端将收到包含BlockStoragePolicy
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "BlockStoragePolicy": { "copyOnCreateFile": false, "creationFallbacks": [], "id":7, "name":"HOT", "replicationFallbacks":["ARCHIVE"], "storageTypes":["DISK"] } }
另请参阅:FileSystem.getStoragePolicy
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SATISFYSTORAGEPOLICY"
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:ArchivalStorage.satisfyStoragePolicy
curl -i "http://: /webhdfs/v1/ ?op=GETFILEBLOCKLOCATIONS
客户端将收到包含BlockLocations
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "BlockLocations" : { "BlockLocation": [ { "cachedHosts" : [], "corrupt" : false, "hosts" : ["host"], "length" : 134217728, // 该块的长度 "names" : ["host:ip"], "offset" : 0, // 块在文件中的偏移量 "storageTypes" : ["DISK"], // 枚举类型 {RAM_DISK, SSD, DISK, ARCHIVE} "topologyPaths" : ["/default-rack/hostname:ip"] }, { "cachedHosts" : [], "corrupt" : false, "hosts" : ["host"], "length" : 62599364, "names" : ["host:ip"], "offset" : 134217728, "storageTypes" : ["DISK"], "topologyPaths" : ["/default-rack/hostname:ip"] }, ... ] } }
另请参阅:offset
, length
, FileSystem.getFileBlockLocations
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETXATTR &xattr.name= &xattr.value= &flag= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.setXAttr
curl -i -X PUT "http://: /webhdfs/v1/ ?op=REMOVEXATTR &xattr.name= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.removeXAttr
curl -i "http://: /webhdfs/v1/ ?op=GETXATTRS &xattr.name= &encoding= "
客户端会收到包含XAttrs
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "XAttrs": [ { "name":"XATTRNAME", "value":"XATTRVALUE" } ] }
另请参阅:FileSystem.getXAttr
curl -i "http://: /webhdfs/v1/ ?op=GETXATTRS &xattr.name= &xattr.name= &encoding= "
客户端会收到包含XAttrs
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "XAttrs": [ { "name":"XATTRNAME1", "value":"XATTRVALUE1" }, { "name":"XATTRNAME2", "value":"XATTRVALUE2" } ] }
另请参阅:FileSystem.getXAttrs
curl -i "http://: /webhdfs/v1/ ?op=GETXATTRS &encoding= "
客户端会收到包含XAttrs
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "XAttrs": [ { "name":"XATTRNAME1", "value":"XATTRVALUE1" }, { "name":"XATTRNAME2", "value":"XATTRVALUE2" }, { "name":"XATTRNAME3", "value":"XATTRVALUE3" } ] }
另请参阅:FileSystem.getXAttrs
curl -i "http://: /webhdfs/v1/ ?op=LISTXATTRS"
客户端会收到包含XAttrNames
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "XAttrNames":"[\"XATTRNAME1\",\"XATTRNAME2\",\"XATTRNAME3\"]" }
另请参阅:FileSystem.listXAttrs
curl -i -X PUT "http://: /webhdfs/v1/?op=ENABLEECPOLICY &ecpolicy= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:HDFSErasureCoding.enablePolicy
curl -i -X PUT "http://: /webhdfs/v1/?op=DISABLEECPOLICY &ecpolicy= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:HDFSErasureCoding.disablePolicy
curl -i -X PUT "http://: /webhdfs/v1/ ?op=SETECPOLICY &ecpolicy= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅: HDFSErasureCoding.setErasureCodingPolicy
curl -i -X GET "http://: /webhdfs/v1/ ?op=GETECPOLICY "
客户端收到一个包含ECPolicy
JSON对象的响应:
{ "name": "RS-10-4-1024k", "schema": { "codecName": "rs", "numDataUnits": 10, "numParityUnits": 4, "extraOptions": {} } "cellSize": 1048576, "id":5, "codecname":"rs", "numDataUnits": 10, "numParityUnits": 4, "replicationpolicy":false, "systemPolicy":true }
另请参阅: HDFSErasureCoding.getErasureCodingPolicy
curl -i -X POST "http://: /webhdfs/v1/ ?op=UNSETECPOLICY "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:HDFSErasureCoding.unsetErasureCodingPolicy
curl -i -X PUT "http://: /webhdfs/v1/ ?op=ALLOWSNAPSHOT"
客户端在成功时会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
curl -i -X PUT "http://: /webhdfs/v1/ ?op=DISALLOWSNAPSHOT"
客户端在成功时会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
curl -i -X PUT "http://: /webhdfs/v1/ ?op=CREATESNAPSHOT[&snapshotname= ]"
客户端会收到包含Path
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"Path": "/user/username/.snapshot/s1"}
另请参阅:FileSystem.createSnapshot
curl -i -X DELETE "http://: /webhdfs/v1/ ?op=DELETESNAPSHOT&snapshotname= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.deleteSnapshot
curl -i -X PUT "http://: /webhdfs/v1/ ?op=RENAMESNAPSHOT &oldsnapshotname= &snapshotname= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:FileSystem.renameSnapshot
curl -i GET "http://: /webhdfs/v1/ ?op=GETSNAPSHOTDIFF &oldsnapshotname= &snapshotname= "
客户端会收到包含SnapshotDiffReport
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"SnapshotDiffReport":{"diffList":[],"fromSnapshot":"s3","snapshotRoot":"/foo","toSnapshot":"s4"}}
curl -i -X GET "http://: /webhdfs/v1/ ?op=GETSNAPSHOTDIFFLISTING &oldsnapshotname= &snapshotname= &snapshotdiffstartpath= &snapshotdiffindex=
如果未提供snapshotdiffstartpath
和snapshotdiffindex
参数,则分别使用""
(空字符串)和-1
作为默认值,表示首次迭代。
客户端将收到包含SnapshotDiffReportListing
JSON对象的响应。lastPath
和lastIndex
的值应分别作为下一次迭代时snapshotdiffstartpath
和snapshotdiffindex
的参数值。
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"SnapshotDiffReportListing":{"createList":[],"deleteList":[],"isFromEarlier":true,"lastIndex":-1,"lastPath":"","modifyList":[]}}
curl -i GET "http://: /webhdfs/v1/?user.name= &op=GETSNAPSHOTTABLEDIRECTORYLIST"
如果USER不是hdfs超级用户,该调用仅列出该用户拥有的可快照目录。如果USER是hdfs超级用户,该调用会列出所有可快照目录。客户端将收到包含SnapshottableDirectoryList
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "SnapshottableDirectoryList": [ { "dirStatus": { "accessTime":0, "blockSize":0, "childrenNum":0, "fileId":16386, "group":"hadoop", "length":0, "modificationTime":1520761889225, "owner":"random", "pathSuffix":"bar", "permission":"755", "replication":0, "storagePolicy":0, "type":"DIRECTORY" }, "parentFullPath":"/", "snapshotNumber":0, "snapshotQuota":65536 } ] }
curl -i GET "http://: /webhdfs/v1/ ?"
该调用会列出可快照目录的快照列表。客户端将收到包含SnapshotList
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "SnapshotList": [ { "dirStatus": { "accessTime":0, "blockSize":0, "childrenNum":0, "fileId":16386, "group":"hadoop", "length":0, "modificationTime":1520761889225, "owner":"random", "pathSuffix":"bar", "permission":"755", "replication":0, "storagePolicy":0, "type":"DIRECTORY" }, "fullPath":"/", "snapshotID":0, "deletionStatus":ACTIVE } ] }
curl -i "http://: /webhdfs/v1/?op=GETDELEGATIONTOKEN [&renewer= ][&service= ][&kind= ]"
客户端会收到包含Token
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked { "Token": { "urlString": "JQAIaG9y..." } }
另请参阅:renewer
, FileSystem.getDelegationToken, kind
, service
curl -i -X PUT "http://: /webhdfs/v1/?op=RENEWDELEGATIONTOKEN&token= "
客户端会收到包含long
JSON对象的响应:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked {"long": 1320962673997} //新的过期时间
另请参阅:token
, DelegationTokenAuthenticator.renewDelegationToken
curl -i -X PUT "http://: /webhdfs/v1/?op=CANCELDELEGATIONTOKEN&token= "
客户端会收到一个内容长度为零的响应:
HTTP/1.1 200 OK Content-Length: 0
另请参阅:token
, DelegationTokenAuthenticator.cancelDelegationToken
当操作失败时,服务器可能会抛出异常。错误响应的JSON模式定义在RemoteException JSON Schema中。下表展示了异常到HTTP响应代码的映射关系。
异常 | HTTP响应码 |
---|---|
IllegalArgumentException |
400 Bad Request |
UnsupportedOperationException |
400 Bad Request |
SecurityException |
401 Unauthorized |
IOException |
403 Forbidden |
FileNotFoundException |
404 Not Found |
RuntimeException |
500 Internal Server Error |
以下是异常响应的示例。
HTTP/1.1 400 Bad Request Content-Type: application/json Transfer-Encoding: chunked { "RemoteException": { "exception" : "IllegalArgumentException", "javaClassName": "java.lang.IllegalArgumentException", "message" : "Invalid value for webhdfs parameter \"permission\": ..." } }
HTTP/1.1 401 Unauthorized Content-Type: application/json Transfer-Encoding: chunked { "RemoteException": { "exception" : "SecurityException", "javaClassName": "java.lang.SecurityException", "message" : "Failed to obtain user group information: ..." } }
HTTP/1.1 403 Forbidden Content-Type: application/json Transfer-Encoding: chunked { "RemoteException": { "exception" : "AccessControlException", "javaClassName": "org.apache.hadoop.security.AccessControlException", "message" : "Permission denied: ..." } }
HTTP/1.1 404 Not Found Content-Type: application/json Transfer-Encoding: chunked { "RemoteException": { "exception" : "FileNotFoundException", "javaClassName": "java.io.FileNotFoundException", "message" : "File does not exist: /foo/a.patch" } }
除OPEN
外的所有操作,要么返回零长度响应,要么返回JSON响应。对于OPEN
,响应是八位字节流。JSON模式如下所示。有关JSON模式的语法定义,请参阅draft-zyp-json-schema-03。
注意,additionalProperties
的默认值是一个空模式,允许附加属性使用任何值。因此,所有WebHDFS JSON响应都允许任何附加属性。不过,如果响应中包含附加属性,为了保持兼容性,这些属性将被视为可选属性。
{ "name" : "AclStatus", "properties": { "AclStatus": { "type" : "object", "properties": { "entries": { "type": "array", "items": { "description": "ACL entry.", "type": "string" } }, "group": { "description": "The group owner.", "type" : "string", "required" : true }, "owner": { "description": "The user who is the owner.", "type" : "string", "required" : true }, "stickyBit": { "description": "True if the sticky bit is on.", "type" : "boolean", "required" : true } } } } }
{ "name" : "XAttrs", "properties": { "XAttrs": { "type" : "array", "items": { "type" : "object", "properties": { "name": { "description": "XAttr name.", "type" : "string", "required" : true }, "value": { "description": "XAttr value.", "type" : "string" } } } } } }
{ "name" : "XAttrNames", "properties": { "XAttrNames": { "description": "XAttr names.", "type" : "string", "required" : true } } }
{ "name" : "boolean", "properties": { "boolean": { "description": "A boolean value", "type" : "boolean", "required" : true } } }
另请参阅:MKDIRS
, RENAME
, DELETE
, SETREPLICATION
{ "name" : "ContentSummary", "properties": { "ContentSummary": { "type" : "object", "properties": { "directoryCount": { "description": "The number of directories.", "type" : "integer", "required" : true }, "fileCount": { "description": "The number of files.", "type" : "integer", "required" : true }, "length": { "description": "The number of bytes used by the content.", "type" : "integer", "required" : true }, "quota": { "description": "The namespace quota of this directory.", "type" : "integer", "required" : true }, "spaceConsumed": { "description": "The disk space consumed by the content.", "type" : "integer", "required" : true }, "spaceQuota": { "description": "The disk space quota.", "type" : "integer", "required" : true }, "typeQuota": { "type" : "object", "properties": { "ARCHIVE": { "type" : "object", "properties": { "consumed": { "description": "The storage type space consumed.", "type" : "integer", "required" : true }, "quota": { "description": "The storage type quota.", "type" : "integer", "required" : true } } }, "DISK": { "type" : "object", "properties": { "consumed": { "description": "The storage type space consumed.", "type" : "integer", "required" : true }, "quota": { "description": "The storage type quota.", "type" : "integer", "required" : true } } }, "SSD": { "type" : "object", "properties": { "consumed": { "description": "The storage type space consumed.", "type" : "integer", "required" : true }, "quota": { "description": "The storage type quota.", "type" : "integer", "required" : true } } } } } } } } }
另请参阅:GETCONTENTSUMMARY
{ "name" : "QuotaUsage", "properties": { "QuotaUsage": { "type" : "object", "properties": { "fileAndDirectoryCount": { "description": "The number of files and directories.", "type" : "integer", "required" : true }, "quota": { "description": "The namespace quota of this directory.", "type" : "integer", "required" : true }, "spaceConsumed": { "description": "The disk space consumed by the content.", "type" : "integer", "required" : true }, "spaceQuota": { "description": "The disk space quota.", "type" : "integer", "required" : true }, "typeQuota": { "type" : "object", "properties": { "ARCHIVE": { "type" : "object", "properties": { "consumed": { "description": "The storage type space consumed.", "type" : "integer", "required" : true }, "quota": { "description": "The storage type quota.", "type" : "integer", "required" : true } } }, "DISK": { "type" : "object", "properties": { "consumed": { "description": "The storage type space consumed.", "type" : "integer", "required" : true }, "quota": { "description": "The storage type quota.", "type" : "integer", "required" : true } } }, "SSD": { "type" : "object", "properties": { "consumed": { "description": "The storage type space consumed.", "type" : "integer", "required" : true }, "quota": { "description": "The storage type quota.", "type" : "integer", "required" : true } } } } } } } } }
另请参阅:GETQUOTAUSAGE
{ "name" : "FileChecksum", "properties": { "FileChecksum": { "type" : "object", "properties": { "algorithm": { "description": "The name of the checksum algorithm.", "type" : "string", "required" : true }, "bytes": { "description": "The byte sequence of the checksum in hexadecimal.", "type" : "string", "required" : true }, "length": { "description": "The length of the bytes (not the length of the string).", "type" : "integer", "required" : true } } } } }
{ "name" : "FileStatus", "properties": { "FileStatus": fileStatusProperties //See FileStatus Properties } }
另请参阅:FileStatus
属性, GETFILESTATUS
, FileStatus
使用JavaScript语法定义fileStatusProperties
,以便可以在FileStatus
和FileStatuses
JSON模式中引用它。
var fileStatusProperties = { "type" : "object", "properties": { "accessTime": { "description": "The access time.", "type" : "integer", "required" : true }, "blockSize": { "description": "The block size of a file.", "type" : "integer", "required" : true }, "group": { "description": "The group owner.", "type" : "string", "required" : true }, "length": { "description": "The number of bytes in a file.", "type" : "integer", "required" : true }, "modificationTime": { "description": "The modification time.", "type" : "integer", "required" : true }, "owner": { "description": "The user who is the owner.", "type" : "string", "required" : true }, "pathSuffix": { "description": "The path suffix.", "type" : "string", "required" : true }, "permission": { "description": "The permission represented as a octal string.", "type" : "string", "required" : true }, "replication": { "description": "The number of replication of a file.", "type" : "integer", "required" : true }, "symlink": //an optional property { "description": "The link target of a symlink.", "type" : "string" }, "type": { "description": "The type of the path object.", "enum" : ["FILE", "DIRECTORY", "SYMLINK"], "required" : true }, "aclBit": { "description": "Has ACLs set or not.", "type" : "boolean", }, "encBit": { "description": "Is Encrypted or not.", "type" : "boolean", }, "ecBit": { "description": "Is ErasureCoded or not.", "type" : "boolean", }, "ecPolicy": { "description": "The namenode of ErasureCodePolicy.", "type" : "String", } } };
一个FileStatuses
JSON对象表示一个由FileStatus
JSON对象组成的数组。
{ "name" : "FileStatuses", "properties": { "FileStatuses": { "type" : "object", "properties": { "FileStatus": { "description": "An array of FileStatus", "type" : "array", "items" : fileStatusProperties //See FileStatus Properties } } } } }
另请参阅:FileStatus
属性, LISTSTATUS
, FileStatus
一个DirectoryListing
JSON对象表示在迭代列出目录时的一批目录条目。它包含一个FileStatuses
JSON对象以及迭代信息。
{ "name" : "DirectoryListing", "properties": { "DirectoryListing": { "type" : "object", "properties": { "partialListing": { "description": "A partial directory listing", "type" : "object", // A FileStatuses object "required" : true }, "remainingEntries": { "description": "Number of remaining entries", "type" : "integer", "required" : true } } } } }
{ "name" : "long", "properties": { "long": { "description": "A long integer value", "type" : "integer", "required" : true } } }
另请参阅:RENEWDELEGATIONTOKEN
,
{ "name" : "Path", "properties": { "Path": { "description": "The string representation a Path.", "type" : "string", "required" : true } } }
另请参阅:GETHOMEDIRECTORY
, Path
{ "name" : "RemoteException", "properties": { "RemoteException": { "type" : "object", "properties": { "exception": { "description": "Name of the exception", "type" : "string", "required" : true }, "message": { "description": "Exception message", "type" : "string", "required" : true }, "javaClassName": //an optional property { "description": "Java class name of the exception", "type" : "string" } } } } }
另请参阅:Error Responses
{ "name" : "Token", "properties": { "Token": tokenProperties //See Token Properties } }
另请参阅:Token
Properties, GETDELEGATIONTOKEN
, Delegation中的说明。
使用JavaScript语法定义tokenProperties
,以便可以在Token
JSON模式中引用它。
var tokenProperties = { "type" : "object", "properties": { "urlString": { "description": "A delegation token encoded as a URL safe string.", "type" : "string", "required" : true } } }
另请参阅:Token
Properties,以及Delegation中的说明。
{ "name" : "BlockStoragePolicy", "properties": { "BlockStoragePolicy": blockStoragePolicyProperties //See BlockStoragePolicy Properties } }
另请参阅:BlockStoragePolicy
属性, GETSTORAGEPOLICY
使用JavaScript语法定义blockStoragePolicyProperties
,以便可以在BlockStoragePolicy
和BlockStoragePolicies
JSON模式中引用它。
var blockStoragePolicyProperties = { "type" : "object", "properties": { "id": { "description": "Policy ID.", "type" : "integer", "required" : true }, "name": { "description": "Policy name.", "type" : "string", "required" : true }, "storageTypes": { "description": "An array of storage types for block placement.", "type" : "array", "required" : true "items" : { "type": "string" } }, "replicationFallbacks": { "description": "An array of fallback storage types for replication.", "type" : "array", "required" : true "items" : { "type": "string" } }, "creationFallbacks": { "description": "An array of fallback storage types for file creation.", "type" : "array", "required" : true "items" : { "type": "string" } }, "copyOnCreateFile": { "description": "If set then the policy cannot be changed after file creation.", "type" : "boolean", "required" : true } } };
{ "name": "RS-10-4-1024k", schema { "codecName": "rs", "numDataUnits": 10, "numParityUnits": 4, "extraOptions": {} } "cellSize": 1048576, "id":5, "codecname":"rs", "numDataUnits": 10, "numParityUnits": 4, "replicationpolicy":false, "systemPolicy":true }
一个BlockStoragePolicies
JSON对象表示一个由BlockStoragePolicy
JSON对象组成的数组。
{ "name" : "BlockStoragePolicies", "properties": { "BlockStoragePolicies": { "type" : "object", "properties": { "BlockStoragePolicy": { "description": "An array of BlockStoragePolicy", "type" : "array", "items" : blockStoragePolicyProperties //See BlockStoragePolicy Properties } } } } }
{ "name": "SnapshotDiffReport", "type": "object", "properties": { "SnapshotDiffReport": { "type" : "object", "properties" : { "diffList": { "description": "An array of DiffReportEntry", "type" : "array", "items" : diffReportEntries, "required" : true }, "fromSnapshot": { "description": "Source snapshot", "type" : "string", "required" : true }, "snapshotRoot": { "description" : "String representation of snapshot root path", "type" : "string", "required" : true }, "toSnapshot": { "description" : "Destination snapshot", "type" : "string", "required" : true } } } } }
使用JavaScript语法定义diffReportEntries
,以便可以在SnapshotDiffReport
JSON模式中引用它。
var diffReportEntries = { "type": "object", "properties": { "sourcePath": { "description" : "Source path name relative to snapshot root", "type" : "string", "required" : true }, "targetPath": { "description" : "Target path relative to snapshot root used for renames", "type" : "string", "required" : true }, "type": { "description" : "Type of diff report entry", "enum" : ["CREATE", "MODIFY", "DELETE", "RENAME"], "required" : true } } }
{ "name": "SnapshotDiffReportListing", "type": "object", "properties": { "SnapshotDiffReportListing": { "type" : "object", "properties" : { "isFromEarlier": { "description" : "the diff is calculated from older to newer snapshot or not", "type" : "boolean", "required" : true }, "lastIndex": { "description" : "the last index of listing iteration", "type" : "integer", "required" : true }, "lastPath": { "description" : "String representation of the last path of the listing iteration", "type" : "string", "required" : true }, "modifyList": { "description": "An array of DiffReportListingEntry", "type" : "array", "items" : diffReportListingEntries, "required" : true }, "createList": { "description": "An array of DiffReportListingEntry", "type" : "array", "items" : diffReportListingEntries, "required" : true }, "deleteList": { "description": "An array of DiffReportListingEntry", "type" : "array", "items" : diffReportListingEntries, "required" : true } } } } }
使用JavaScript语法定义diffReportEntries
,以便可以在SnapshotDiffReport
JSON模式中引用它。
var diffReportListingEntries = { "type": "object", "properties": { "dirId": { "description" : "inode id of the directory", "type" : "integer", "required" : true }, "fileId": { "description" : "inode id of the file", "type" : "integer", "required" : true }, "isRereference": { "description" : "this is reference or not", "type" : "boolean", "required" : true }, "sourcePath": { "description" : "string representation of path where changes have happened", "type" : "string", "required" : true }, "targetPath": { "description" : "string representation of target path of rename op", "type" : "string", "required" : false } } }
{ "name": "SnapshottableDirectoryList", "type": "object", "properties": { "SnapshottableDirectoryList": { "description": "An array of SnapshottableDirectoryStatus", "type" : "array", "items" : snapshottableDirectoryStatus, "required" : true } } }
使用JavaScript语法定义snapshottableDirectoryStatus
,以便可以在SnapshottableDirectoryList
JSON模式中引用它。
var snapshottableDirectoryStatus = { "type": "object", "properties": { "dirStatus": fileStatusProperties, "parentFullPath": { "description" : "Full path of the parent of snapshottable directory", "type" : "string", "required" : true }, "snapshotNumber": { "description" : "Number of snapshots created on the snapshottable directory", "type" : "integer", "required" : true }, "snapshotQuota": { "description" : "Total number of snapshots allowed on the snapshottable directory", "type" : "integer", "required" : true } } }
{ "name": "SnapshotList", "type": "object", "properties": { "SnapshotList": { "description": "An array of SnapshotStatus", "type" : "array", "items" : snapshotStatus, "required" : true } } }
使用JavaScript语法定义snapshotStatus
,以便可以在SnapshotList
JSON模式中引用它。
var snapshotStatus = { "type": "object", "properties": { "dirStatus": fileStatusProperties, "fullPath": { "description" : "Full path of the parent of the snapshot", "type" : "string", "required" : true }, "snapshotID": { "description" : "snapshot ID for the snapshot", "type" : "integer", "required" : true }, "deletionStatus": { "description" : "Status showing whether the snapshot is active or in deleted state", "type" : "string", "required" : true } } }
一个BlockLocations
JSON对象表示一个由BlockLocation
JSON对象组成的数组。
{ "name" : "BlockLocations", "properties": { "BlockLocations": { "type" : "object", "properties": { "BlockLocation": { "description": "An array of BlockLocation", "type" : "array", "items" : blockLocationProperties //See BlockLocation Properties } } } } }
{ "name" : "BlockLocation", "properties": { "BlockLocation": blockLocationProperties //See BlockLocation Properties } }
另请参阅 BlockLocation
Properties, GETFILEBLOCKLOCATIONS
, BlockLocation
使用JavaScript语法定义blockLocationProperties
,以便可以在BlockLocation
和BlockLocations
的JSON模式中引用它。
var blockLocationProperties = { "type" : "object", "properties": { "cachedHosts": { "description": "Datanode hostnames with a cached replica", "type" : "array", "required" : "true", "items" : { "description": "A datanode hostname", "type" : "string" } }, "corrupt": { "description": "True if the block is corrupted", "type" : "boolean", "required" : "true" }, "hosts": { "description": "Datanode hostnames store the block", "type" : "array", "required" : "true", "items" : { "description": "A datanode hostname", "type" : "string" } }, "length": { "description": "Length of the block", "type" : "integer", "required" : "true" }, "names": { "description": "Datanode IP:xferPort for accessing the block", "type" : "array", "required" : "true", "items" : { "description": "DatanodeIP:xferPort", "type" : "string" } }, "offset": { "description": "Offset of the block in the file", "type" : "integer", "required" : "true" }, "storageTypes": { "description": "Storage type of each replica", "type" : "array", "required" : "true", "items" : { "description": "Storage type", "enum" : ["RAM_DISK", "SSD", "DISK", "ARCHIVE"] } }, "topologyPaths": { "description": "Datanode addresses in network topology", "type" : "array", "required" : "true", "items" : { "description": "/rack/host:ip", "type" : "string" } } } };
{ "FsServerDefaults": { "replication": 3, "encryptDataTransfer": false, "defaultStoragePolicyId": 7, "writePacketSize": 65536, "fileBufferSize": 4096, "checksumType": 2, "trashInterval": 10080, "keyProviderUri": "", "blockSize": 134217728, "bytesPerChecksum": 512 } }
{ "FsStatus": { "used": 29229154304, "remaining": 292893392896, "capacity": 322122547200 } }
{ "ErasureCodingPolicies": { "ErasureCodingPolicyInfo": [ { "state": "ENABLED", "policy": { "name": "RS-6-3-1024k", "schema": { "codecName": "rs", "numDataUnits": 6, "numParityUnits": 3, "extraOptions": {} }, "cellSize": 1048576, "id": 1, "replicationPolicy": false, "codecName": "rs", "numDataUnits": 6, "numParityUnits": 3, "systemPolicy": true } } ] } }
{ "ErasureCodingCodecs": { "rs": "rs_native, rs_java", "rs-legacy": "rs-legacy_java", "xor": "xor_native, xor_java" } }
{ "Paths": [{ "blocksize": 0, "owner": "hadoop", "path": "/user/user0/.Trash", "length": 0, "permission": "755", "modification_time": 1693050205747, "isdir": true, "block_replication": 0, "access_time": 0, "group": "supergroup" }] }
Name | aclspec |
---|---|
描述 | ACL修改操作中包含的ACL规范。 |
类型 | 字符串 |
默认值 | |
有效值 | 参见 Permissions and HDFS。 |
语法 | 参见 Permissions and HDFS。 |
Name | xattr.name |
---|---|
描述 | 文件/目录的XAttr名称。 |
类型 | 字符串 |
默认值 | |
有效值 | 任何以 user./trusted./system./security. 开头的字符串 |
语法 | 任何以user./trusted./system./security..为前缀的字符串 |
Name | xattr.value |
---|---|
描述 | 文件/目录的XAttr属性值。 |
类型 | 字符串 |
默认值 | |
有效值 | 编码后的值。 |
语法 | 用双引号括起来或以0x或0s为前缀。 |
另请参阅:Extended Attributes
Name | flag |
---|---|
描述 | XAttr 设置标志。 |
类型 | 字符串 |
默认值 | |
有效值 | CREATE,REPLACE. |
语法 | CREATE,REPLACE. |
另请参阅:Extended Attributes
Name | encoding | ||
---|---|---|---|
描述 | XAttr值的编码方式。 | ||
类型 | 字符串 | ||
默认值 | | ||
有效值 | text | hex | base64 |
语法 | 文本 | 十六进制 | base64 |
另请参阅:Extended Attributes
Name | accesstime |
---|---|
描述 | 文件/目录的访问时间。 |
类型 | long |
默认值 | -1 (表示保持不变) |
有效值 | -1 或时间戳 |
语法 | 任意整数。 |
另请参阅:SETTIMES
Name | blocksize |
---|---|
描述 | 文件的块大小。 |
类型 | long |
默认值 | 在配置中指定。 |
有效值 | > 0 |
语法 | 任意整数。 |
另请参阅:CREATE
Name | buffersize |
---|---|
描述 | 数据传输过程中使用的缓冲区大小。 |
类型 | int |
默认值 | 在配置中指定。 |
有效值 | > 0 |
语法 | 任意整数。 |
Name | createflag |
---|---|
描述 | 创建文件时可处理的标志枚举 |
类型 | 枚举字符串 |
默认值 | <empty> |
有效值 | create、overwrite、append 和 sync_block 的合法组合 |
语法 | 参见下方说明 |
以下组合无效:* append,create * create,append,overwrite
另请参阅:CREATE
Name | createparent |
---|---|
描述 | 如果父目录不存在,是否应该创建它们? |
类型 | boolean |
默认值 | true |
有效值 | true, false |
语法 | true |
另请参阅: CREATESYMLINK
Name | delegation |
---|---|
描述 | 用于身份验证的委托令牌。 |
类型 | 字符串 |
默认值 | <empty> |
有效值 | 一个编码令牌。 |
语法 | 请参阅下面的说明。 |
注意委托令牌被编码为URL安全字符串;有关编码的详细信息,请参阅org.apache.hadoop.security.token.Token
中的encodeToUrlString()
和decodeFromUrlString(String)
方法。
另请参阅:Authentication
Name | destination |
---|---|
描述 | 目标路径。 |
类型 | 路径 |
默认值 | |
有效值 | 不带方案和权限的绝对文件系统路径。 |
语法 | 任意路径。 |
另请参阅: CREATESYMLINK
, RENAME
Name | doas |
---|---|
描述 | 允许代理用户以另一个用户的身份执行操作。 |
类型 | 字符串 |
默认值 | null |
有效值 | 任何有效的用户名。 |
语法 | 任意字符串。 |
另请参阅:Proxy Users
Name | fsaction |
---|---|
描述 | 文件系统操作 读/写/执行 |
类型 | 字符串 |
默认值 | null (无效值) |
有效值 | 符合正则表达式模式 "[r-][w-][x-]" 的字符串 |
语法 | "[r-][w-][x-] " |
另请参阅:CHECKACCESS
,
Name | group |
---|---|
描述 | 组的名称。 |
类型 | 字符串 |
默认值 | |
有效值 | 任何有效的组名称。 |
语法 | 任意字符串。 |
另请参阅:SETOWNER
Name | length |
---|---|
描述 | 要处理的字节数。 |
类型 | long |
默认值 | null (表示整个文件) |
有效值 | >= 0 或 null |
语法 | 任意整数。 |
另请参阅:OPEN
Name | modificationtime |
---|---|
描述 | 文件/目录的修改时间。 |
类型 | long |
默认值 | -1 (表示保持不变) |
有效值 | -1 或时间戳 |
语法 | 任意整数。 |
另请参阅:SETTIMES
Name | newlength |
---|---|
描述 | 文件将被截断到的大小。 |
类型 | long |
有效值 | >= 0 |
语法 | 任意长度。 |
Name | offset |
---|---|
描述 | 起始字节位置。 |
类型 | long |
默认值 | 0 |
有效值 | >= 0 |
语法 | 任意整数。 |
另请参阅:OPEN
Name | oldsnapshotname |
---|---|
描述 | 待重命名的旧快照名称。 |
类型 | 字符串 |
默认值 | null |
有效值 | 一个已存在的快照名称。 |
语法 | 任意字符串。 |
另请参阅:RENAMESNAPSHOT
Name | op |
---|---|
描述 | 要执行的操作名称。 |
类型 | 枚举 |
默认值 | null (无效值) |
有效值 | 任何有效的操作名称。 |
语法 | 任意字符串。 |
另请参阅:Operations
Name | overwrite |
---|---|
描述 | 如果文件已存在,是否应覆盖? |
类型 | boolean |
默认值 | false |
有效值 | true |
语法 | true |
另请参阅:CREATE
Name | owner |
---|---|
描述 | 文件/目录所有者的用户名。 |
类型 | 字符串 |
默认值 | |
有效值 | 任何有效的用户名。 |
语法 | 任意字符串。 |
另请参阅:SETOWNER
Name | permission |
---|---|
描述 | 文件/目录的权限。 |
类型 | 八进制 |
默认值 | 文件644,目录755 |
有效值 | 0 - 1777 |
语法 | 任何基数为8的整数(前导零可以省略。) |
另请参阅: CREATE
, MKDIRS
, SETPERMISSION
Name | recursive |
---|---|
描述 | 该操作是否应对子目录中的内容生效? |
类型 | boolean |
默认值 | false |
有效值 | true |
语法 | true |
另请参阅:RENAME
Name | renewer |
---|---|
描述 | 委托令牌续订者的用户名。 |
类型 | 字符串 |
默认值 | |
有效值 | 任何有效的用户名。 |
语法 | 任意字符串。 |
另请参阅:GETDELEGATIONTOKEN
Name | replication |
---|---|
描述 | 文件的副本数量。 |
类型 | short |
默认值 | 在配置中指定。 |
有效值 | > 0 |
语法 | 任意整数。 |
另请参阅: CREATE
, SETREPLICATION
Name | snapshotname |
---|---|
描述 | 要创建/删除的快照名称。或用于重命名快照的新名称。 |
类型 | 字符串 |
默认值 | null |
有效值 | 任何有效的快照名称。 |
语法 | 任意字符串。 |
Name | sources |
---|---|
描述 | 源路径列表。 |
类型 | 字符串 |
默认值 | <empty> |
有效值 | 以逗号分隔的绝对文件系统路径列表,不包含方案和授权信息。 |
语法 | 任意字符串。 |
另请参阅:CONCAT
Name | token |
---|---|
描述 | 用于操作的代表令牌。 |
类型 | 字符串 |
默认值 | <empty> |
有效值 | 一个编码令牌。 |
语法 | 请参阅Delegation中的说明。 |
Name | kind |
---|---|
描述 | 请求的委托令牌类型 |
类型 | 字符串 |
默认值 | |
有效值 | 表示令牌类型的字符串,例如 "HDFS_DELEGATION_TOKEN" 或 "WEBHDFS delegation" |
语法 | 任意字符串。 |
另请参阅:GETDELEGATIONTOKEN
Name | service |
---|---|
描述 | 令牌预期使用的服务名称,例如namenode的ip:端口 |
类型 | 字符串 |
默认值 | <empty> |
有效值 | 字符串格式的ip:port或服务的逻辑名称 |
语法 | 任意字符串。 |
另请参阅:GETDELEGATIONTOKEN
Name | user.name |
---|---|
描述 | 已认证的用户;参见 Authentication。 |
类型 | 字符串 |
默认值 | null |
有效值 | 任何有效的用户名。 |
语法 | 任意字符串。 |
另请参阅:Authentication
Name | noredirect |
---|---|
描述 | 响应应返回HTTP 307重定向还是HTTP 200 OK。参见Create and Write to a File。 |
类型 | boolean |
默认值 | false |
有效值 | true |
语法 | true |
Name | namespacequota |
---|---|
描述 | 目录下命名空间使用量的限制,即文件/目录的数量。 |
类型 | 字符串 |
默认值 | Long.MAX_VALUE |
有效值 | > 0. |
语法 | 任意整数。 |
另请参阅:SETQUOTA
Name | storagespacequota |
---|---|
描述 | 目录下存储空间使用限制(以字节为单位,包括副本)。 |
类型 | 字符串 |
默认值 | Long.MAX_VALUE |
有效值 | > 0. |
语法 | 任意整数。 |
Name | storagetype |
---|---|
描述 | 待修改的特定存储类型配额的存储类型。 |
类型 | 字符串 |
默认值 | <empty> |
有效值 | 任何有效的存储类型。 |
语法 | 任意字符串。 |
Name | storagepolicy |
---|---|
描述 | 存储策略的名称。 |
类型 | 字符串 |
默认值 | <empty> |
有效值 | 任何有效的存储策略名称;参见 GETALLSTORAGEPOLICY。 |
语法 | 任意字符串。 |
另请参阅:SETSTORAGEPOLICY
Name | ecpolicy |
---|---|
描述 | 擦除编码策略的名称。 |
类型 | 字符串 |
默认值 | <empty> |
有效值 | 任何有效的擦除编码策略名称; |
语法 | 任意字符串。 |
另请参阅:ENABLEECPOLICY
或 DISABLEECPOLICY
Name | startAfter |
---|---|
描述 | 列表状态批次中返回的最后一项。 |
类型 | 字符串 |
默认值 | <empty> |
有效值 | 任何有效的文件/目录名称。 |
语法 | 任意字符串。 |
另请参阅:LISTSTATUS_BATCH