|
@@ -52,6 +52,10 @@ WebHDFS REST API
|
|
|
* [Set ACL](#Set_ACL)
|
|
|
* [Get ACL Status](#Get_ACL_Status)
|
|
|
* [Check access](#Check_access)
|
|
|
+ * [Get all Storage Policies](#Get_all_Storage_Policies)
|
|
|
+ * [Set Storage Policy](#Set_Storage_Policy)
|
|
|
+ * [Unset Storage Policy](#Unset_Storage_Policy)
|
|
|
+ * [Get Storage Policy](#Get_Storage_Policy)
|
|
|
* [Extended Attributes(XAttrs) Operations](#Extended_AttributesXAttrs_Operations)
|
|
|
* [Set XAttr](#Set_XAttr)
|
|
|
* [Remove XAttr](#Remove_XAttr)
|
|
@@ -88,6 +92,9 @@ WebHDFS REST API
|
|
|
* [RemoteException JSON Schema](#RemoteException_JSON_Schema)
|
|
|
* [Token JSON Schema](#Token_JSON_Schema)
|
|
|
* [Token Properties](#Token_Properties)
|
|
|
+ * [BlockStoragePolicy JSON Schema](#BlockStoragePolicy_JSON_Schema)
|
|
|
+ * [BlockStoragePolicy Properties](#BlockStoragePolicy_Properties)
|
|
|
+ * [BlockStoragePolicies JSON Schema](#BlockStoragePolicies_JSON_Schema)
|
|
|
* [HTTP Query Parameter Dictionary](#HTTP_Query_Parameter_Dictionary)
|
|
|
* [ACL Spec](#ACL_Spec)
|
|
|
* [XAttr Name](#XAttr_Name)
|
|
@@ -121,6 +128,7 @@ WebHDFS REST API
|
|
|
* [Token Kind](#Token_Kind)
|
|
|
* [Token Service](#Token_Service)
|
|
|
* [Username](#Username)
|
|
|
+ * [Storage Policy](#Storage_Policy)
|
|
|
|
|
|
Document Conventions
|
|
|
--------------------
|
|
@@ -151,6 +159,8 @@ The HTTP REST API supports the complete [FileSystem](../../api/org/apache/hadoop
|
|
|
* [`GETXATTRS`](#Get_all_XAttrs) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getXAttrs)
|
|
|
* [`LISTXATTRS`](#List_all_XAttrs) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).listXAttrs)
|
|
|
* [`CHECKACCESS`](#Check_access) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).access)
|
|
|
+ * [`GETALLSTORAGEPOLICY`](#Get_all_Storage_Policies) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getAllStoragePolicies)
|
|
|
+ * [`GETSTORAGEPOLICY`](#Get_Storage_Policy) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getStoragePolicy)
|
|
|
* HTTP PUT
|
|
|
* [`CREATE`](#Create_and_Write_to_a_File) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).create)
|
|
|
* [`MKDIRS`](#Make_a_Directory) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).mkdirs)
|
|
@@ -166,10 +176,12 @@ The HTTP REST API supports the complete [FileSystem](../../api/org/apache/hadoop
|
|
|
* [`RENAMESNAPSHOT`](#Rename_Snapshot) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).renameSnapshot)
|
|
|
* [`SETXATTR`](#Set_XAttr) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).setXAttr)
|
|
|
* [`REMOVEXATTR`](#Remove_XAttr) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).removeXAttr)
|
|
|
+ * [`SETSTORAGEPOLICY`](#Set_Storage_Policy) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).setStoragePolicy)
|
|
|
* HTTP POST
|
|
|
* [`APPEND`](#Append_to_a_File) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).append)
|
|
|
* [`CONCAT`](#Concat_Files) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).concat)
|
|
|
* [`TRUNCATE`](#Truncate_a_File) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).truncate)
|
|
|
+ * [`UNSETSTORAGEPOLICY`](#Unset_Storage_Policy) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).unsetStoragePolicy)
|
|
|
* HTTP DELETE
|
|
|
* [`DELETE`](#Delete_a_FileDirectory) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).delete)
|
|
|
* [`DELETESNAPSHOT`](#Delete_Snapshot) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).deleteSnapshot)
|
|
@@ -830,6 +842,129 @@ See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getAclSta
|
|
|
|
|
|
See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).access
|
|
|
|
|
|
+Storage Policy Operations
|
|
|
+-------------------------
|
|
|
+
|
|
|
+### Get all Storage Policies
|
|
|
+
|
|
|
+* Submit a HTTP GET request.
|
|
|
+
|
|
|
+ curl -i "http://<HOST>:<PORT>/webhdfs/v1?op=GETALLSTORAGEPOLICY"
|
|
|
+
|
|
|
+ The client receives a response with a [`BlockStoragePolicies` JSON object](#BlockStoragePolicies_JSON_Schema):
|
|
|
+
|
|
|
+ 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": true,
|
|
|
+ "creationFallbacks": ["DISK"],
|
|
|
+ "id": 15,
|
|
|
+ "name": "LAZY_PERSIST",
|
|
|
+ "replicationFallbacks": ["DISK"],
|
|
|
+ "storageTypes": ["RAM_DISK","DISK"]
|
|
|
+ }
|
|
|
+ ]
|
|
|
++ }
|
|
|
+ }
|
|
|
+
|
|
|
+See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getAllStoragePolicies
|
|
|
+
|
|
|
+### Set Storage Policy
|
|
|
+
|
|
|
+* Submit a HTTP PUT request.
|
|
|
+
|
|
|
+ curl -i -X PUT "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=SETSTORAGEPOLICY
|
|
|
+ &storagepolicy=<policy>"
|
|
|
+
|
|
|
+ The client receives a response with zero content length:
|
|
|
+
|
|
|
+ HTTP/1.1 200 OK
|
|
|
+ Content-Length: 0
|
|
|
+
|
|
|
+See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).setStoragePolicy
|
|
|
+
|
|
|
+### Unset Storage Policy
|
|
|
+
|
|
|
+* Submit a HTTP POT request.
|
|
|
+
|
|
|
+ curl -i -X POST "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=UNSETSTORAGEPOLICY"
|
|
|
+
|
|
|
+ The client receives a response with zero content length:
|
|
|
+
|
|
|
+ HTTP/1.1 200 OK
|
|
|
+ Content-Length: 0
|
|
|
+
|
|
|
+See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).unsetStoragePolicy
|
|
|
+
|
|
|
+### Get Storage Policy
|
|
|
+
|
|
|
+* Submit a HTTP GET request.
|
|
|
+
|
|
|
+ curl -i "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=GETSTORAGEPOLICY"
|
|
|
+
|
|
|
+ The client receives a response with a [`BlockStoragePolicy` JSON object](#BlockStoragePolicy_JSON_Schema):
|
|
|
+
|
|
|
+ HTTP/1.1 200 OK
|
|
|
+ Content-Type: application/json
|
|
|
+ Transfer-Encoding: chunked
|
|
|
+
|
|
|
+ {
|
|
|
+ "BlockStoragePolicy": {
|
|
|
+ "copyOnCreateFile": false,
|
|
|
+ "creationFallbacks": [],
|
|
|
+ "id":7,
|
|
|
+ "name":"HOT",
|
|
|
+ "replicationFallbacks":["ARCHIVE"],
|
|
|
+ "storageTypes":["DISK"]
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getStoragePolicy
|
|
|
+
|
|
|
Extended Attributes(XAttrs) Operations
|
|
|
--------------------------------------
|
|
|
|
|
@@ -1651,6 +1786,108 @@ var tokenProperties =
|
|
|
|
|
|
See also: [`Token` Properties](#Token_Properties), the note in [Delegation](#Delegation).
|
|
|
|
|
|
+### BlockStoragePolicy JSON Schema
|
|
|
+
|
|
|
+```json
|
|
|
+{
|
|
|
+ "name" : "BlockStoragePolicy",
|
|
|
+ "properties":
|
|
|
+ {
|
|
|
+ "BlockStoragePolicy": blockStoragePolicyProperties //See BlockStoragePolicy Properties
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+See also: [`BlockStoragePolicy` Properties](#BlockStoragePolicy_Properties), [`GETSTORAGEPOLICY`](#Get_Storage_Policy)
|
|
|
+
|
|
|
+#### BlockStoragePolicy Properties
|
|
|
+
|
|
|
+JavaScript syntax is used to define `blockStoragePolicyProperties` so that it can be referred in both `BlockStoragePolicy` and `BlockStoragePolicies` JSON schemas.
|
|
|
+
|
|
|
+```javascript
|
|
|
+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
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+```
|
|
|
+
|
|
|
+### BlockStoragePolicies JSON Schema
|
|
|
+
|
|
|
+A `BlockStoragePolicies` JSON object represents an array of `BlockStoragePolicy` JSON objects.
|
|
|
+
|
|
|
+```json
|
|
|
+{
|
|
|
+ "name" : "BlockStoragePolicies",
|
|
|
+ "properties":
|
|
|
+ {
|
|
|
+ "BlockStoragePolicies":
|
|
|
+ {
|
|
|
+ "type" : "object",
|
|
|
+ "properties":
|
|
|
+ {
|
|
|
+ "BlockStoragePolicy":
|
|
|
+ {
|
|
|
+ "description": "An array of BlockStoragePolicy",
|
|
|
+ "type" : "array",
|
|
|
+ "items" : blockStoragePolicyProperties //See BlockStoragePolicy Properties
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
HTTP Query Parameter Dictionary
|
|
|
-------------------------------
|
|
|
|
|
@@ -2048,3 +2285,15 @@ See also: [`GETDELEGATIONTOKEN`](#Get_Delegation_Token)
|
|
|
| Syntax | Any string. |
|
|
|
|
|
|
See also: [Authentication](#Authentication)
|
|
|
+
|
|
|
+### Storage Policy
|
|
|
+
|
|
|
+| Name | `storagepolicy` |
|
|
|
+|:---- |:---- |
|
|
|
+| Description | The name of the storage policy. |
|
|
|
+| Type | String |
|
|
|
+| Default Value | \<empty\> |
|
|
|
+| Valid Values | Any valid storage policy name; see [GETALLSTORAGEPOLICY](#Get_all_Storage_Policies). |
|
|
|
+| Syntax | Any string. |
|
|
|
+
|
|
|
+See also: [`SETSTORAGEPOLICY`](#Set_Storage_Policy)
|