Skip to content

Instantly share code, notes, and snippets.

@Sheridan
Created July 30, 2019 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sheridan/9ee4efff8b9ef18c11951ab6fa1edd8a to your computer and use it in GitHub Desktop.
Save Sheridan/9ee4efff8b9ef18c11951ab6fa1edd8a to your computer and use it in GitHub Desktop.
pacemaker/corosync pgcluster
property \
stonith-enabled=false \
no-quorum-policy=stop \
start-failure-is-fatal=true
primitive p_cluster_ip ocf:heartbeat:IPaddr2 \
params \
ip="10.0.0.10" \
nic=eth0 \
cidr_netmask="23" \
op start timeout=10s interval=0s on-fail=stop \
op monitor timeout=10s interval=2s on-fail=restart \
op stop timeout=10s interval=0s on-fail=block
primitive p_postgresql ocf:heartbeat:pgsql \
params \
pgctl="/usr/lib/postgresql/9.6/bin/pg_ctl" \
psql="/usr/lib/postgresql/9.6/bin/psql" \
pgdata="/var/lib/postgresql/9.6/main/" \
socketdir="/var/run/postgresql" \
pgport=5432 \
config="/etc/postgresql/9.6/main/postgresql.conf" \
logfile="/var/log/postgresql/9.6-main.log" \
rep_mode="sync" \
node_list="node-hotname02 node-hotname03" \
primary_conninfo_opt="keepalives_idle=60 keepalives_interval=5 keepalives_count=5" \
master_ip="10.0.0.10" \
restart_on_promote=true \
stop_escalate=8 \
stop_escalate_in_slave=4 \
replication_slot_name=replslot \
check_wal_receiver=true \
op start interval=0s timeout=60s on-fail=restart \
op monitor interval=9s timeout=60s on-fail=restart \
op monitor interval=10s timeout=60s on-fail=restart role=Master \
op promote interval=0s timeout=30s on-fail=restart \
op demote interval=0s timeout=120s on-fail=stop \
op stop interval=0s timeout=60s on-fail=ignore \
op notify interval=0s timeout=60s \
meta \
migration-threshold=1 \
resource-stickiness=1024 \
failure-timeout=10s
ms ms_postgresql p_postgresql \
meta \
master-max=1 \
master-node-max=1 \
clone-max=2 \
clone-node-max=1 \
notify=true \
target-role=Started \
interleave=true
location l_cluster_ip p_cluster_ip \
rule 300: p_postgresql-status eq "PRI" \
rule 200: p_postgresql-data-status eq "LATEST" \
rule 100: p_postgresql-status eq "HS:sync" \
rule -inf: not_defined p_postgresql-status \
rule -inf: p_postgresql-status ne "HS:sync" and \
p_postgresql-status ne "PRI"
location l_no_postgresql_on_quorum_node ms_postgresql \
rule -inf: #uname eq "node-hotname04"
colocation online_master inf: p_cluster_ip ms_postgresql:Master
order o_promote 0: ms_postgresql:promote p_cluster_ip:start sequential=true symmetrical=false
order o_demote 0: ms_postgresql:demote p_cluster_ip:stop sequential=true symmetrical=false
xml \
<alert \
id="alert_helper_sender" \
path="/usr/local/bin/cluster_alert_helper.sh" \
description="Log events to a file."> \
<recipient \
id="alert_helper_recipient" value="" /> \
</alert>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment