HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

timeline 2 of the primary does not match recovery target timeline 1

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thetimelineprimarytargetmatchrecoverydoesnot

Problem

I want to create a configuration with postgresql and pgpool to get height availability (HA). I want to do this:

.-----.                  .--------.
  |     |           W      |   DB   |
  | APP |-----+----------->| MASTER |----.
  |     |     |            |        |    |
  `-----`     |            `--------`    | STREAMING REPLICATION
              |            .--------.    |
              |     R      |   DB   |    |
              +----------->| SLAVE1 || SLAVE2 || SLAVE1 |---.          
              |            |        |   |
              |            `--------`   |
              |            .--------.   | STREAMING REPLICATION
              |     R      |   DB   |   |
              `----------->| SLAVE2 |<--`
                           |        |
                           `--------`


Follow the post for HA PostgreSQL Cluster by Streaming Replication + pgpool-II I am created 4 virtual machines (vm) with vagrant. One Master (M), two Slaves (S1 and S2) and other for pgpool (APP). When I do some queries in APP all work fine. When I stop the master, S1 is promoted to M and the S2 now have a new master. But this get me a problem. I don't know what this error mean and I am lost thinking how to fix it:

2014-08-18 17:04:56 UTC FATAL:  timeline 2 of the primary does not match recovery target timeline 1


I am using:

  • postgres 9.1



  • pgpool 3.1.1-1



UPDATE

This error is emitted by S2 when S1 is promoted to Master.

UPDATE 2

Nodes IP Address:

M  - 192.168.1.10
S1 - 192.168.1.11
S2 - 192.168.1.12
APP- 192.168.1.13


This is my recovery.conf file configuration for S1 and S2.

standby_mode = 'on'
primary_conninfo = 'host=192.168.1.10 port=5432 user=replicator password=replicator'
trigger_file = '/tmp/postgresql.trigger.5432'


UPDATE 3

Here is my backends into the /etc/pgpool2/pgpool.conf file:

```
...
backend_hostname0 = '192.168.1.10'
backend_port0 = 5432
backend_weight0 = 0
backend_data_directory0 = '/var/lib/postgresql/9.1/main'

Solution

The issue is covered in this detailed blog.

In short, the master and the standby servers must all have archive_mode = on and an archive_command, until 9.3 which removes this requirement.

Context

StackExchange Database Administrators Q#74326, answer score: 4

Revisions (0)

No revisions yet.