hapostgres / hapostgres/pg_auto_failover

If you modify the PGDATA directory, an error is reported when creating a Seondary Node. And the same operation is normal when creating Primary Node.

Open
#999 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.4k
Forks
142
Avg merge
5h 8m
Merged PRs (30d)
1

Description

-bash-4.2$ pg_autoctl create postgres --hostname 192.168.2.116 --auth trust --no-ssl --monitor 'postgres://autoctl_node@192.168.2.114:5432/pg_auto_failover?sslmode=prefer'
14:32:15 1541 WARN No encryption is used for network traffic! This allows an attacker on the network to read all replication data.
14:32:15 1541 WARN Using --ssl-self-signed instead of --no-ssl is recommend to achieve more security with the same ease of deployment.
14:32:15 1541 WARN See https://www.postgresql.org/docs/current/libpq-ssl.html for details on how to improve
14:32:15 1541 INFO Using default --ssl-mode "prefer"
14:32:15 1541 INFO Started pg_autoctl postgres service with pid 1543
14:32:15 1541 INFO Started pg_autoctl node-init service with pid 1544
14:32:15 1543 INFO /usr/pgsql-12/bin/pg_autoctl do service postgres --pgdata /data/pg -v
14:32:15 1544 INFO Registered node 8 (192.168.2.116:5432) with name "node_8" in formation "default", group 0, state "wait_standby"
14:32:15 1544 INFO Writing keeper state file at "/var/lib/pgsql/.local/share/pg_autoctl/data/pg/pg_autoctl.state"
14:32:15 1544 INFO Writing keeper init state file at "/var/lib/pgsql/.local/share/pg_autoctl/data/pg/pg_autoctl.init"
14:32:15 1544 INFO Successfully registered as "wait_standby" to the monitor.
14:32:15 1544 INFO FSM transition from "init" to "wait_standby": Start following a primary
14:32:15 1544 INFO Transition complete: current state is now "wait_standby"
14:32:15 1544 INFO New state for node 7 "node_7" (192.168.2.115:5432): single ➜ wait_primary
14:32:15 1544 INFO New state for node 7 "node_7" (192.168.2.115:5432): wait_primary ➜ wait_primary
14:32:15 1544 INFO Still waiting for the monitor to drive us to state "catchingup"
14:32:15 1544 WARN Please make sure that the primary node is currently running `pg_autoctl run` and contacting the monitor.
14:32:15 1544 INFO FSM transition from "wait_standby" to "catchingup": The primary is now ready to accept a standby
14:32:15 1544 INFO Initialising PostgreSQL as a hot standby
14:32:15 1544 INFO /usr/pgsql-12/bin/pg_basebackup -w -d application_name=pgautofailover_standby_8 host=192.168.2.115 port=5432 user=pgautofailover_replicator sslmode=prefer --pgdata /data/backup/node_8 -U pgautofailover_replicator --verbose --progress --max-rate 100M --wal-method=stream --slot pgautofailover_standby_8
14:32:15 1544 INFO pg_basebackup: initiating base backup, waiting for checkpoint to complete
14:32:15 1544 INFO pg_basebackup: checkpoint completed
14:32:15 1544 INFO pg_basebackup: write-ahead log start point: 0/2000028 on timeline 1
14:32:15 1544 INFO pg_basebackup: starting background WAL receiver
14:32:15 1544 INFO 0/25322 kB (0%), 0/1 tablespace (/data/backup/node_8/backup_label )
14:32:15 1544 INFO 25332/25332 kB (100%), 0/1 tablespace (.../backup/node_8/global/pg_control)
14:32:15 1544 INFO 25332/25332 kB (100%), 1/1 tablespace
14:32:15 1544 INFO pg_basebackup: write-ahead log end point: 0/2000138
14:32:15 1544 INFO pg_basebackup: waiting for background process to finish streaming ...
14:32:15 1544 INFO pg_basebackup: syncing data to disk ...
14:32:16 1544 INFO pg_basebackup: base backup completed
14:32:16 1541 WARN pg_autoctl service node-init failed with exit status 0
14:32:16 1543 INFO Postgres controller service received signal SIGTERM, terminating
14:32:16 1541 INFO Stop pg_autoctl
-bash-4.2$ ll /data/pg/
total 0

Active: active (running) since Sun 2023-06-25 14:36:49 CST; 2s ago
Main PID: 1637 (pg_autoctl)
CGroup: /system.slice/postgresprimary.service
├─1637 /usr/pgsql-12/bin/pg_autoctl run
├─1639 pg_autoctl: start/stop postgres
├─1649 /usr/pgsql-12/bin/pg_autoctl do service node-active --pgdata /data/pg -v
└─1651 /usr/pgsql-12/bin/pg_basebackup -w -d application_name=pgautofailover_standby_8 host=192.168.2.115 port=5432 user=pgautofailover_replicator ssl...

Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 WARN The `pg_autoctl create` did not complete, completing now.
Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 INFO Continuing from a previous `pg_autoctl create` failed attempt
Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 INFO PostgreSQL state at registration time was: PGDATA does not exists
Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 INFO FSM transition from "wait_standby" to "catchingup": The primary is now ready ... standby
Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 INFO Initialising PostgreSQL as a hot standby
Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 INFO /usr/pgsql-12/bin/pg_basebackup -w -d application_name=pgautofailover_standby_8 host...
Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 INFO pg_basebackup: initiating base backup, waiting for checkpoint to complete
Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 INFO pg_basebackup: checkpoint completed
Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 INFO pg_basebackup: write-ahead log start point: 0/D000028 on timeline 1
Jun 25 14:36:51 localhost.localdomain pg_autoctl[1637]: 14:36:51 1649 INFO pg_basebackup: starting background WAL receiver
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost pgsql]# ll /data/
backup/ pg/
[root@localhost pgsql]# ll /data/pg/
total 0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.