Command reference
=================

The command name for the PGD command line interface is ``pgd`` .

Synopsis
--------

The EDB Postgres Distributed Command Line Interface (PGD CLI) is a tool
to manage your EDB Postgres Distributed cluster. It allows you to run
commands against EDB Postgres Distributed clusters. You can use it to
inspect and manage cluster resources.

Commands
--------

- :ref:`Cluster configuration <Cluster configuration>`  : Cluster-level commands for managing the cluster.

- :ref:`pgd cluster show <pgd cluster show>`  : Show cluster-level information.

- :ref:`pgd cluster verify <pgd cluster verify>`  : Verify cluster-level information.

- :ref:`Viewing groups and replication sets <Viewing groups and replication sets>`  : Group-level commands for managing groups.

- :ref:`pgd cluster show <pgd cluster show>`  : Show group-level information.

- :ref:`pgd group set-option <pgd group set-option>`  : Set group-level options.

- :ref:`pgd group get-option <pgd group get-option>`  : Get group-level options.

- :ref:`pgd group set-leader <pgd group set-leader>`  : Set the write leader of a group (perform a
  switchover).

- :ref:`Viewing groups and replication sets <Viewing groups and replication sets>`  : Group related commands for listing groups. -
  :ref:`pgd commit-scopes list <pgd commit-scopes list>`  : List groups.

- :ref:`Failing Over to Newly Joined Nodes <Failing Over to Newly Joined Nodes>`  : Node-level commands for managing nodes.

- :ref:`Running pgd node setup <Running pgd node setup>`  : Setup a node in the cluster.

- :ref:`pgd cluster show <pgd cluster show>`  : Show node-level information.

- :ref:`pgd node part <pgd node part>`  : Part a PGD node from an active cluster.

- :ref:`pgd group set-option <pgd group set-option>`  : Set node-level options.

- :ref:`pgd group get-option <pgd group get-option>`  : Get node-level options.

- :ref:`pgd node set-config <pgd node set-config>`  : Set node-level configuration.

- :ref:`pgd node get-config <pgd node get-config>`  : Get node-level configuration.

- :ref:`pgd node upgrade <pgd node upgrade>`  : Perform a major version upgrade of a PGD Postgres
  node.

- :ref:`Node management <Node management>`  : Node related commands for listing nodes. -
  :ref:`pgd commit-scopes list <pgd commit-scopes list>`  : List nodes.

- :ref:`Monitoring degrade events <Monitoring degrade events>`  : Event log commands for viewing events. -
  :ref:`pgd cluster show <pgd cluster show>`  : Show events.

- :ref:`EXPLAIN ANALYZE Replication <EXPLAIN ANALYZE Replication>`  : Replication related-commands for managing
  replication. - :ref:`pgd cluster show <pgd cluster show>`  : Show replication information.

- :ref:`Using Raft for the commit decision <Using Raft for the commit decision>`  : Raft related commands for managing Raft consensus.

- :ref:`pgd cluster show <pgd cluster show>`  : Show information about Raft state.

- :ref:`pgd raft enable <pgd raft enable>`  : Enable the Raft consensus worker on one or more
  nodes.

- :ref:`pgd raft disable <pgd raft disable>`  : Disable the Raft consensus worker on one or more
  nodes.

- :ref:`pgd group set-leader <pgd group set-leader>`  : Transfer Raft leadership to a specified node.

- :ref:`pgd raft sync-snapshot <pgd raft sync-snapshot>`  : Synchronize Raft state across all nodes.

- :ref:`pgd commit-scope create <pgd commit-scope create>`  : Commit scope related commands for managing PGD commit
  scopes.

- :ref:`pgd cluster show <pgd cluster show>`  : Show information about a commit-scope.

- :ref:`pgd commit-scope create <pgd commit-scope create>`  : Create a commit-scope.

- :ref:`pgd commit-scope update <pgd commit-scope update>`  : Update a commit-scope.

- :ref:`pgd commit-scope drop <pgd commit-scope drop>`  : Drop a commit-scope.

- :ref:`pgd commit-scopes list <pgd commit-scopes list>`  : List commit scopes.

- :ref:`Assessing the cluster state <Assessing the cluster state>`  : Assesses a Postgres server’s PGD compatibility.

- :ref:`pgd completion <pgd completion>`  : Generate shell completion scripts.

Global Options
--------------

All commands accept the following global options:

.. csv-table::
  :header: Short,Long,Description
  :widths: 12,10,25
  :align: left
  :class: longtable

  `-f`,`--config-file`,"Name/Path to config file. This is ignored if --dsn flag is present Default ""/etc/edb/pgd-cli/pgd-cli-config.yml"""
  "",`--dsn`,"Database connection string For example ""host=bdr-a1 port=5432 dbname=pgddb user=postgres"" Also set by `PGD_CLI_DSN` environment variable."
  `-h`,`--help`,Help for pgd - will show specific help for any command used
  `-o`,`--output`,"Output format: `json`, `psql`, `modern`, `markdown`, `simple` (see  :ref:`Output formats<Output formats>` )"

Additional Options
------------------

Run ``pgd -V`` to see the version information for the pgd CLI.

Output formats
--------------

Used with the ``-o`` /``--output`` option:

.. csv-table::
  :header: Format,Description
  :widths: 10,30
  :align: left
  :class: longtable

  simple,Simple format - Output as a simple ASCII table (Default).
  json,"JSON format - Output as a JSON document, non-tabular"
  psql,PSQL format - Output as an ASCII table in the style of PSQL
  modern,Modern format - Output as a table using box characters
  markdown,Markdown table format - Output as a markdown compatible ASCII table

.. toctree::
  :maxdepth: 3

  Reference--reference--cli--command_ref--assess--index
  Reference--reference--cli--command_ref--cluster--index
  Reference--reference--cli--command_ref--commit-scope--index
  Reference--reference--cli--command_ref--completion--index
  Reference--reference--cli--command_ref--events--index
  Reference--reference--cli--command_ref--group--index
  Reference--reference--cli--command_ref--groups--index
  Reference--reference--cli--command_ref--node--index
  Reference--reference--cli--command_ref--nodes--index
  Reference--reference--cli--command_ref--raft--index
  Reference--reference--cli--command_ref--replication--index
