Daniel Kim
Daniel Kim

Reputation: 267

postgresql streaming replication -- continuous archiving?

im trying to set up streaming replication, but for some reason when i update the database on the master, the changes are not reflected on the standby server UNTIL i restart the postgresql service on the master. (i see new xlog files in master server but these do not get synced to the standby server). when i restart the service on master, i finally see new files added to my shared wal_archive folder

the only way I can make it sync automatically is if i set the archive_timeout.

Master:

wal_level = 'hot_standby'   # minimal, archive, hot_standby, or logical
archive_mode = on           # allows archiving to be done
                            # (change requires restart)
archive_command = 'copy "%p" "\\\\VBOXSVR\\wal_archive\\%f"'
max_wal_senders = 3         # max number of walsender processes
                            # (change requires restart)
wal_keep_segments = 10      # in logfile segments, 16MB each; 0 disables

pb_hba.conf

host    replication  postgres    slaveip/32      trust

Upvotes: 1

Views: 1529

Answers (1)

Craig Ringer
Craig Ringer

Reputation: 324265

It sounds like you're using archive-based replication without streaming. So it's only replicating when a WAL archive is finished and a new one is opened, which happens:

  • When the server does a checkpoint before a clean shutdown
  • When a WAL archive is filled by write activity and a new one is needed
  • at archive_timeout time

If you want continuous replication you need to use streaming replication. See the manual for details. This involves setting a connection string in your downstream server's recovery.conf so it can connect directly to the upstream master to receive new writes in near-real-time.

You should still leave archive based replication enabled, because this allows the replica to recover if it's disconnected for a while. It's also useful for point-in-time recovery.

Upvotes: 2

Related Questions