Recon API

The Recon API v1 is a set of HTTP endpoints that help you understand the current state of an Ozone cluster and to troubleshoot if needed.

Endpoints that are marked as admin only can only be accessed by Kerberos users specified in the ozone.administrators or ozone.recon.administrators configurations of a secure cluster. See Securing Ozone for more information. To restrict access to these endpoints, set the following configurations:

PropertyValue
ozone.security.enabledtrue
ozone.security.http.kerberos.enabledtrue
ozone.acl.enabledtrue

Checkout an interactive version of the API powered by Swagger here

Containers (admin only)

GET /api/v1/containers

Parameters

  • prevKey (optional)

    Only returns the containers with ID greater than the given prevKey. Example: prevKey=1

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns all the ContainerMetadata objects.

  1. {
  2. "data": {
  3. "totalCount": 3,
  4. "containers": [
  5. {
  6. "ContainerID": 1,
  7. "NumberOfKeys": 834
  8. },
  9. {
  10. "ContainerID": 2,
  11. "NumberOfKeys": 833
  12. },
  13. {
  14. "ContainerID": 3,
  15. "NumberOfKeys": 833
  16. }
  17. ]
  18. }
  19. }

GET /api/v1/containers/:id/keys

Parameters

  • prevKey (optional)

    Only returns the keys that are present after the given prevKey key prefix. Example: prevKey=/vol1/bucket1/key1

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns all the KeyMetadata objects for the given ContainerID.

  1. {
  2. "totalCount":7,
  3. "keys": [
  4. {
  5. "Volume":"vol-1-73141",
  6. "Bucket":"bucket-3-35816",
  7. "Key":"key-0-43637",
  8. "DataSize":1000,
  9. "Versions":[0],
  10. "Blocks": {
  11. "0": [
  12. {
  13. "containerID":1,
  14. "localID":105232659753992201
  15. }
  16. ]
  17. },
  18. "CreationTime":"2020-11-18T18:09:17.722Z",
  19. "ModificationTime":"2020-11-18T18:09:30.405Z"
  20. },
  21. ...
  22. ]
  23. }

GET /api/v1/containers/missing

Parameters

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns the MissingContainerMetadata objects for all the missing containers.

  1. {
  2. "totalCount": 26,
  3. "containers": [{
  4. "containerID": 1,
  5. "missingSince": 1605731029145,
  6. "keys": 7,
  7. "pipelineID": "88646d32-a1aa-4e1a",
  8. "replicas": [{
  9. "containerId": 1,
  10. "datanodeHost": "localhost-1",
  11. "firstReportTimestamp": 1605724047057,
  12. "lastReportTimestamp": 1605731201301
  13. },
  14. ...
  15. ]
  16. },
  17. ...
  18. ]
  19. }

GET /api/v1/containers/:id/replicaHistory

Parameters

No parameters.

Returns

Returns all the ContainerHistory objects for the given ContainerID.

  1. [
  2. {
  3. "containerId": 1,
  4. "datanodeHost": "localhost-1",
  5. "firstReportTimestamp": 1605724047057,
  6. "lastReportTimestamp": 1605730421294
  7. },
  8. ...
  9. ]

GET /api/v1/containers/unhealthy

Parameters

  • batchNum (optional)

    The batch number (like “page number”) of results to return. Passing 1, will return records 1 to limit. 2 will return limit + 1 to 2 * limit, etc.

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns the UnhealthyContainerMetadata objects for all the unhealthycontainers.

  1. {
  2. "missingCount": 2,
  3. "underReplicatedCount": 0,
  4. "overReplicatedCount": 0,
  5. "misReplicatedCount": 0,
  6. "containers": [{
  7. "containerID": 1,
  8. "containerState": "MISSING",
  9. "unhealthySince": 1605731029145,
  10. "expectedReplicaCount": 3,
  11. "actualReplicaCount": 0,
  12. "replicaDeltaCount": 3,
  13. "reason": null,
  14. "keys": 7,
  15. "pipelineID": "88646d32-a1aa-4e1a",
  16. "replicas": [{
  17. "containerId": 1,
  18. "datanodeHost": "localhost-1",
  19. "firstReportTimestamp": 1605722960125,
  20. "lastReportTimestamp": 1605731230509
  21. },
  22. ...
  23. ]
  24. },
  25. ...
  26. ]
  27. }

