You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2023/02/03 17:05:04 UTC

[ozone] branch master updated: HDDS-7747. Document jq filtering examples for CLI responses. (#4157)

This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 406aef41e0 HDDS-7747. Document jq filtering examples for CLI responses. (#4157)
406aef41e0 is described below

commit 406aef41e0dc078355db16161d3af30d9c194222
Author: SaketaChalamchala <sa...@gmail.com>
AuthorDate: Fri Feb 3 09:04:56 2023 -0800

    HDDS-7747. Document jq filtering examples for CLI responses. (#4157)
---
 hadoop-hdds/docs/content/interface/Cli.md | 62 +++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/hadoop-hdds/docs/content/interface/Cli.md b/hadoop-hdds/docs/content/interface/Cli.md
index 3cbe518ec5..76b516922d 100644
--- a/hadoop-hdds/docs/content/interface/Cli.md
+++ b/hadoop-hdds/docs/content/interface/Cli.md
@@ -207,3 +207,65 @@ $ ozone sh key info /vol1/bucket1/README.md
 ```shell
 $ ozone sh key get /vol1/bucket1/README.md /tmp/
 ```
+
+## Querying CLI Results
+
+Ozone CLI returns JSON responses. [jq](https://stedolan.github.io/jq/manual/) is a command line JSON processor that can be used to filter CLI output for desired information.
+
+For example:
+
+* List FSO buckets that are not links.
+```shell
+$ ozone sh bucket list /s3v | jq '.[] | select(.link==false and .bucketLayout=="FILE_SYSTEM_OPTIMIZED")'
+{
+  "metadata": {},
+  "volumeName": "s3v",
+  "name": "fso-bucket",
+  "storageType": "DISK",
+  "versioning": false,
+  "usedBytes": 0,
+  "usedNamespace": 0,
+  "creationTime": "2023-02-01T05:18:46.974Z",
+  "modificationTime": "2023-02-01T05:18:46.974Z",
+  "quotaInBytes": -1,
+  "quotaInNamespace": -1,
+  "bucketLayout": "FILE_SYSTEM_OPTIMIZED",
+  "owner": "om",
+  "link": false
+}
+```
+
+* List EC buckets with their replication config.
+```shell
+$ ozone sh bucket list /vol1 | jq -r '.[] | select(.replicationConfig.replicationType == "EC") | {"name": .name, "replicationConfig": .replicationConfig}'
+{
+  "name": "ec5",
+  "replicationConfig": {
+    "data": 3,
+    "parity": 2,
+    "ecChunkSize": 1048576,
+    "codec": "RS",
+    "replicationType": "EC",
+    "requiredNodes": 5
+  }
+}
+{
+  "name": "ec9",
+  "replicationConfig": {
+    "data": 6,
+    "parity": 3,
+    "ecChunkSize": 1048576,
+    "codec": "RS",
+    "replicationType": "EC",
+    "requiredNodes": 9
+  }
+}
+```
+
+* List names of encrypted buckets and their encryption key names in tab-separated-value format.
+```shell
+
+$ ozone sh bucket list /vol1 | jq -r '.[] | select(.encryptionKeyName != null) | [.name, .encryptionKeyName] | @tsv'
+ec5     key1
+encrypted-bucket        key1
+```


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org