mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
The redundant column `Column` will be presented in the table header.
Depending on output format `Tags` are serialized differently:
* For *pretty* format YAML is used, every element on the new line
* For *tsv* format for YAML is also used, but all elements and on the same line (similar to JSON)
* For *json* and *yaml* formats `Tags` are serialized into an appropriate format.
<details><summary>Examples of output in pretty formats:</summary>
```bash
$ patronictl list
+ Cluster: batman (6813309862653668387) +---------+----+-----------+---------------------+
| Member | Host | Role | State | TL | Lag in MB | Tags |
+-------------+----------------+--------+---------+----+-----------+---------------------+
| postgresql0 | 127.0.0.1:5432 | Leader | running | 3 | | clonefrom: true |
| | | | | | | noloadbalance: true |
| | | | | | | nosync: true |
+-------------+----------------+--------+---------+----+-----------+---------------------+
| postgresql1 | 127.0.0.1:5433 | | running | 3 | 0.0 | |
+-------------+----------------+--------+---------+----+-----------+---------------------+
$ patronictl list badclustername
+ Cluster: badclustername (uninitialized) ------+
| Member | Host | Role | State | TL | Lag in MB |
+--------+------+------+-------+----+-----------+
+--------+------+------+-------+----+-----------+
```
</details>
<details><summary>Example in tsv format:</summary>
```bash
Cluster Member Host Role State TL Lag in MB Pending restart Tags
batman postgresql0 127.0.0.1:5432 Leader running 2
batman postgresql1 127.0.0.1:5433 running 2 0 {clonefrom: true, nofailover: true, noloadbalance: true, replicatefrom: postgresql0}
batman postgresql2 127.0.0.1:5434 running 2 0 * {replicatefrom: postgres1}
```
</details>
In addition to that, `patronictl list` command will stop showing keys with empty values in `json` and `yaml` formats.
<details><summary>Examples:</summary>
```yaml
$ patronictl list -f yaml
- Cluster: batman
Host: 127.0.0.1:5432
Member: postgresql0
Role: Leader
State: running
TL: 2
- Cluster: batman
Host: 127.0.0.1:5433
Lag in MB: 0
Member: postgresql1
State: running
TL: 2
Tags:
clonefrom: true
nofailover: true
noloadbalance: true
replicatefrom: postgresql0
- Cluster: batman
Host: 127.0.0.1:5434
Lag in MB: 0
Member: postgresql2
Pending restart: '*'
State: running
TL: 2
Tags:
replicatefrom: postgres1
```
```json
$ patronictl list -f json | jq .
[
{
"Cluster": "batman",
"Member": "postgresql0",
"Host": "127.0.0.1:5432",
"Role": "Leader",
"State": "running",
"TL": 2
},
{
"Cluster": "batman",
"Member": "postgresql1",
"Host": "127.0.0.1:5433",
"State": "running",
"TL": 2,
"Lag in MB": 0,
"Tags": {
"nofailover": true,
"noloadbalance": true,
"replicatefrom": "postgresql0",
"clonefrom": true
}
},
{
"Cluster": "batman",
"Member": "postgresql2",
"Host": "127.0.0.1:5434",
"State": "running",
"TL": 2,
"Lag in MB": 0,
"Pending restart": "*",
"Tags": {
"replicatefrom": "postgres1"
}
}
]
```
</details>