Fly Postgres with 2 (two) Nodes?

There’s no centralized consensus store, so in a two node setup there’s no way to verify you’re not in a network partition.

If the primary fails and you’re running a two node setup, you’ll need to ssh into your standby Machine and manually promote the standby.

SSH into the Machine

fly ssh console <machine-id>

Navigate to the postgres home directory

su postgres
cd ~

Evaluate the state of the cluster

postgres@2865117f1ed018:~$ repmgr daemon status
 ID | Name                            | Role    | Status        | Upstream                          | repmgrd | PID | Paused? | Upstream last seen
----+---------------------------------+---------+---------------+-----------------------------------+---------+-----+---------+--------------------
 1502360255 | fdaa:0:2e26:a7b:110:e0ed:7af0:2 | standby |   running     | ? fdaa:0:2e26:a7b:196:f8c4:fb70:2 | running | 399 | no      | 428 second(s) ago
 1977791143 | fdaa:0:2e26:a7b:196:f8c4:fb70:2 | primary | ? unreachable | ?                                 | n/a     | n/a | n/a     | n/a

Promote the standby:

repmgr standby promote

Unregister the old primary.

repmgr primary unregister --node-id 1977791143

Then you should remove your old Primary machine and re-clone from your newly assigned primary.

2 Likes