Can't start postgresql replication

2.2k views Asked by At

We have postgresql replication on different server. So today I was doing some optimization on replication cluster postgresql.conf

After doing replication, I restarted postgresql with this command:

pg_ctlcluster 9.2 main2 restart

But instead of restarting, it gave this error:

The PostgreSQL server failed to start. Please check the log output.

And checking the log, I see this:

2015-06-16 12:18:16 EEST [10655]: [2-1] LOG:  received smart shutdown request
2015-06-16 12:18:16 EEST [10661]: [2-1] FATAL:  terminating walreceiver process due to administrator command
2015-06-16 12:18:16 EEST [10658]: [1-1] LOG:  shutting down
2015-06-16 12:18:16 EEST [10658]: [2-1] LOG:  database system is shut down

Checking log now it shows the last restart log, but log does not update, when I try to start server. It says check the log, but there is no new information, even if I try to start server again.

P.S. Do I need to do anything on master?

Update

Changing postgresql.conf settings back, started replication. But from error it is hard to tell what was wrong.

here are settings I changed (after they changing, they were the same as on master. When I commented it, only then I could start replication):

shared_buffers = 1536MB
effective_cache_size = 3072MB
checkpoint_segments = 15
checkpoint_completion_target = 0.9
autovacuum = on 
track_counts = on
work_mem = 25MB

So as I said, after commenting these, I could start it. But don't get it why it won't let start with these settings.

1

There are 1 answers

0
Aleksandar Pesic On

If I were you, and if upgrade is an option, the first thing I would do is to upgrade to PostgreSQL 9.4 (or newer). There's a good reason for do this when it comes to replication - a new feature called "replication slots" (see the announcement).

In short: replication slots are more robust and easier to implement than WAL archiving (you obviously use according to your logs).

In this post you'll find a comprehensive guide on implementing the feature.