GET /api/v1/containers/unhealthy/:state

Parameters

  • batchNum (optional)

    The batch number (like “page number”) of results to return. Passing 1, will return records 1 to limit. 2 will return limit + 1 to 2 * limit, etc.

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns the UnhealthyContainerMetadata objects for the containers in the given state. Possible unhealthy container states are MISSING, MIS_REPLICATED,UNDER_REPLICATED, OVER_REPLICATED. The response structure is same as /containers/unhealthy.

GET /api/v1/containers/mismatch

Returns

Returns the list of mis-matched containers between OM and SCM

  • Containers are present in OM, but not in SCM.
  • Containers are present in SCM, but not in OM.
  1. [
  2. {
  3. "containerId" : 1,
  4. "numberOfKeys" : 3,
  5. "pipelines" : [
  6. "pipelineId" : "1423ghjds832403232",
  7. "pipelineId" : "32vds94943fsdh4443",
  8. "pipelineId" : "32vds94943fsdhs443"
  9. ],
  10. "existsAt" : "OM"
  11. }
  12. ...
  13. ]

GET /api/v1/containers/mismatch/deleted

Parameters

  • prevKey (optional)

    Returns the set of deleted containers in SCM which are present in OM to find out list of keys mapped to such DELETED state containers after the given prevKey (ContainerId). Example: prevKey=5, skip containers till it seeks correctly to the previous containerId.

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns the set of deleted containers in SCM which are present in OM to find out list of keys mapped to such DELETED state containers.

  1. [
  2. {
  3. "containerId": 2,
  4. "numberOfKeys": 2,
  5. "pipelines": []
  6. }
  7. ...
  8. ]

GET /api/v1/keys/open

Parameters

  • prevKey (optional)

    Returns the set of keys/files which are open and present after the given prevKey id. Example: prevKey=/vol1/bucket1/key1, this will skip keys till it seeks correctly to the given prevKey.

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns set of keys/files which are open.

  1. {
  2. "lastKey": "/vol1/fso-bucket/dir1/dir2/file2",
  3. "replicatedTotal": 13824,
  4. "unreplicatedTotal": 4608,
  5. "entities": [
  6. {
  7. "path": "/vol1/bucket1/key1",
  8. "keyState": "Open",
  9. "inStateSince": 1667564193026,
  10. "size": 1024,
  11. "replicatedSize": 3072,
  12. "unreplicatedSize": 1024,
  13. "replicationType": "RATIS",
  14. "replicationFactor": "THREE"
  15. },
  16. {
  17. "path": "/vol1/bucket1/key2",
  18. "keyState": "Open",
  19. "inStateSince": 1667564193026,
  20. "size": 512,
  21. "replicatedSize": 1536,
  22. "unreplicatedSize": 512,
  23. "replicationType": "RATIS",
  24. "replicationFactor": "THREE"
  25. },
  26. {
  27. "path": "/vol1/fso-bucket/dir1/file1",
  28. "keyState": "Open",
  29. "inStateSince": 1667564193026,
  30. "size": 1024,
  31. "replicatedSize": 3072,
  32. "unreplicatedSize": 1024,
  33. "replicationType": "RATIS",
  34. "replicationFactor": "THREE"
  35. },
  36. {
  37. "path": "/vol1/fso-bucket/dir1/dir2/file2",
  38. "keyState": "Open",
  39. "inStateSince": 1667564193026,
  40. "size": 2048,
  41. "replicatedSize": 6144,
  42. "unreplicatedSize": 2048,
  43. "replicationType": "RATIS",
  44. "replicationFactor": "THREE"
  45. }
  46. ]
  47. }

GET /api/v1/keys/deletePending

