619 Commits

Author SHA1 Message Date
Ian Barwick
1bdc72a07b Updates to README and --help output 2016-12-26 15:23:00 +09:00
Ian Barwick
a6f1c6e483 repmgr: use provided --replication-user in pg_basebackup mode 2016-12-26 15:22:56 +09:00
Ian Barwick
6e14f0bc5d repmgr: in rsync mode don't delete backup_history file
Make behaviour consistent with pg_basebackup.
2016-12-26 10:39:05 +09:00
Ian Barwick
a336d22bd9 repmgr: miscelleanous code cleanup 2016-12-26 10:39:00 +09:00
Ian Barwick
e88a8a9708 repmgr: standby register --wait-sync=0 can loop infinitely 2016-12-23 11:29:19 +09:00
Ian Barwick
dc18e5b791 repmgr: escape conninfo parameters when cloning from Barman 2016-12-22 12:21:44 +09:00
Ian Barwick
9da0914976 Consolidate various backported functions 2016-12-22 12:11:54 +09:00
Ian Barwick
666e71a589 repmgr: escape parameter values in primary_conninfo, if required
Addresses GitHub #253.
2016-12-22 11:40:46 +09:00
Ian Barwick
742f7e167f repmgr: support option --replication-user in STANDBY CLONE too 2016-12-14 17:00:03 +09:00
Ian Barwick
1fb2801639 repmgr: add option --replication-user 2016-12-14 15:58:11 +09:00
Ian Barwick
e3031f0204 repmgr: fix log message 2016-12-14 12:39:47 +09:00
Ian Barwick
79748f28f1 repmgr: improve STANDBY REGISTER sanity checks and log messages 2016-12-14 12:38:42 +09:00
Ian Barwick
46740b64a9 repmgr: enable forced registration of a node with a downstream cascaded standby 2016-12-14 12:22:41 +09:00
Ian Barwick
6557099832 repmgr: initial support for standby register --force
This functionality is intended for those cases where a cascading replication
cluster is being automatically provisioned and it might be necessary to
clone multiple levels in parallel.

