Обсуждение: 9.1.3: launching streaming replication

Поиск
Список
Период
Сортировка

9.1.3: launching streaming replication

От
"Welty, Richard"
Дата:

i have a server in the ec2 cloud which in theory is set up as a master; it starts and runs. i've got an amazon s3 bucket mounted using s3fs on both the master and the standby (the standby is also set up in the ec2 cloud.)

i followed the steps here: http://wiki.postgresql.org/wiki/Streaming_Replication
and have the backup and the wal archive on the s3 bucket and they are both there.

when i go to start the hot standby, i pretty consistently get


LOG:  entering standby mode
cp: cannot stat `/db-backup/wal_archive/000000010000000000000001': No such file or directory
WARNING:  WAL was generated with wal_level=minimal, data may be missing
HINT:  This happens if you temporarily set wal_level=minimal without taking a new base backup.
FATAL:  hot standby is not possible because wal_level was not set to "hot_standby" on the master server
HINT:  Either set wal_level to "hot_standby" on the master, or turn off hot_standby here.
LOG:  startup process (PID 29938) exited with exit code 1
LOG:  aborting startup due to startup process failure


and the startup of the hot standby fails. the Riggs admin cookbook says "you will need a short delay", but has no guesstimate on the length required. i don't even know if i'm seeing this problem or something else.

if i need to run a new backup, what cleanup do i need to do of old backups and wal_archives? could this be interfering with the startup of the standby? i've gone through several iterations and fixed some problems, and wonder if there's obsolete data that is messing things up?

thanks,
   richard

Re: 9.1.3: launching streaming replication

От
Michael Nolan
Дата:


On Mon, Apr 2, 2012 at 4:21 PM, Welty, Richard <rwelty@ltionline.com> wrote:

I got similar messages the first few times I tried to start up my slave server, I never did figure out exactly what caused it.

You can either delete all the files on the slave and try again, or do what I did, write a script that handles transferring just the files needed to resync the slave.

Here's the script I've been using to transfer the files between my two servers to resync them. This is not a production-ready script.

I have a second tablespace, so there are two 'data' transfers plus the xlog transfer.  (You may run into issues transferring the pg_tblspc directory, as I did, hence the '-safe-links' parameter.) The '-delete' term deletes any files on the slave that aren't on the server, unless you list them in an '--exclude' clause.)

/usr/local/pgsql/bin/psql -c "select pg_start_backup('tardir',true)" postgres postgres

rsync -av --exclude log.out --exclude postgresql.conf \
--exclude postgresql.pid --delete --exclude pg_hba.conf \
--exclude pg_xlog --exclude server.crt --exclude server.key \
--exclude restore.conf --exclude restore.done \
--safe-links /usr/local/pgsql/data/ postgres@xxx:/usr/local/pgsql/data

rsync -av /usr/local/pgsql/data2/ postgres@xxx:/usr/local/pgsql/data2

/usr/local/pgsql/bin/psql -c "select pg_stop_backup()" postgres postgres

rsync -av /usr/local/pgsql/data/pg_xlog postgres@xxx:/usr/local/pgsql/data/

echo "ok to start standby"

--
Mike Nolan


Re: 9.1.3: launching streaming replication

От
Michael Nolan
Дата:


On Mon, Apr 2, 2012 at 6:19 PM, Michael Nolan <htfoot@gmail.com> wrote:



I got similar messages the first few times I tried to start up my slave server, I never did figure out exactly what caused it.


One possibility is that I may not have restarted the master server after changing the postgresql.conf file, thus the server still didn't know it was going into hot-standby mode.
--
Mike Nolan

Re: 9.1.3: launching streaming replication

От
"Welty, Richard"
Дата:

thanks for the suggestions. the light has gone on and i have it working as of about 15 minutes ago. i'm going to revisit the documentation and possibly make suggestions about making things a little clearer, or else issue a mea culpa about my reading comprehension. don't know which just yet.

richard

-----Original Message-----
From: Michael Nolan [mailto:htfoot@gmail.com]
Sent: Mon 4/2/2012 7:19 PM
To: Welty, Richard
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] 9.1.3: launching streaming replication

On Mon, Apr 2, 2012 at 4:21 PM, Welty, Richard <rwelty@ltionline.com> wrote:

I got similar messages the first few times I tried to start up my slave
server, I never did figure out exactly what caused it.

You can either delete all the files on the slave and try again, or do what
I did, write a script that handles transferring just the files needed to
resync the slave.

Here's the script I've been using to transfer the files between my two
servers to resync them. This is not a production-ready script.

I have a second tablespace, so there are two 'data' transfers plus the xlog
transfer.  (You may run into issues transferring the pg_tblspc directory,
as I did, hence the '-safe-links' parameter.) The '-delete' term deletes
any files on the slave that aren't on the server, unless you list them in
an '--exclude' clause.)

/usr/local/pgsql/bin/psql -c "select pg_start_backup('tardir',true)"
postgres postgres

rsync -av --exclude log.out --exclude postgresql.conf \
--exclude postgresql.pid --delete --exclude pg_hba.conf \
--exclude pg_xlog --exclude server.crt --exclude server.key \
--exclude restore.conf --exclude restore.done \
--safe-links /usr/local/pgsql/data/ postgres@xxx:/usr/local/pgsql/data

rsync -av /usr/local/pgsql/data2/ postgres@xxx:/usr/local/pgsql/data2

/usr/local/pgsql/bin/psql -c "select pg_stop_backup()" postgres postgres

rsync -av /usr/local/pgsql/data/pg_xlog postgres@xxx:/usr/local/pgsql/data/

echo "ok to start standby"

--
Mike Nolan