For a DR test, I've tried to split the slave from the master. To do this, I edited the master postgresql.conf, turned off archive_mode and restarted. No problem.
Now I'm trying to make the slave a master, so I added recovery_target_time to recovery.conf, ensured that archive_mode is off in the postgresql.conf file, and tried to restart.
This failed. (The command scrolled off the screen, so I can't show the results.)
pg_ctl stop -D
This worked:
pg_ctl stop -D /var/lib/pgsql/data -m immediate
So I tried to restart:
[postgres@stdrcdsdb202 ~]$ pg_ctl start -D /var/lib/pgsql/data -w
waiting for server to start....
LOG: could not create IPv6 socket: Address family not supported by protocol
LOG: database system was interrupted while in recovery at log time 2017-08-23 23:22:55 EDT
HINT: If this has occurred more than once some data might be corrupted and you might need to choose an earlier recovery target.
LOG: starting archive recovery
LOG: restore_command = '/usr/bin/pg_standby -l -d -s 2 -t /tmp/pgsql.trigger.5432 /var/lib/pgsql/backups/wal_archives %f %p %r 2>>standby.log'
LOG: recovery_target_time = '2017-08-23 22:30:00-04'
FATAL: the database system is starting up
.FATAL: the database system is starting up
.FATAL: the database system is starting up
(snip)
.FATAL: the database system is starting up
.FATAL: the database system is starting up
.FATAL: the database system is starting up
.LOG: restored log file "0000000100003022000000B0" from archive
LOG: automatic recovery in progress
LOG: redo starts at 3022/B0D18388, consistency will be reached at 3022/B1000000
FATAL: the database system is starting up
.FATAL: the database system is starting up
.FATAL: the database system is starting up
(snip)
.FATAL: the database system is starting up
.FATAL: the database system is starting up
.FATAL: the database system is starting up
.could not start server
But...
[postgres@stdrcdsdb202 ~]$ pg_ctl status -D /var/lib/pgsql/data
pg_ctl: server is running (PID: 5669)
/usr/bin/postgres "-D" "/var/lib/pgsql/data"
[postgres@stdrcdsdb202 ~]$ psql
FATAL: the database system is starting up
psql: FATAL: the database system is starting up
Any hints or solutions?
Thanks
LOG: database system was interrupted while in recovery at log time 2017-08-23 23:22:55 EDT
. I guess you would be best off with a backup on master and a restore on the slave.