Re: After upgrade to 9.3, streaming replication fails to start

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Jeff Ross <jross(at)wykids(dot)org>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: After upgrade to 9.3, streaming replication fails to start
Date: 2013-11-06 18:32:22
Message-ID: CAMkU=1yfrP9OfKBa1LPuTWQFt=gnnCZ4sqNnSDHc5DmF0MLHoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 6, 2013 at 9:40 AM, Jeff Ross <jross(at)wykids(dot)org> wrote:

_postgresql(at)nirvana:/var/postgresql $ cat start_hot_standby.sh
> #!/bin/sh
> backup_label=wykids_`date +%Y-%m-%d`
> #remove any existing wal files on the standby
> ssh dukkha.internal rm -rf /wal/*
> #stop the standby server if it is running
> ssh dukkha.internal sudo /usr/local/bin/svc -d /service/postgresql.5432
> psql -c "select pg_start_backup('$backup_label');" template1
> rsync \
> --copy-links \
> --delete \
> --exclude=backup_label \
>

Excluding backup_label is exactly the wrong thing to do. The only reason
backup_label is created in the first place is so that it can be copied to
the replica, where it is needed. It's existence on the master is a
nuisance.

> --exclude=postgresql.conf \
> --exclude=recovery.done \
> -e ssh -avz /var/postgresql/data.93.5432/ \
> dukkha.internal:/var/postgresql/data.93.5432/
> ssh dukkha.internal rm -f /var/postgresql/data.93.5432/pg_xlog/*
> ssh dukkha.internal rm -f /var/postgresql/data.93.5432/
> pg_xlog/archive_status/*
> ssh dukkha.internal rm -f /var/postgresql/data.93.5432/pg_log/*
> ssh dukkha.internal rm -f /var/postgresql/data.93.5432/postmaster.pid
> ssh dukkha.internal ln -s /var/postgresql/recovery.conf
> /var/postgresql/data.93.5432/recovery.conf
> psql -c "select pg_stop_backup();" template1
> ssh dukkha.internal sudo /usr/local/bin/svc -u /service/postgresql.5432
>
>
> _postgresql(at)nirvana:/var/postgresql $ sh -x start_hot_standby.sh
> + date +%Y-%m-%d
> + backup_label=wykids_2013-11-06
> + ssh dukkha.internal rm -rf /wal/*
> + ssh dukkha.internal sudo /usr/local/bin/svc -d /service/postgresql.5432
> + rsync -e ssh /wal/ dukkha.internal:/wal/
> skipping directory .
>

Where is the above rsync coming from? It doesn't seem to be in the shell
script you showed.

Anyway, I think you need to copy the wal over after you call
pg_stop_backup, not before you call pg_start_backup.

Cheers,

Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zev Benjamin 2013-11-06 18:45:35 Full text search on partial URLs
Previous Message Jeff Ross 2013-11-06 17:40:07 After upgrade to 9.3, streaming replication fails to start