Re: streaming replication not working

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: John DeSoi <desoi(at)pgedit(dot)com>
Cc: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: streaming replication not working
Date: 2013-09-25 13:36:13
Message-ID: 1380116173.2185.8.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2013-09-24 at 08:59 -0500, John DeSoi wrote:
> On Sep 24, 2013, at 5:48 AM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> wrote:
>
> >> Here is what I have on the standby:
> >>
> >> postgresql.conf
> >>
> >> hot_standby = on
> >> max_wal_senders = 2
> >> wal_level = hot_standby
> >
> > You should set the same parameters on the primary, else it won't work.
>
> On the primary I have
>
>
> wal_level = hot_standby
> wal_keep_segments = 48
> max_wal_senders = 2
>
> archive_mode = on
> archive_command = 'rsync --whole-file --ignore-existing --delete-after --timeout=30 -a %p backup:/path/backup/%f'
> archive_timeout = 300
>
> I don't have "hot_standby = on". I thought that only applied to the standby to allow queries in recovery mode?
>
>
> >> Am I missing something obvious? Do I have to back up the primary again to make this change?
> >
> > No, that shouldn't be necessary.
> >
> > What are the messages in the secondary's log
> > after you start it?
>
>
> Below is what I have for restart with log level at debug2. In looking at the source, I should have an error or a log message "streaming replication successfully connected to primary". I never get either one.
>
>
> LOG: restored log file "000000010000010F00000001" from archive
> LOG: restored log file "000000010000010F00000002" from archive
> LOG: received fast shutdown request
> LOG: aborting any active transactions
> LOG: shutting down
> LOG: database system is shut down
> LOG: database system was shut down in recovery at 2013-09-24 08:23:53 CDT
> DEBUG: standby_mode = 'on'
> DEBUG: trigger_file = '/pgsql/9.2/data/failover.trigger'
> DEBUG: primary_conninfo = 'host=localhost port=21333 user=postgres'
> DEBUG: restore_command = 'pg_standby -t /pgsql/9.2/data/failover.trigger /shared/pgbackup %f %p %r'
> DEBUG: archive_cleanup_command = 'pg_archivecleanup /shared/pgbackup %r'
> LOG: entering standby mode
> LOG: restored log file "000000010000010F00000002" from archive
> DEBUG: got WAL segment from archive
> DEBUG: checkpoint record is at 10F/204D9B8
> DEBUG: redo record is at 10F/2035608; shutdown FALSE
> DEBUG: next transaction ID: 0/3837659; next OID: 13124290
> DEBUG: next MultiXactId: 3; next MultiXactOffset: 5
> DEBUG: oldest unfrozen transaction ID: 1798, in database 1
> DEBUG: transaction ID wrap limit is 2147485445, limited by database with OID 1
> DEBUG: resetting unlogged relations: cleanup 1 init 0
> DEBUG: initializing for hot standby
> LOG: redo starts at 10F/2035608
> DEBUG: recovery snapshots are now enabled
> CONTEXT: xlog redo running xacts: nextXid 3837668 latestCompletedXid 3837667 oldestRunningXid 3837668
> DEBUG: checkpointer updated shared memory configuration values
> LOG: consistent recovery state reached at 10F/3000000
> LOG: database system is ready to accept read only connections
> LOG: restored log file "000000010000010F00000003" from archive
> DEBUG: got WAL segment from archive
>

Your config file and your debug logs don't match. Your config file says
that the restore command is rsync, but your logs say its pg_standby.

Check if you have a pg_standby process on the slave. That would explain
why the slave never tries to establish a replication connection to the
master.

--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message DDT 2013-09-25 14:27:58 回复:[GENERAL] SP to calc shipments vs receipts
Previous Message Merlin Moncure 2013-09-25 13:04:18 Re: Deduplication and transaction isolation level