As always, use of `--force` implies you know what you are doing.
2016-12-12 15:51:19 +09:00
Ian Barwick
083e288ac3 repmgr: add usage warnings for --no-conninfo-password 2016-12-08 23:01:46 +09:00
Abhijit Menon-Sen
402e02f4b7 Add an option to suppress passwords in recovery.conf/primary_conninfo 2016-12-08 22:36:18 +09:00
Ian Barwick
be58af701b repmgr: add option --upstream-conninfo
When executing `repmgr standby clone`, this enables the primary_conninfo
string set in recovery.conf to be explictly defined (rather than generated
from the upstream node's conninfo string and connection parameters).

This is primarily intended for those cases when an L2 cascaded standby
is being cloned from the cluster primary, and its intended upstream
might not yet be available.
2016-12-07 17:05:57 +09:00
Ian Barwick
eb2cdf8a98 repmgr: improve handling of command line parameter errors
Previously providing a parameter which requires a value (e.g. -f/--config-file)
would result in a misleading error like "Unknown option -f".

Rather than suppress getopt's error messages, we'll rely on these to inform
about missing required values or unknown options (as other PostgreSQL tools
do), though we will still provide our own list of command line errors and
warnings countered above and beyond getopt's sanity checks.
2016-12-05 14:40:32 +09:00
Ian Barwick
7cc0400c03 repmgr: add option --log-to-file; remove timestamp from log output by default
Log lines will still be prefixed with timestamp if `-log-to-file` used.
2016-12-05 14:09:41 +09:00
Ian Barwick
9788b2bd29 repmgr: don't display timestamp in log output
Differentiate between repmgr and repmgrd output
2016-12-05 10:44:30 +09:00
Ian Barwick
227f0190f7 repmgr: initial support for PostgreSQL 10
Handle directory name change from pg_xlog to pg_wal.

Note that some functions with "xlog" in their name may also change.
2016-12-02 12:06:08 +09:00
Ian Barwick
b54f98ed8a repmgr: always log to STDERR even if log facility defined 2016-11-23 08:55:55 +09:00
Ian Barwick
d22535de00 repmgr: pointless parsing the configuration here 2016-11-01 19:28:03 +09:00
Ian Barwick
fce1f0cd4a Refactor reload_config()
Remove any non-repmgrd specific items.

parse_config() already sanity-checks the values so no need to
recheck. Refactor parse_config() so when called by reload_config()
it won't exit if errors are encountered.
2016-11-01 19:05:21 +09:00
Ian Barwick
bb842c3989 repmgr: improve replication status checking during switchover
When checking the new standby's record in pg_stat_replication, keep
polling until the expected status is reported, and only give up
after a timeout was exceeded.

Previously repmgr would report an error if status was "startup",
even though this is not a problem.
2016-11-01 17:42:35 +09:00
Ian Barwick
251486546d repmgr: when unregistering a witness, remove record on that witness to
Fixes GitHub #250.
2016-10-30 16:28:12 +09:00
Ian Barwick
20d66df0ef repmgr: prevent involuntary cloning where no repmgr schema present on master 2016-10-19 20:26:55 +09:00
Ian Barwick
3f7c30b84d repmgr: require a valid repmgr cluster name unless -F/--force supplied
Addresses issue mentioned in GitHub #242.
2016-10-19 16:16:12 +09:00
Ian Barwick
a63baf7fcb repmgr: rename local variable config_file_found to remote_config_file_found
We also have a global `config_file_found` - avoid confusion with that.
2016-10-19 15:30:02 +09:00
Ian Barwick
e19c643389 repmgr: refactor check_upstream_config() for clarity
Also ensure the check for sufficient walsenders is only carried out
when using pg_basebackup.
2016-10-19 15:06:21 +09:00
Ian Barwick
f058833451 repmgr: in Barman clone mode, don't try and create the data directory twice
In Barman mode the data directory is created early containing a temporary
directory needed to hold temporary files while cloning from the Barman
server. In other modes we might not know the data directory location until
connecting to the source server, so its creation happens later. In Barman
mode ensure that step is skipped.
2016-10-19 10:00:50 +09:00
Ian Barwick
96c14adfdb repmgr: ensure data directory defaults to that of the source node
As long as -D/--pgdata is not supplied, and barman mode is not used
for cloning.
2016-10-17 16:34:49 +09:00
Ian Barwick
50119056a5 repmgr: clean up runtime options structure
Place elements in a sensible order and split the associated initializer
macro over multiple lines for easier editing.

Also move a few related global variables into to the structure to keep
everything in the same place.
2016-10-11 12:54:56 +09:00
Ian Barwick
a279c42df9 "pg_logical/snapshot" -> "pg_logical/snapshots" 2016-10-11 09:32:55 +09:00
Ian Barwick
f70b6ea136 Merge branch 'fix-barman-mode' of git://github.com/gciolli/repmgr
Fixes GitHub #245.
2016-10-11 09:21:31 +09:00
Ian Barwick
e4cb6d7130 repmgr: simplify LSN parsing
Also silences a compiler warning.
2016-10-10 22:56:49 +09:00
Gianni Ciolli
502c056753 When restoring from Barman, create pg_logical subdirectories
Nodes cloned from Barman backups were missing these subdirectories,
and so they were unable to start when promoted.
2016-10-10 10:18:33 +02:00
Ian Barwick
871ec47ff5 Fix repmgr cluster crosscheck output
Show actual node ID rather than incremental number.

Fixes GitHub #244.
2016-10-10 16:20:17 +09:00
Ian Barwick
a217b4d0a9 repmgr: standardize SSH-related error messages 2016-10-07 07:42:15 +09:00
Ian Barwick
2dcb75f889 Add 'cluster crosscheck' to help output detail
Per GitHub #243.
2016-10-06 07:38:45 +09:00
Ian Barwick
eb90f864c9 repmgr: consistent error message style 2016-10-05 10:31:25 +09:00
Ian Barwick
2c1cbc6bf9 Fix witness server initialisation 2016-09-30 13:43:47 +09:00
Ian Barwick
ed22fe326e Document and expand pg_ctl override configuration options
These are now prefixed with "service_" to emphasize that they're
OS-level commands, not repmgr ones; also added reload and promote
commands:

    service_start_command
    service_stop_command
    service_restart_command
    service_reload_command
    service_promote_command

GitHub #169
2016-09-30 11:58:45 +09:00
Ian Barwick
46500e1408 Documentation update and miscellaneous code cleanup 2016-09-30 09:30:22 +09:00
Ian Barwick
c3971513b6 Refactor show diagnose to handle node IDs correctly.
See previous comments for `show matrix`.
2016-09-30 01:46:01 +09:00
Ian Barwick
a2910eded9 Refactor show matrix to handle node IDs correctly.
Previously the code assumed repmgr node IDs to be sequential,
which is not guaranteed to be the case. With a non-sequential
list of node IDs, an incorrect node id would be displayed,
and memory accessed beyond the bounds of the matrix array.

The refactored code is considerably less elegant than the original
but will correctly handle a non-sequential sequence of node IDs.
2016-09-29 18:51:55 +09:00
Ian Barwick
dc70e2d804 Remove superfluous PQfinish() call
Connection was previously closed, if this error condition is triggered
a segfault will occur.
2016-09-29 11:53:13 +09:00
Ian Barwick
ea45158f50 Refactor cluster diagnose
- use the remote user setting, like other SSH-based remote operations
  (avoid hardcoding the user name)
- enable `repmgr cluster matrix'  to accept the cluster name, node id
  and the database connection information instead of requiring repmgr.conf;
  this means we don't have to assume that repmgr.conf is in one
  of the default locations
2016-09-29 11:41:14 +09:00
Gianni Ciolli
84d1e16edd Factor out "build_cluster_diagnose" from "do_cluster_diagnose"
We separate the code that builds the cube from the code that displays
it, in preparation for reusing the cube somewhere else, e.g. for
automatic failover detection.
2016-09-29 01:23:09 +09:00
Gianni Ciolli
57815af3ac Factor out "build_cluster_matrix" from "do_cluster_matrix"
We separate the code that builds the matrix from the code that
displays it, in preparation for reusing the matrix somewhere else,
e.g. for automatic failover detection.
2016-09-29 01:22:54 +09:00