postgres-replication 471 Bytes
Newer Older
1
#!/bin/bash
2

3
replication_include="include 'replication.conf'"
4
postgres_dir="$( cd "$1" && pwd )"
5

6 7 8 9 10 11 12
if ! grep -Fxq "$replication_include" $postgres_dir/data/postgresql.conf; then
  echo $replication_include >> $postgres_dir/data/postgresql.conf
fi

if [ ! -f "$postgres_dir/data/replication.conf" ]; then
  cat <<EOF > $postgres_dir/data/replication.conf
wal_level = hot_standby
13
max_replication_slots = 1
14 15 16 17 18
max_wal_senders = 10
wal_keep_segments = 10
hot_standby = on
EOF
fi