Parameters

  • prevKey (optional)

    Returns the set of keys/files pending for deletion that are present after the given prevKey id. Example: prevKey=/vol1/bucket1/key1, this will skip keys till it seeks correctly to the given prevKey.

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns set of keys/files pending for deletion.

  1. {
  2. "lastKey": "sampleVol/bucketOne/key_one",
  3. "replicatedTotal": -1530804718628866300,
  4. "unreplicatedTotal": -1530804718628866300,
  5. "deletedkeyinfo": [
  6. {
  7. "omKeyInfoList": [
  8. {
  9. "metadata": {},
  10. "objectID": 0,
  11. "updateID": 0,
  12. "parentObjectID": 0,
  13. "volumeName": "sampleVol",
  14. "bucketName": "bucketOne",
  15. "keyName": "key_one",
  16. "dataSize": -1530804718628866300,
  17. "keyLocationVersions": [],
  18. "creationTime": 0,
  19. "modificationTime": 0,
  20. "replicationConfig": {
  21. "replicationFactor": "ONE",
  22. "requiredNodes": 1,
  23. "replicationType": "STANDALONE"
  24. },
  25. "fileChecksum": null,
  26. "fileName": "key_one",
  27. "acls": [],
  28. "path": "0/key_one",
  29. "file": false,
  30. "latestVersionLocations": null,
  31. "replicatedSize": -1530804718628866300,
  32. "fileEncryptionInfo": null,
  33. "objectInfo": "OMKeyInfo{volume='sampleVol', bucket='bucketOne', key='key_one', dataSize='-1530804718628866186', creationTime='0', objectID='0', parentID='0', replication='STANDALONE/ONE', fileChecksum='null}",
  34. "updateIDset": false
  35. }
  36. ]
  37. }
  38. ],
  39. "status": "OK"
  40. }

GET /api/v1/keys/deletePending/dirs

Parameters

  • prevKey (optional)

    Returns the set of directories pending for deletion that are present after the given prevKey id. Example: prevKey=/vol1/bucket1/bucket1/dir1, this will skip directories till it seeks correctly to the given prevKey.

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns set of directories pending for deletion.

  1. {
  2. "lastKey": "vol1/bucket1/bucket1/dir1",
  3. "replicatedTotal": -1530804718628866300,
  4. "unreplicatedTotal": -1530804718628866300,
  5. "deletedkeyinfo": [
  6. {
  7. "omKeyInfoList": [
  8. {
  9. "metadata": {},
  10. "objectID": 0,
  11. "updateID": 0,
  12. "parentObjectID": 0,
  13. "volumeName": "sampleVol",
  14. "bucketName": "bucketOne",
  15. "keyName": "key_one",
  16. "dataSize": -1530804718628866300,
  17. "keyLocationVersions": [],
  18. "creationTime": 0,
  19. "modificationTime": 0,
  20. "replicationConfig": {
  21. "replicationFactor": "ONE",
  22. "requiredNodes": 1,
  23. "replicationType": "STANDALONE"
  24. },
  25. "fileChecksum": null,
  26. "fileName": "key_one",
  27. "acls": [],
  28. "path": "0/key_one",
  29. "file": false,
  30. "latestVersionLocations": null,
  31. "replicatedSize": -1530804718628866300,
  32. "fileEncryptionInfo": null,
  33. "objectInfo": "OMKeyInfo{volume='sampleVol', bucket='bucketOne', key='key_one', dataSize='-1530804718628866186', creationTime='0', objectID='0', parentID='0', replication='STANDALONE/ONE', fileChecksum='null}",
  34. "updateIDset": false
  35. }
  36. ]
  37. }
  38. ],
  39. "status": "OK"
  40. }

Blocks Metadata (admin only)

GET /api/v1/blocks/deletePending

Parameters

  • prevKey (optional)

    Only returns the list of blocks pending for deletion, that are present after the given block id (prevKey). Example: prevKey=4, this will skip deletedBlocks table key to skip records before prevKey.

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns list of blocks pending for deletion.

  1. {
  2. "OPEN": [
  3. {
  4. "containerId": 100,
  5. "localIDList": [
  6. 1,
  7. 2,
  8. 3,
  9. 4
  10. ],
  11. "localIDCount": 4,
  12. "txID": 1
  13. }
  14. ]
  15. }

