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

When do I have to use archive_command and when not

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

Problem

I have some doubts about PostgreSQL replication command. I am doing some research and I found severals configurations.

first one is:

archive_mode = on
archive_command = 'cd .'


second one is :

cp -i %p /var/lib/postgresql/9.1/archive/%f'


Then my questions are:

  • What is the different?



  • The first one option ( command ) is really strange to me. What do it


do?

Solution

The first one (cd .) does nothing. It's a placeholder. It would be better to write true in my view, so it's more obviously intended as a no-op.

Turning archive_mode on but setting a no-op archive_command is a hacky workaround for the fact that changing archive_command only requires a server reload, but changing archive_mode requires a full server restart that can be disruptive in production.

The purpose of the archive_command, and all the rest, is covered in the documentation so I won't repeat all that material there.

Context

StackExchange Database Administrators Q#77626, answer score: 2

Revisions (0)

No revisions yet.