Commit Graph

147 Commits

Author SHA1 Message Date
Ian Barwick
295c18f6ff repmgr: fix configuration file sanity check
The check was being carried out regardless of whether --copy-external-config-files
was specified, which means cloning will fail if no SSH connection is available.

Addresses GitHub #342
2017-11-23 22:48:34 +09:00
Ian Barwick
4cebba32e2 remove spurios "/base" path element in Barman tablespace cloning code.
Addresses GitHub #339
2017-11-20 10:50:26 +09:00
Ian Barwick
c9f12cfbe0 repmgr: don't add empty "passfile" parameter in recovery.conf 2017-11-20 10:27:45 +09:00
Ian Barwick
1553596f84 repmgr: minor fix to "repmgr standby --help" output 2017-11-15 13:47:52 +09:00
Ian Barwick
a6cc4d80f0 Add "witness register" functionality 2017-11-15 13:47:45 +09:00
Ian Barwick
eb14bb58c6 Add configuration file "passfile"
This will enable a custom .pgpass to be included in "primary_conninfo"
(provided it's supported by the libpq version on the standby).
2017-11-14 19:30:25 +09:00
Ian Barwick
2c468d64fb "standby follow": get upstream record before server restart, if required
The standby may not always be available for connections right after it's
restarted, so attempting to connect and get the node's upstream record
after the restart may fail. Record is now retrieved before the restart.

Addresses GitHub #333.
2017-10-27 16:30:14 +09:00
Ian Barwick
4d8176ab60 Fix version number check 2017-10-04 09:35:47 +09:00
Ian Barwick
d6c27f8938 Standardize quoting in log messages 2017-10-04 09:34:59 +09:00
Ian Barwick
e64600d3e3 Prevent compiler truncation warnings 2017-09-19 16:15:47 +09:00
Ian Barwick
bb311892b5 Remove unused code 2017-09-19 14:47:49 +09:00
Ian Barwick
e3defc507e Merge branch 'pg93' 2017-09-18 15:55:32 +09:00
Ian Barwick
1197c11c59 "standby clone": skip tablespace mapping in PostgreSQL 9.3 2017-09-18 13:26:35 +09:00
Ian Barwick
30b11c08e6 Disable any configuration settings not compatible with PostgreSQL 9.3
And emit a warning while we're at it.
2017-09-18 13:12:38 +09:00
Ian Barwick
ea2693bc75 Move create_recovery_file() et al to repmgr-action-standby.c
As they're only ever called from there.
2017-09-18 09:53:08 +09:00
Ian Barwick
f5c9c74a75 Minor log output tweak 2017-09-14 08:57:16 +09:00
Ian Barwick
e040f95aaa "standby clone": fix replication slot generation
Slot on source node was being deleted even if source node is the intended
upstream node.
2017-09-14 08:47:56 +09:00
Ian Barwick
e583e2eb40 "standby switchover": fix error message 2017-09-13 11:30:29 +09:00
Ian Barwick
b6cd816923 Tidy up some log output 2017-09-12 11:08:41 +09:00
Ian Barwick
a9f4a027a7 pgindent run 2017-09-11 11:14:13 +09:00
Ian Barwick
3447257ae4 repmgrd: minor fixes and comment updates 2017-09-08 20:59:21 +09:00
Ian Barwick
e4f7dc8234 Add copyright notices 2017-09-08 13:27:39 +09:00
Ian Barwick
b6a27b975d "standby clone": improve handling when designated upstream doesn't yet exist
This situation can occur in provisioning environments, where a node's
upstream may not exist at the point it's cloned. If replication slots
are in use, we'll need to make sure no attempt is made to create
the replication slot on the designated upstream, as that will end in
tears. We assume the user will be prepared to complete this step manually.
2017-09-07 12:35:27 +09:00
Ian Barwick
3787dd3795 "standby switchover": better handling of remote execution failure 2017-09-07 11:50:56 +09:00
Ian Barwick
edee80cc37 Rename option "node check --is-shutdown" to "--is-shutdown-cleanly"
As that's what we really want to know. Also return "UNCLEAN_SHUTDOWN"
if that's the case, rather than "RUNNING" which is confusing, even
though it's a command for internal use.
2017-09-07 11:15:27 +09:00
Ian Barwick
79531ae9da "standby switchover": fix check for remote repmgr binary
Also add a useful hint about setting "pg_bindir".
2017-09-07 10:26:46 +09:00
Ian Barwick
ee7a5b6e66 Minor bug and log fixes 2017-09-06 17:28:31 +09:00
Ian Barwick
03f400617c "standby register": add --dry-run and check node is attached to upstream 2017-09-06 15:48:23 +09:00
Ian Barwick
66219c3097 README and "repmgr standby --help" updates 2017-09-06 14:13:06 +09:00
Ian Barwick
a28bbd68eb "standby clone": improve replication slots handling
Ensure replication slot is created on the upstream node and deleted from
the source node, if upstream node and source nodes differ.
2017-09-06 12:16:02 +09:00
Ian Barwick
bd07a34472 "standby clone": improve log messages
Make it clearer which nodes are being connected to, and why.
2017-09-06 10:15:52 +09:00
Ian Barwick
5b5b456ecb "standby switchover": improve logging
Also no need to disconnect/reconnect from/to local node while it promotes.
2017-09-05 10:26:27 +09:00
Ian Barwick
d82e936556 "standby promote": improve logging
Specifically state which server is being promoted; this is particularly
important when the promotion occurs as part of a series of other operations,
e.g. "standby switchover".

Also no need to disconnect/reconnect while the server is promoted.
2017-09-05 09:43:16 +09:00
Ian Barwick
78e6bdeebe Have repmgrd parse "standby follow --upstream-node-id=%n" 2017-09-04 13:42:50 +09:00
Ian Barwick
47a4b49890 Add "repmgr standby follow --upstream-node-id"
In an automatic failover situation, after a standby has been promoted
there's a risk the original primary may become available again before
"standby follow" is issued on another standby node, in which case "standby
follow" will reconnect to the original primary.

As the standby's repmgrd will have received a notification from the new
primary, it will know the primary's ID and can therefore explicitly
direct "standby follow" to follow that primary.
2017-09-04 09:11:59 +09:00
Ian Barwick
3aeceab081 "standby follow": add missing sleep() call when --wait specified 2017-09-02 13:11:03 +09:00
Ian Barwick
edb74ccef9 Various fixes to "repmgr node rejoin" 2017-09-01 11:30:31 +09:00
Ian Barwick
c7423ebb44 Various minor fixes 2017-08-31 23:54:52 +09:00
Ian Barwick
91941183bc Use replication user, if set, when checking replication connections 2017-08-31 17:54:49 +09:00
Ian Barwick
0e0b221507 Add configuration file setting "use_primary_conninfo_password"
If, for whatever reason, the upstream server password needs to be set
in "primary_conninfo", enable it to be extracted from $PGPASSWORD.
2017-08-31 14:57:07 +09:00
Ian Barwick
ae634100a3 "standby switchover": sanity-check remote "repmgr" binary before proceeding 2017-08-31 11:00:14 +09:00
Ian Barwick
8e35a415a9 Refactor extraction of value to use for "primary_conninfo"
Also add improved error detection.

Basically in the worst case we want to enable the user to clone a standby
from Barman even if the upstream node is not running/reachable, as long as
the user explicitly provides a string to use for "primary_conninfo".
2017-08-31 09:59:30 +09:00
Ian Barwick
13f2d46e92 "standby clone": exit with 0 after successful --dry-run 2017-08-30 10:00:48 +09:00
Ian Barwick
8b03859dbe "standby clone": add early sanity check for external configuration files
This still requires an SSH connection, so we need to check early before
the cloning starts, and also emit useful information for --dry-run.
2017-08-29 22:11:16 +09:00
Ian Barwick
b900f9996f "repmgr standby clone": add --dry-run option 2017-08-28 15:04:50 +09:00
Ian Barwick
e05bab8284 "standby switchover": epxlictly confirm suitability for --pg-rewind
If --force-rewind requested.
2017-08-28 14:50:08 +09:00
Ian Barwick
754084c814 Update "repmgr standby --help" output 2017-08-26 10:27:22 +09:00
Ian Barwick
57215a8bd7 Add --help output for "standby clone" 2017-08-25 23:07:17 +09:00
Ian Barwick
dc172cae20 When performing a follow operation, start/restart server as appropriate
Before this we were always forcing a restart, which is technically not
a problem but produces some potentially confusing log entries along the
lines:

  pg_ctl: PID file "/path/to/postmaster.pid" does not exist
  Is server running?
  starting server anyway
2017-08-25 16:50:30 +09:00
Ian Barwick
a449e8512e repmgr: improve "repmgr standby switchover" log output
Particularly in --dry-run mode it's useful to get a confirmation that
various prerequisites are met.
2017-08-25 16:01:11 +09:00