Namespace Metadata (admin only)

GET /api/v1/namespace/summary

Parameters

  • path

    The path request in string without any protocol prefix.

Returns

Returns a basic summary of the path, including entity type and aggregate count of objects under the path.

status is OK if path exists, PATH_NOT_FOUND otherwise.

Example: /api/v1/namespace/summary?path=/

  1. {
  2. "status": OK,
  3. "type": ROOT,
  4. "numVolume": 10,
  5. "numBucket": 100,
  6. "numDir": 1000,
  7. "numKey": 10000
  8. }

Example: /api/v1/namespace/summary?path=/volume1

  1. {
  2. "status": OK,
  3. "type": VOLUME,
  4. "numVolume": -1,
  5. "numBucket": 10,
  6. "numDir": 100,
  7. "numKey": 1000
  8. }

Example: /api/v1/namespace/summary?path=/volume1/bucket1

  1. {
  2. "status": OK,
  3. "type": BUCKET,
  4. "numVolume": -1,
  5. "numBucket": -1,
  6. "numDir": 50,
  7. "numKey": 500
  8. }

Example: /api/v1/namespace/summary?path=/volume1/bucket1/dir

  1. {
  2. "status": OK,
  3. "type": DIRECTORY,
  4. "numVolume": -1,
  5. "numBucket": -1,
  6. "numDir": 10,
  7. "numKey": 100
  8. }

Example: /api/v1/namespace/summary?path=/volume1/bucket1/dir/nestedDir

  1. {
  2. "status": OK,
  3. "type": DIRECTORY,
  4. "numVolume": -1,
  5. "numBucket": -1,
  6. "numDir": 5,
  7. "numKey": 50
  8. }

If any num field is -1, the path request is not applicable to such an entity type.

GET /api/v1/namespace/du

Parameters

  • path

    The path request in string without any protocol prefix.

  • files (optional)

    A boolean with a default value of false. If set to true, computes disk usage for keys under the path.

  • replica (optional)

    A boolean with a default value of false. If set to true, computes disk usage with replicated size of keys.

Returns

Returns disk usage of all sub-paths under the path. Normalizes path fields, returns total size of keys directly under the path as sizeDirectKey, and returns size/sizeWithReplica in number of bytes.

status is OK if path exists, PATH_NOT_FOUND otherwise.

Example: /api/v1/namespace/du?path=/vol1/bucket1&files=true&replica=true

  1. {
  2. "status": OK,
  3. "path": "/vol1/bucket1",
  4. "size": 100000,
  5. "sizeWithReplica": 300000,
  6. "subPathCount": 4,
  7. "subPaths": [
  8. {
  9. "path": "/vol1/bucket1/dir1-1",
  10. "size": 30000,
  11. "sizeWithReplica": 90000,
  12. "isKey": false
  13. },
  14. {
  15. "path": "/vol1/bucket1/dir1-2",
  16. "size": 30000,
  17. "sizeWithReplica": 90000,
  18. "isKey": false
  19. },
  20. {
  21. "path": "/vol1/bucket1/dir1-3",
  22. "size": 30000,
  23. "sizeWithReplica": 90000,
  24. "isKey": false
  25. },
  26. {
  27. "path": "/vol1/bucket1/key1-1",
  28. "size": 10000,
  29. "sizeWithReplica": 30000,
  30. "isKey": true
  31. }
  32. ],
  33. "sizeDirectKey": 10000
  34. }

If files is set to false, sub-path /vol1/bucket1/key1-1 is omitted. If replica is set to false, sizeWithReplica returns -1. If the path’s entity type cannot have direct keys (Root, Volume), sizeDirectKey returns -1.

GET /api/v1/namespace/quota

Parameters

  • path

    The path request in string without any protocol prefix.

Returns

Returns the quota allowed and used under the path. Only volumes and buckets have quota. Other types are not applicable to the quota request.

status is OK if the request is valid, PATH_NOT_FOUND if path doesn’t exist, TYPE_NOT_APPLICABLE if path exists, but the path’s entity type is not applicable to the request.

