Commit Graph

1186 Commits

Author SHA1 Message Date
Ian Barwick 6a198401db Fix repmgrd's command line help option parsing
As in commit d0c05e6f46, properly distinguish between
the command line option -? and getopt's unknown option marker '?'
2016-08-08 21:17:56 +09:00
Ian Barwick cb78802027 repmgrd: prevent endless loops in failover with manual node
The LSN reported by the shared memory function defaults to "0/0"
(InvalidXLogRecPtr) - this indicates that the repmgrd on that node
hasn't been able to update it yet. However during failover several
places in the code assumed this is an error, which would cause
an endless loop waiting for updates which would never come.

To get around this without changing function definitions, we can
store an explicit message in the shared memory location field so the
caller can tell whether the other node hasn't yet updated the field,
or encountered situation which means it should not be considered
as a promotion candidate (which in most cases will be because
`failover` is set to `manual`.

Resolves GitHub #222.
2016-08-08 14:29:24 +09:00
Ian Barwick 73280a426b Update HISTORY 2016-08-05 16:43:52 +09:00
Ian Barwick b8ee321d5f Merge branch 'gciolli-feature-better-auto-deb'
GitHub pull request #218
2016-08-05 16:42:27 +09:00
Gianni Ciolli ccdc0f9871 Improved "repmgr-auto" Debian package
* Version set to 3.2dev

* Binaries are placed in PGBINDIR and then linked from /usr/bin,
  instead of being placed into /usr/bin directly. This is necessary
  for the switchover command, because it requires pg_rewind, which is
  placed in PGBINDIR too.
2016-08-05 09:34:32 +02:00
Ian Barwick 89aeccedc2 Various bugfixes and code documentation improvements 2016-08-04 12:31:24 +09:00
Ian Barwick d9bda915bb Update documentation and --help output for witness register
This completes the implementation of GitHub #186
2016-08-04 10:36:26 +09:00
Ian Barwick c565be4ab6 Improve database connection status checking 2016-08-04 10:36:21 +09:00
Ian Barwick c26fd21351 Implement repmgr standby register command 2016-08-04 10:36:16 +09:00
Ian Barwick 6b57d0e680 Separate witness registration into do_witness_register() 2016-08-04 10:36:12 +09:00
Ian Barwick 6faf029c93 Add witness unregister command info in help output 2016-08-02 18:39:04 +09:00
Ian Barwick c42437a4f2 standby/witness unregister - enable even if node isn't running
If the `--node` option is provided with the id of the node to unregister,
the action can be executed on any node.

This addresses GitHub #211.
2016-08-02 17:09:27 +09:00
Ian Barwick d0c05e6f46 Clean up command line option handling and help output
- properly distinguish between the command line option -? and getopt's
  unknown option marker '?'
- remove deprecated command line options --initdb-no-pwprompt and
  -l/--local-port
- add witness command summary in help output
2016-08-02 14:40:13 +09:00
Ian Barwick 050f007cc2 Initial implementation of witness unregister 2016-08-02 12:22:54 +09:00
Ian Barwick 371d80ff35 Document repmgr cluster show --csv 2016-08-01 16:10:10 +09:00
Ian Barwick e0a61afb7d Suppress connection error display in repmgr cluster show
This prevents connection error messages being mixed in
with `repmgr cluster show` output. Error message output can
still be enabled with the --verbose flag.

Fixes GitHub #215
2016-08-01 14:57:40 +09:00
Ian Barwick bbc88ce05c Miscellaneous code cleanup and typo fixes 2016-07-28 16:32:07 +09:00
Ian Barwick 61e907cf70 Update README
Default log level is NOTICE, not INFO.
2016-07-27 12:11:00 +09:00
Ian Barwick 02668ee045 Parse the contents of the "pg_basebackup_options" parameter in repmgr.conf
This is to ensure that when repmgr executes pg_basebackup it doesn't
add any options which would conflict with user-supplied options.

This is related to GitHub #206, where the -S/--slot option has been
added for 9.6 - it's important to check this doesn't conflict with
-X/--xlog-method.

While we're at it, rename the ErrorList handling code to ItemList
etc. so we can use it for generic non-error-related lists.
2016-07-26 16:12:43 +09:00
Ian Barwick 36eb26f86d Mark some variables as static. 2016-07-26 11:40:26 +09:00
Ian Barwick cbc2c7b3e6 From PostgreSQL 9.6, use pg_basebackup's -S/--slot option if appropriate
GitHub #206
2016-07-26 10:35:30 +09:00
Ian Barwick 8a28dadde4 Rename RECOVERY_FILE to RECOVERY_COMMAND_FILE
This is for consistency with the PostgreSQL source code (see:
src/backend/access/transam/xlog.c ), but as it's not exported
we need to define it ourselves anyway.
2016-07-26 09:19:52 +09:00
Ian Barwick 3eda7373ad Prevent duplicated parameters being passed to pg_basebackup
This was not a problem, but ugly.
2016-07-25 20:44:36 +09:00
Ian Barwick 34e574ac66 Update README
Add caveats for pg_rewind with 9.4 and 9.3 in particular, also fix typo.
2016-07-21 08:58:44 +09:00
Ian Barwick e8fcc3d7a6 repmgr: set default user for -R/--remote-user 2016-07-18 14:30:30 +09:00
Ian Barwick eba0f1d7ae Update README with note about using screen et al 2016-07-18 11:01:42 +09:00
Ian Barwick db32565b36 Add notes about setting pg_bindir for Debian/Ubuntu-based distributions.
repmgr doesn't know about pg_ctlcluster.

Per GitHub query #196.
2016-07-15 16:00:31 +09:00
Ian Barwick 94befc3230 repmgr standby clone historically accepts a hostname as third parameter 2016-07-15 11:17:05 +09:00
Ian Barwick 340899f082 Update README
Add note about 2ndQuadrant RPM repository.
2016-07-13 09:55:01 +09:00
Ian Barwick 76681c0850 Update code comments 2016-07-12 10:56:31 +09:00
Ian Barwick eebaef59a3 Remove unused error code ERR_BAD_PASSWORD 2016-07-12 09:36:50 +09:00
Ian Barwick ddaaa28449 README: update error code list 2016-07-12 09:35:52 +09:00
Ian Barwick e81bf869ec Update README with details about conninfo parameter handling
From 3.1.4 `repmgr` will behave like other PostgreSQL utilities
when handling database connection parameters, in particular
accepting a conninfo string and honouring libpq connection defaults.
2016-07-12 09:27:22 +09:00
Ian Barwick fa62d715c2 Make more consistent use of conninfo parameters
Removed the existing keyword array which has a fixed, limited number
of parameters and replace it with a dynamic array which can be
used to store as many parameters as reported by libpq.
2016-07-11 15:24:53 +09:00
Ian Barwick 72af24e1d6 Add missing space when setting "application_name" 2016-07-08 09:46:59 +09:00
Ian Barwick 61d617ae93 Improve default host/dbname handling
repmgr disallows socket connections anyway (the whole point of providing
the host is to connect to a remote machine) so don't show that as
a fallback default in the -?/--help output.
2016-07-08 08:34:15 +09:00
Ian Barwick 319fba8b1f Enable a conninfo string to be passed to repmgr in the -d/--dbname parameter
This matches the behaviour of other PostgreSQL utilities such as pg_basebackup,
psql et al.

Note that unlike psql, but like pg_basebackup, repmgr does not accept a
"left-over" parameter as a conninfo string; this could be added later.

Parameters specified in the conninfo string will override any parameters
supplied correcly (e.g. `-d "host=foo"` will override `-h bar`).
2016-07-08 08:31:14 +09:00
Ian Barwick c92ea1d057 Generate "primary_conninfo" using the primary connection's parameters
Having successfully connected to the primary, we can use the actual parameters
reported by libpq to create "primary_conninfo", rather than the limited
subset previously defined by repmgr. Assuming that the user can
pass a conninfo string to repmgr (see following commit), this makes it
possible to provide other connection parameters, e.g. related to
SSL usage.
2016-07-08 08:11:11 +09:00
Ian Barwick b2ca6fd35e Remove now-superfluous wildcard in rmtree() call 2016-07-07 09:51:55 +09:00
Martin c880187e89 Fix alignment and syntax 2016-07-06 15:52:58 -03:00
Jarkko Oranen 4724da41ad Add sample configuration for systemd support 2016-07-06 15:52:58 -03:00
Jarkko Oranen d44885b330 Allow overriding start, stop and restart commands issued by repmgr
This commit introduces three new options:
  - start_command
  - stop_command
  - restart_command

If these are set, repmgr will issue the specified command instead
of the default pg_ctl commands
2016-07-06 15:52:58 -03:00
Ian Barwick 72f9b0145a Use rmtree instead of executing "rm -rf"
This completes the task mentioned in b6b6439819
2016-07-06 15:55:56 +09:00
Ian Barwick 5e03ef40cb Update HISTORY 2016-07-06 15:48:14 +09:00
Ian Barwick 091541619d Fix repmgrd monitoring calculation when in archive recovery 2016-07-06 09:27:31 +09:00
Ian Barwick 5e9db47d12 Fix query in get_node_record_by_name() 2016-07-05 21:06:31 +09:00
Ian Barwick e8a0cd33b5 Ensure all node record structures are initialised 2016-07-05 11:33:06 +09:00
Ian Barwick 8cd79fd7dd Revert "repmgr: add option -B/--remote-pg_bindir for standby switchover"
This reverts commit c30447ac90.
2016-07-04 11:30:36 +09:00
Ian Barwick 013b4b4b8a Update README/TODO about following non-master server 2016-07-01 12:15:37 +09:00
Ian Barwick c5a721a3cf TODO: remove resolved item 2016-07-01 12:07:10 +09:00