Using BigAnimal features with the CLI

Faraway 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 update-cluster, delete-cluster, and restore-cluster commands. See Managing clusters with the CLI for more information.

Create a faraway replica

You use the create-faraway-replica command to create a replica. You can use either interactive mode or a config file. The example shows interactive mode:

biganimal create-faraway-replica
Output
? 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
? 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 are prompted to confirm you want to create the faraway replica. After the faraway replica creation process is completed, it generates a replica cluster ID.

Get information on faraway replicas

You use the show-cluster-faraway-replicas 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. The example shows interactive mode:

biganimal show-cluster-faraway-replicas
Output
? 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        │ Oracle Compatible │ 14      │
│ p-phs4lx0fup │ abcd-replica-2  │ Cluster in healthy state          │ Azure    │ Japan East │ D2s v3        │ Oracle Compatible │ 14      │
└──────────────┴─────────────────┴───────────────────────────────────┴──────────┴────────────┴───────────────┴───────────────────┴─────────┘

Promote a faraway replica

You use the promote-faraway-replica command to promote an existing replica to a standalone single-node or high availability cluster. You can use either interactive mode or specify the settings with flags on the command line. The example shows interactive mode:

biganimal promote-faraway-replica
Output
./biganimal promote-faraway-replica
? 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
? 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 are prompted to confirm you want to promote the faraway replica. After the faraway replica promotion process is completed, it generates a cluster ID.

IAM authentication CLI commands

To create a cluster that is enabled for IAM authentication, set the --iam-authentication flag on the create-cluster command or in the configuration file to Yes or true, respectively.

To change the IAM authentication setting after creating a cluster, use the --iam-authentication flag on the update-cluster command.

To change the IAM authentication setting when restoring a cluster, use the --iam-authentication flag on the restore-cluster command.

For more information on IAM authentication for AWS, see [IAM authentication for Postgres (biganimal/latest/using_cluster/01_postgres_access/#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 show-cluster-monitoring-urls CLI command.

The syntax of the command is:

show-cluster-monitoring-urls {--id | --provider --region --name} \
                             [--metrics] [--logs]

If you don't use the optional flags to specify one or the other, the output includes both the metrics URL and the logs URL.

See Other monitoring and logging solutions for more information on the about using the URLs to access metrics and logs.