Example: /api/v1/namespace/quota?path=/vol

  1. {
  2. "status": OK,
  3. "allowed": 200000,
  4. "used": 160000
  5. }

If quota is not set, allowed returns -1. More on [Quota in Ozone] (https://ci-hadoop.apache.org/view/Hadoop%20Ozone/job/ozone-doc-master/lastSuccessfulBuild/artifact/hadoop-hdds/docs/public/feature/quota.html)

GET /api/v1/namespace/dist

Parameters

  • path

    The path request in string without any protocol prefix.

Returns

Returns the file size distribution of all keys under the path.

status is OK if the request is valid, PATH_NOT_FOUND if path doesn’t exist, TYPE_NOT_APPLICABLE if path exists, but the path is a key, which does not have a file size distribution.

Example: /api/v1/namespace/dist?path=/

  1. {
  2. "status": OK,
  3. "dist": [
  4. 0,
  5. 0,
  6. 10,
  7. 20,
  8. 0,
  9. 30,
  10. 0,
  11. 100,
  12. ...
  13. ]
  14. }

Recon keeps track of all keys with size from 1 KB to 1 PB. For keys smaller than 1 KB, map to the first bin (index); for keys larger than 1 PB, map to the last bin (index).

Each index of dist is mapped to a file size range (e.g. 1 MB - 2 MB).

ClusterState

GET /api/v1/clusterState

Parameters

No parameters.

Returns

Returns a summary of the current state of the Ozone cluster.

  1. {
  2. "pipelines": 5,
  3. "totalDatanodes": 4,
  4. "healthyDatanodes": 4,
  5. "storageReport": {
  6. "capacity": 1081719668736,
  7. "used": 1309212672,
  8. "remaining": 597361258496
  9. },
  10. "containers": 26,
  11. "volumes": 6,
  12. "buckets": 26,
  13. "keys": 25
  14. }

Volumes (admin only)

GET /api/v1/volumes

Parameters

  • prevKey (optional)

    Only returns the volume after the given prevKey. Example: prevKey=vol1

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns all the volumes in the cluster.

  1. {
  2. "totalCount": 4,
  3. "volumes": [{
  4. "volume": "vol1",
  5. "owner": "testuser",
  6. "admin": "ozone",
  7. "creationTime": 1665588176660 ,
  8. "modificationTime": 1665590397315,
  9. "quotaInNamespace": 2048,
  10. "quotaInBytes": 1073741824,
  11. "usedNamespace": 10,
  12. "acls": [
  13. {
  14. "type": "USER",
  15. "name": "testuser",
  16. "scope": "ACCESS",
  17. "aclList": [
  18. "WRITE",
  19. "READ",
  20. "DELETE"
  21. ]
  22. }
  23. ]
  24. },
  25. ...
  26. ]
  27. }

Buckets (admin only)

GET /api/v1/buckets

Parameters

  • volume (optional)

    The volume in string without any protocol prefix.

  • prevKey (optional)

    Only returns the bucket after the given prevKey. prevKey is ignored if volume is not specified. Example: prevKey=bucket1

  • limit (optional)

    Only returns the limited number of results. The default limit is 1000.

Returns

Returns all the buckets in the cluster if volume is not specified or it is an empty string. If volume is specified, it returns only the buckets under volume.

  1. {
  2. "totalCount": 5,
  3. "buckets": [{
  4. "volumeName": "vol1",
  5. "bucketName": "buck1",
  6. "versioning": false,
  7. "storageType": "DISK",
  8. "creationTime": 1665588176616,
  9. "modificationTime": 1665590392293,
  10. "usedBytes": 943718400,
  11. "usedNamespace": 40000,
  12. "quotaInBytes": 1073741824,
  13. "quotaInNamespace": 50000,
  14. "owner": "testuser",
  15. "bucketLayout": "OBJECT_STORE",
  16. "acls": [
  17. {
  18. "type": "USER",
  19. "name": "testuser",
  20. "scope": "ACCESS",
  21. "aclList": [
  22. "WRITE",
  23. "READ",
  24. "DELETE"
  25. ]
  26. }
  27. ]
  28. },
  29. ...
  30. ]
  31. }

Datanodes

GET /api/v1/datanodes

Parameters

No parameters.

Returns

Returns all the datanodes in the cluster.

  1. {
  2. "totalCount": 4,
  3. "datanodes": [{
  4. "uuid": "f8f8cb45-3ab2-4123",
  5. "hostname": "localhost-1",
  6. "state": "HEALTHY",
  7. "lastHeartbeat": 1605738400544,
  8. "storageReport": {
  9. "capacity": 270429917184,
  10. "used": 358805504,
  11. "remaining": 119648149504
  12. },
  13. "pipelines": [{
  14. "pipelineID": "b9415b20-b9bd-4225",
  15. "replicationType": "RATIS",
  16. "replicationFactor": 3,
  17. "leaderNode": "localhost-2"
  18. }, {
  19. "pipelineID": "3bf4a9e9-69cc-4d20",
  20. "replicationType": "RATIS",
  21. "replicationFactor": 1,
  22. "leaderNode": "localhost-1"
  23. }],
  24. "containers": 17,
  25. "leaderCount": 1
  26. },
  27. ...
  28. ]
  29. }

Pipelines

GET /api/v1/pipelines

Parameters

No parameters.

Returns

Returns all the pipelines in the cluster.

  1. {
  2. "totalCount": 5,
  3. "pipelines": [{
  4. "pipelineId": "b9415b20-b9bd-4225",
  5. "status": "OPEN",
  6. "leaderNode": "localhost-1",
  7. "datanodes": ["localhost-1", "localhost-2", "localhost-3"],
  8. "lastLeaderElection": 0,
  9. "duration": 23166128,
  10. "leaderElections": 0,
  11. "replicationType": "RATIS",
  12. "replicationFactor": 3,
  13. "containers": 0
  14. },
  15. ...
  16. ]
  17. }

Tasks

GET /api/v1/task/status

Parameters

No parameters.

Returns

Returns the status of all the Recon tasks.

  1. [
  2. {
  3. "taskName": "OmDeltaRequest",
  4. "lastUpdatedTimestamp": 1605724099147,
  5. "lastUpdatedSeqNumber": 186
  6. },
  7. ...
  8. ]

Utilization

GET /api/v1/utilization/fileCount

Parameters

  • volume (optional)

    Filters the results based on the given volume name.

  • bucket (optional)

    Filters the results based on the given bucket name.

  • fileSize (optional)

    Filters the results based on the given fileSize.

Returns

Returns the file counts within different file ranges with fileSize in the response object being the upper cap for file size range.

  1. [{
  2. "volume": "vol-2-04168",
  3. "bucket": "bucket-0-11685",
  4. "fileSize": 1024,
  5. "count": 1
  6. }, {
  7. "volume": "vol-2-04168",
  8. "bucket": "bucket-1-41795",
  9. "fileSize": 1024,
  10. "count": 1
  11. }, {
  12. "volume": "vol-2-04168",
  13. "bucket": "bucket-2-93377",
  14. "fileSize": 1024,
  15. "count": 1
  16. }, {
  17. "volume": "vol-2-04168",
  18. "bucket": "bucket-3-50336",
  19. "fileSize": 1024,
  20. "count": 2
  21. }]

Metrics

GET /api/v1/metrics/:api

Parameters

Refer to Prometheus HTTP API Reference for complete documentation on querying.

Returns

This is a proxy endpoint for Prometheus and returns the same response as the prometheus endpoint. Example: /api/v1/metrics/query?query=ratis_leader_election_electionCount

  1. {
  2. "status": "success",
  3. "data": {
  4. "resultType": "vector",
  5. "result": [
  6. {
  7. "metric": {
  8. "__name__": "ratis_leader_election_electionCount",
  9. "exported_instance": "33a5ac1d-8c65-4c74-a0b8-9314dfcccb42",
  10. "group": "group-03CA9397D54B",
  11. "instance": "ozone_datanode_1:9882",
  12. "job": "ozone"
  13. },
  14. "value": [
  15. 1599159384.455,
  16. "5"
  17. ]
  18. }
  19. ]
  20. }
  21. }