Re: streaming replication does not work across datacenter with 20ms latency? - Mailing list pgsql-general

From Tomas Vondra
Subject Re: streaming replication does not work across datacenter with 20ms latency?
Date
Msg-id 4E2C8067.2010803@fuzzy.cz
Whole thread Raw
In response to Re: streaming replication does not work across datacenter with 20ms latency?  (Yan Chunlu <springrider@gmail.com>)
Responses Re: streaming replication does not work across datacenter with 20ms latency?  (Yan Chunlu <springrider@gmail.com>)
List pgsql-general
Dne 24.7.2011 14:46, Yan Chunlu napsal(a):
> checkpoint_segments = 64
> wal_keep_segments = 128

This information alone is not sufficient - we don't know how much write
activity is on the primary system, so we can't say if those number are
sufficient or not. You have to tune them according to write activity on
the primary server.

For example let's suppose the current WAL segment on the primary is "1"
and that it's configured with wal_keep_segments = 5 (i.e. about 80MB of
data).

Before you prepare and start the slave machine, someone writes 100MB of
data to the primary database (one big insert/update or a lot of small
ones, doesn't matter). 100MB is about 6 WAL segments, so the current WAL
segment on the primary is 7, and because of wal_keep_segments there are
segments 3,4,5,6,7 available.

But when the slave connects, it asks for segment no. 2 and it's not
available. It's not possible to skip that segment so the replication
fails to start.

If the primary only received 60MB of data, it'd probably worked (there'd
be enough segments kept on the primary).

Those 128 segments is about 2GB of data. How much data is written on the
primary between creating a filesystem copy and starting the slave?

You don't neet to keep the files on the master, you can set up archiving
and keep them somewhere else (on a different system etc.).

Tomas


pgsql-general by date:

Previous
From: Chris Travers
Date:
Subject: Re: weird table sizes
Next
From: Mario Puntin
Date:
Subject: Disallow access from psql, or allow access only from specific client app