Using PGD CLI v5
The PGD CLI is a convenient way to connect to and manage your PGD cluster. To use it, you need a user with PGD superuser privileges or equivalent. The PGD user with superuser privileges is the bdr_superuser role. An example of an equivalent user is edb_admin on an EDB BigAnimal distributed high-availability cluster.
PGD CLI doesn't interactively prompt for your password. You must pass your password using one of the following methods:
- Adding an entry to your
.pgpasspassword file, which includes the host, port, database name, user name, and password.
- Setting the password in the
- Including the password in the connection string.
We recommend the first option, as the other options don't scale well with multiple databases, or they compromise password confidentiality.
Once you have installed pgd-cli, run the
pgd command to access the PGD command line interface. The
pgd command needs details about the host, port, and database to connect to, along with your username and password.
--dsn flag to pass a database connection string to the
pgd command. When you pass the connection string with the
--dsn flag, you don't need a configuration file. The flag takes precedence even if a configuration file is present. For example:
See pgd in the command reference for a description of the command options.
pgd-cli-config.yml file is in
pgd uses it. You can override
this behavior using the optional
--config-file flag. For example:
--output flag to change the default output format to JSON or YAML. For example:
The PGD CLI supports the following output formats.
|none||Tabular||Default format. This setting presents the data in tabular form.|
|JSON||Presents the raw data with no formatting. For some commands, the JSON output might show more data than the tabular output, such as extra fields and more detailed messages.|
|YAML||Similar to the JSON output but as YAML and with the fields ordered alphabetically. Experimental and might not be fully supported in future versions.|
To list the supported commands, enter:
For help with a specific command and its parameters, enter
pgd help <command_name>. For example:
Avoiding stale data
The PGD CLI can return stale data on the state of the cluster if it's still connecting to nodes previously parted from the cluster. Edit the
pgd-cli-config.yml file, or change your
--dsn settings to ensure you are connecting to active nodes in the cluster.