hot standby questions

Started by armand pirvuover 8 years ago4 messagesgeneral
Jump to latest
#1armand pirvu
armand.pirvu@gmail.com

Hi

Just trying to put together the hot_standby setup
All docs I read are pointing to use as prefered method to use pg_basebackup to set the base
So far so good
But

psql postgres -c "select pg_start_backup('backup')"
pg_basebackup -D /var/lib/pgsql/sample -Ft -z -P
psql postgres -c "select pg_stop_backup()"

will get me on target
< 2017-08-02 22:09:45.348 CDT >LOG: database system was interrupted; last known up at 2017-08-02 22:06:28 CDT
< 2017-08-02 22:09:45.353 CDT >LOG: entering standby mode
< 2017-08-02 22:09:45.353 CDT >LOG: invalid primary checkpoint record
< 2017-08-02 22:09:45.353 CDT >LOG: invalid secondary checkpoint record
< 2017-08-02 22:09:45.353 CDT >PANIC: could not locate a valid checkpoint record
< 2017-08-02 22:09:45.523 CDT >LOG: startup process (PID 10895) was terminated by signal 6: Aborted
< 2017-08-02 22:09:45.523 CDT >LOG: aborting startup due to startup process failure

where as
psql postgres -c "select pg_start_backup('backup')"
pg_basebackup -D /var/lib/pgsql/sample -Ft -z -P -x
psql postgres -c "select pg_stop_backup()"

I am good to go

Pretty much every where I looked at -x is not mentioned to be used

So what gives ? What did I miss ? It's gotta be soomething

Thanks
Armand

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Jeff Janes
jeff.janes@gmail.com
In reply to: armand pirvu (#1)
Re: hot standby questions

On Wed, Aug 2, 2017 at 8:19 PM, armand pirvu <armand.pirvu@gmail.com> wrote:

Hi

Just trying to put together the hot_standby setup
All docs I read are pointing to use as prefered method to use
pg_basebackup to set the base
So far so good
But

psql postgres -c "select pg_start_backup('backup')"
pg_basebackup -D /var/lib/pgsql/sample -Ft -z -P
psql postgres -c "select pg_stop_backup()"

pg_basebackup does the equivalent of pg_start_backup and pg_stop_backup for
you. It is not helpful, and might even sometimes be harmful, to do them
yourself when using pg_basebackup.

Pretty much every where I looked at -x is not mentioned to be used

So what gives ? What did I miss ? It's gotta be soomething

That certainly isn't my experience. If you find sites that don't mention
-x, -X, or --xlog-method, then I would be reluctant to take any of that
site's other advice seriously.

But note that in version 10, -x will go away and the default will be
changed so that not specifying anything will be the same as -X stream.
perhaps you are reading advice aimed at a future version.

Cheers,

Jeff

#3drum.lucas@gmail.com
drum.lucas@gmail.com
In reply to: Jeff Janes (#2)
Re: hot standby questions

2017-08-04 5:58 GMT+12:00 Jeff Janes <jeff.janes@gmail.com>:

On Wed, Aug 2, 2017 at 8:19 PM, armand pirvu <armand.pirvu@gmail.com>
wrote:

Hi

Just trying to put together the hot_standby setup
All docs I read are pointing to use as prefered method to use
pg_basebackup to set the base
So far so good
But

psql postgres -c "select pg_start_backup('backup')"
pg_basebackup -D /var/lib/pgsql/sample -Ft -z -P
psql postgres -c "select pg_stop_backup()"

pg_basebackup does the equivalent of pg_start_backup and pg_stop_backup
for you. It is not helpful, and might even sometimes be harmful, to do
them yourself when using pg_basebackup.

Pretty much every where I looked at -x is not mentioned to be used

So what gives ? What did I miss ? It's gotta be soomething

That certainly isn't my experience. If you find sites that don't mention
-x, -X, or --xlog-method, then I would be reluctant to take any of that
site's other advice seriously.

But note that in version 10, -x will go away and the default will be
changed so that not specifying anything will be the same as -X stream.
perhaps you are reading advice aimed at a future version.

Cheers,

Jeff

I use pg_basebackup every day and the way I do is:

pg_basebackup -D /destination --checkpoint=fast --xlog-method=stream

The --xlog-method=stream option will copy the wal_files as well (to
pg_xlogs directory).

That works pretty well for me. You can either add the compress option too.
Hope this was helpful.

Cheers,
Lucas

#4armand pirvu
armand.pirvu@gmail.com
In reply to: drum.lucas@gmail.com (#3)
Re: hot standby questions

Thank you guys

I think I kinda shot myself in the foot. I took a look at the wiki and I put in -x and so far so good

— Armand

Show quoted text

On Aug 3, 2017, at 11:03 PM, Lucas Possamai <drum.lucas@gmail.com> wrote:

2017-08-04 5:58 GMT+12:00 Jeff Janes <jeff.janes@gmail.com <mailto:jeff.janes@gmail.com>>:
On Wed, Aug 2, 2017 at 8:19 PM, armand pirvu <armand.pirvu@gmail.com <mailto:armand.pirvu@gmail.com>> wrote:

Hi

Just trying to put together the hot_standby setup
All docs I read are pointing to use as prefered method to use pg_basebackup to set the base
So far so good
But

psql postgres -c "select pg_start_backup('backup')"
pg_basebackup -D /var/lib/pgsql/sample -Ft -z -P
psql postgres -c "select pg_stop_backup()"

pg_basebackup does the equivalent of pg_start_backup and pg_stop_backup for you. It is not helpful, and might even sometimes be harmful, to do them yourself when using pg_basebackup.

Pretty much every where I looked at -x is not mentioned to be used

So what gives ? What did I miss ? It's gotta be soomething

That certainly isn't my experience. If you find sites that don't mention -x, -X, or --xlog-method, then I would be reluctant to take any of that site's other advice seriously.

But note that in version 10, -x will go away and the default will be changed so that not specifying anything will be the same as -X stream. perhaps you are reading advice aimed at a future version.

Cheers,

Jeff

I use pg_basebackup every day and the way I do is:

pg_basebackup -D /destination --checkpoint=fast --xlog-method=stream

The --xlog-method=stream option will copy the wal_files as well (to pg_xlogs directory).

That works pretty well for me. You can either add the compress option too. Hope this was helpful.

Cheers,
Lucas