DEV Community

Talha Munir πŸ‡΅πŸ‡Έ
Talha Munir πŸ‡΅πŸ‡Έ

Posted on

Faraway Replicas-part 3

In this part 3 of the replica series we will be discussing how we can control the replicas using CLI commands.
You can view first 2 parts over here
part1
part2

Faraway Replicas CLI commands

You can use replica-specific CLI commands to create, promote, and get information on faraway replicas.

To update we use faraway-replica update
To delete we use faraway-replica delete
To restore we use faraway-replica restore

Create a faraway replica:

You use the faraway-replica create command to create a replica from CLI. You can either use interactive mode or a config file. The example below uses interactive mode.

biganimal faraway-replica create

You will be prompted to confirm that either 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 can 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 CLI.
The example below shows the interactive mode.

biganimal faraway-replica show-connected
Enter fullscreen mode Exit fullscreen mode

The output will show the provider region, cluster name, and connected faraway replicas.

Promote a faraway replica

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

biganimal faraway-replica promote
Enter fullscreen mode Exit fullscreen mode

You will be prompted to confirm whether you want to promote the faraway replica. It will generate a cluster ID when the promotion process is completed.

IAM authentication CLI commands

To create a cluster that is enabled for IAM authentication, set the --iam-authentication flag on 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.

Logging and metrics CLI command

You can get the URLs to access metrics and logs in your cloud providers blob storage solution using cluster show-monitoring-urls CLI command.

  1. 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]
Enter fullscreen mode Exit fullscreen mode
  1. FOr distributed high availability clusters, the syntax of the command is:
biganimal pgd show-group-monitoring-urls {--id --group-id} [--metrics] \
                                         [--logs]
Enter fullscreen mode Exit fullscreen mode

Maintenance Windows CLI command

You can also set and view maintenance windows using the command 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]
Enter fullscreen mode Exit fullscreen mode

References:

  1. https://www.postgresql.org/docs/
  2. https://dev.to/talhahahae/faraway-replicas-part-2-4ma9
  3. https://dev.to/talhahahae/creating-a-faraway-replica-53h8

Top comments (0)