Using Cloud Service features with the CLI
Suggest editsFaraway replicas CLI commands
You can use the faraway-replica-specific CLI commands to create, promote, and get information on faraway replicas.
To update, delete, and restore faraway replicas, use the faraway-replica update
, faraway-replica delete
, and faraway-replica restore
commands. See Managing clusters with the CLI for more information.
Create a faraway replica
You use the faraway-replica create
command to create a replica. You can use either interactive mode or a config file. This example shows interactive mode:
biganimal faraway-replica create
? Source Cluster Provider ID: Azure ? Source Cluster Region ID: Canada Central ? Source Cluster Name: abcd ? Faraway Replica Name: abcd-replica-1 ? Faraway Replica Region: France Central ? Instance type: D2s v4(2vCPU, 8GB RAM) ? Volume type: Azure Premium Storage ? Volume properties: P1 (4 Gi, 120 Provisioned IOPS, 25 Provisioned MB/s) ? Networking: Public ? Cloud Provider Subscription ID: "111,222" ? Service Account IDs, (leave empty to stop adding): "id1@iam.gcp" ? By default your cluster allows all inbound communications, add IP allowed list to restrict the access: No ? Add database config in the format "application_name=sample_app&array_nulls=true", Leave empty for default configuration: ? Backup Retention Period, note backups will incur storage charges from the cloud provider directly. e.g. "7d", "2w" or "3m": 3m
You're prompted to confirm that you want to create the faraway replica. After the faraway replica creation process is complete, it generates a replica cluster ID.
Get information on faraway replicas
You use the faraway-replica show-connected
command to get information on faraway clusters for a specified source cluster. You can use either interactive mode or specify the settings with flags on the command line. This example shows interactive mode:
biganimal faraway-replica show-connected
? Provider: Azure ? Region: Norway East ? Cluster Name: abcd ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Connected Faraway Replicas │ ├──────────────┬─────────────────┬───────────────────────────────────┬──────────┬────────────┬───────────────┬──────────────────────────────┬─────────┤ │ ID │ Name │ Status │ Provider │ Region │ Instance Type │ Postgres Type │ Version │ ├──────────────┼─────────────────┼───────────────────────────────────┼──────────┼────────────┼───────────────┼──────────────────────────────┼─────────┤ │ p-phs4lp9h23 │ abcd-replica-1 │ Cluster creation request received │ Azure │ East US 2 │ D2s v4 │ EDB Postgres Advanced Server │ 14 │ │ p-phs4lx0fup │ abcd-replica-2 │ Cluster in healthy state │ Azure │ Japan East │ D2s v3 │ EDB Postgres Advanced Server │ 14 │ └──────────────┴─────────────────┴───────────────────────────────────┴──────────┴────────────┴───────────────┴──────────────────────────────┴─────────┘
Promote a faraway replica
You use the faraway-replica promote
command to promote an existing replica to a standalone single-node or primary/standby high-availability cluster. You can use either interactive mode or specify the settings with flags on the command line. This example shows interactive mode:
biganimal faraway-replica promote
./biganimal faraway-replica promote ? Source Replica Provider ID: Azure ? Source Replica Region ID: France Central ? Source Replica Name: abcd-replica-1 ? Promoted cluster name: abcd-2 ? Promoted cluster architecture: High Availability ? Number of standby replicas: 2 Replicas ? Enable read-only workloads: No ? Promoted cluster password: ************ ? Instance type: D2s v4(2vCPU, 8GB RAM) ? Volume type: Azure Premium Storage ? Volume properties: P1 (4 Gi, 120 Provisioned IOPS, 25 Provisioned MB/s) ? Networking: Public ? By default your cluster allows all inbound communications, add IP allowed list to restrict the access: No ? Cloud Provider Subscription ID: "111,222" ? Service Account IDs, (leave empty to stop adding): "id1@iam.gcp" ? Add database config in format "application_name=sample_app&array_nulls=true": autovacuum_max_workers=5&autovacuum_vacuum_cost_limit=3000&checkpoint_completion_target=0.9&checkpoint_timeout=15min&cpu_tuple_cost=0.03&effective_cache_size=0.75 * ram&maintenance_work_mem=(0.15 * (ram - shared_buffers) / autovacuum_max_workers) > 1GB ? 1GB : (0.15 * (ram - shared_buffers) / autovacuum_max_workers)&random_page_cost=1.1&shared_buffers=((0.25 * ram) > 80GB) ? 80GB : (0.25 * ram)&tcp_keepalives_idle=120&tcp_keepalives_interval=30&wal_buffers=64MB&wal_compression=on ? Backup Retention Period, use strings like '7d' or '2w' or '3m' to specify days, weeks and months respectively.: 3m
You're prompted to confirm that you want to promote the faraway replica. After the faraway replica promotion process is complete, it generates a cluster ID.
IAM authentication CLI commands
To create a cluster that's enabled for IAM authentication, set the --iam-authentication
flag on the cluster create
command to Yes
or in the configuration file to true
.
To change the IAM authentication setting after creating a cluster, use the --iam-authentication
flag on the cluster update
command.
To change the IAM authentication setting when restoring a cluster, use the --iam-authentication
flag on the cluster restore
command.
For more information on IAM authentication for AWS, see IAM authentication for Postgres.
Logging and metrics CLI command
You can get the URLs to access Prometheus metrics and logs in your cloud provider's blob storage solution using the cluster show-monitoring-urls
CLI command.
For single-node and primary/standby high-availability clusters, the syntax of the command is:
biganimal cluster show-monitoring-urls {--id | --provider --region \ --name} [--metrics] [--logs]
For distributed high-availability clusters, the syntax of the command is:
biganimal pgd show-group-monitoring-urls {--id --group-id} [--metrics] \ [--logs]
If you don't use the optional flags to specify the output type, the output includes both the metrics URL and the logs URL.
See Other monitoring and logging solutions for more information about using the URLs to access metrics and logs.
Maintenance windows CLI command
You can set and view maintenance windows using the cluster set-maintenance-window
and cluster get-maintenance-window
CLI commands.
The syntax of the command is:
biganimal cluster [set|get]-maintenance-window {--id | --provider --region --name} {--enable} [--start-day --start-time]
For more information on maintenance windows, see Periodic maintenance.
Could this page be better? Report a problem or suggest an addition!