Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Postgres 9.2 replica can't catchup to master

$
0
0

I have configured a master/replica setup for postgres 9.2 on Amazon Linux. PS output shows that the replica is connected and streaming, but also recovering. This has been going on for about 24 hours.

I have been frequently listing the contents of data/pg_xlog on the replica and it appears that streaming is working from the master, but it is always ~20 minutes behind (Note that 0000000800002F5B000000D6 was written at 10:19 and is currently recovering)

-rw-------  1 postgres postgres 16777216 Jan  1 10:19 0000000800002F5B000000D6
-rw-------  1 postgres postgres 16777216 Jan  1 10:20 0000000800002F5B000000D7
-rw-------  1 postgres postgres 16777216 Jan  1 10:22 0000000800002F5B000000D8
-rw-------  1 postgres postgres 16777216 Jan  1 10:21 0000000800002F5B000000D9
-rw-------  1 postgres postgres 16777216 Jan  1 10:23 0000000800002F5B000000DA
-rw-------  1 postgres postgres 16777216 Jan  1 10:24 0000000800002F5B000000DB
-rw-------  1 postgres postgres 16777216 Jan  1 10:26 0000000800002F5B000000DC
-rw-------  1 postgres postgres 16777216 Jan  1 10:25 0000000800002F5B000000DD
-rw-------  1 postgres postgres 16777216 Jan  1 10:28 0000000800002F5B000000DE
-rw-------  1 postgres postgres 16777216 Jan  1 10:27 0000000800002F5B000000DF
-rw-------  1 postgres postgres 16777216 Jan  1 10:30 0000000800002F5B000000E0
-rw-------  1 postgres postgres 16777216 Jan  1 10:29 0000000800002F5B000000E1
-rw-------  1 postgres postgres 16777216 Jan  1 10:31 0000000800002F5B000000E2
-rw-------  1 postgres postgres 16777216 Jan  1 10:32 0000000800002F5B000000E3
-rw-------  1 postgres postgres 16777216 Jan  1 10:33 0000000800002F5B000000E4
-rw-------  1 postgres postgres 16777216 Jan  1 10:34 0000000800002F5B000000D2
-rw-------  1 postgres postgres 16777216 Jan  1 10:35 0000000800002F5B000000E6
-rw-------  1 postgres postgres 16777216 Jan  1 10:36 0000000800002F5B000000E7
-rw-------  1 postgres postgres 16777216 Jan  1 10:37 0000000800002F5B000000E8
-rw-------  1 postgres postgres 16777216 Jan  1 10:38 0000000800002F5B000000E9
-rw-------  1 postgres postgres       56 Nov 27  2013 00000008.history
drwx------  2 postgres postgres  2408448 Jan  2 10:37 archive_status

[root@postgres-replica pg_xlog]# ps ax | grep postgres
3828 ?        Ss     0:00 postgres: logger process
3829 ?        Ss     0:45 postgres: startup process   recovering 0000000800002F5B000000D6
3830 ?        Ss     0:29 postgres: checkpointer process
3831 ?        Ss     0:02 postgres: writer process
3870 ?        Ss     0:09 postgres: stats collector process
4014 ?        Ss     1:14 postgres: wal receiver process   streaming 2F5B/D6046A78
4489 ?        Ss     0:29 postgres: sbreader studyblue [local] idle
11611 pts/0    S+     0:00 grep --color=auto postgres
[root@postgres-replica pg_xlog]# date
Sat Jan  2 10:38:25 PST 2016

Here are the values I believe are relevant in the master postgresql.conf:

wal_level = hot_standby
max_wal_senders = 3
wal_keep_segments = 1440
hot_standby = on
archive_timeout = 60
archive_mode = on

The replica's data directory was created from a ebs snapshot of the master's data directory, with the following recovery.conf and postgresql.conf values:

standby_mode='on'
primary_conninfo='host=postgres-master.xxxxxxx.com port=5432 user=replicator
password=xxxxxxx'
trigger_file = '/var/lib/pgsql/9.2/data/failover_trigger'

wal_level = hot_standby
max_wal_senders = 3
wal_keep_segments = 1440
hot_standby = on
archive_timeout = 60
archive_mode = on

The replica uses a smaller EC2 instance type with 2 cores, but top shows load average under 1 and CPU spikes only to 1 or 2%.


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>