<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Look at the order.</div>
<div>Master/replication VIP ist started after promote and stopped after demote.</div>
<div>listen_addresses = "*" means dont take care about specific interfaces, so it will listen on all interfaces not matter if they are coming up or switching down after postgres start.</div>
<div>
<div> </div>
<div>The master either sets the promotion score to CAN_PROMOTE=100 or CAN_NOT_PROMOTE=-INF.</div>
<div>For every slave which is in sync it sets 100 and for each missing sync -INF.</div>
<div>When the master is away all slaves fall back to the funtion have_master_right. Now the normal election begins. Every slave writes its own xlog location and the one with the highest value set promotion score to 1000.</div>
<div>All slaves which are not in sync dont participate in the master election any more. This is the starting code of function have_master_right.</div>
<div> </div>
<div>Rainer</div>
<div> </div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Freitag, 29. März 2013 um 12:33 Uhr<br/>
<b>Von:</b> "Steven Bambling" <smbambling@arin.net><br/>
<b>An:</b> "The Pacemaker cluster resource manager" <pacemaker@oss.clusterlabs.org><br/>
<b>Betreff:</b> Re: [Pacemaker] PGSQL resource promotion issue</div>
<div name="quoted-content">
<div>
<div>
<div>On Mar 28, 2013, at 8:13 AM, Rainer Brestan <<a href="rainer.brestan@gmx.net" target="_parent">rainer.brestan@gmx.net</a>> wrote:</div>
<blockquote>
<div>
<div style="font-family: Verdana;font-size: 12.0px;">
<div>Hi Steve,</div>
<div>i think, you have misunderstood how ip addresses are used with this setup, PGVIP should start after promotion.</div>
<div>Take a look at Takatoshi´s Wiki.</div>
<div><a href="https://github.com/t-matsuo/resource-agents/wiki/Resource-Agent-for-PostgreSQL-9.1-streaming-replication" target="_blank">https://github.com/t-matsuo/resource-agents/wiki/Resource-Agent-for-PostgreSQL-9.1-streaming-replication</a></div>
</div>
</div>
</blockquote>
<div> </div>
<div>I see that he has the master/replication VIPs with a resource order to force promotion before moving the VIPs to the new master. </div>
</div>
<div> </div>
<div> <span class="Apple-tab-span" style="white-space: pre;"> </span>I don't get how the postgres service is going to listen on those interfaces if they have not already migrated to the new master. Even with setting the listen_addresses = "*"</div>
<div>
<blockquote>
<div>
<div style="font-family: Verdana;font-size: 12.0px;">
<div> </div>
<div>The promotion sequency is very simple.</div>
<div>When no master is existing, all slaves write their current replay xlog into the node attribute PGSQL-xlog-loc during monitor call.</div>
</div>
</div>
</blockquote>
<div>Does this also hold true if a Master fails? </div>
<div> </div>
<div>From the looks of it, if there was a Master before the failure that the master score is set from the function that grabs the data_status from the master (STREAMING|SYNC, STREAMING|ASYNC, STREAMING|POTENTIAL, etc ). </div>
<div> </div>
<div>The reason I ask is if the master fails and the slaves don't then compare their xlog location, there is a potential for data loss if the incorrect slave is promoted.</div>
<div> </div>
<blockquote>
<div>
<div style="font-family: Verdana;font-size: 12.0px;">
<div>You can see all them with crm_mon -A1f.</div>
<div>Each slave gets these attributes from all node configured in parameter node_list (hopefully your node names in Pacemaker are the same as in node_list) and compares them to get the highest.</div>
<div>
<div>If the highest is this list is the own one, it sets the master-score to 1000, on other nodes to 100.</div>
<div>Pacemaker then selects the node with the highest master score and promote this.</div>
<div> </div>
<div>Rainer</div>
<div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);">
<div style="margin: 0 0 10.0px 0;"><b>Gesendet:</b> Mittwoch, 27. März 2013 um 14:37 Uhr<br/>
<b>Von:</b> "Steven Bambling" <<a href="smbambling@arin.net" target="_parent">smbambling@arin.net</a>><br/>
<b>An:</b> "The Pacemaker cluster resource manager" <<a href="pacemaker@oss.clusterlabs.org" target="_parent">pacemaker@oss.clusterlabs.org</a>><br/>
<b>Betreff:</b> Re: [Pacemaker] PGSQL resource promotion issue</div>
<div>
<div>In talking with andreask from IRC, I miss understood the need to include the op monitor. I figured it was pulled from the resource script by default.
<div> </div>
<div>I used pcs to add the new attributes and one was then promoted to master </div>
<div> </div>
<div>pcs resource add_operation PGSQL monitor interval=5s role=Master</div>
<div>pcs resource add_operation PGSQL monitor interval=7s</div>
<div> </div>
<div>v/r</div>
<div> </div>
<div>STEVE</div>
<div> </div>
<div>On Mar 27, 2013, at 7:08 AM, Steven Bambling <<a>smbambling@arin.net</a>> wrote:</div>
<div>
<div>
<blockquote>
<div>
<div> </div>
I've built and installed the lastest resource-agents from github on Centos 6 and configured two resources
<div>
<div> </div>
<div>1 primitive PGVIP:</div>
<div>pcs resource create PGVIP ocf:heartbeat:IPaddr2 ip=10.1.22.48 cidr_netmask=25 op monitor interval=1</div>
<div> </div>
<div>Before setting up the PGSQL resource I manually configured sync/streaming replication on the three nodes with <a href="http://p1.example.com/" target="_blank">p1.example.com</a> as the master and verified that replication was working. I think removed the synchronous_standby_name from my postgresql.conf and stop all postgres services on all nodes</div>
<div> </div>
<div>1 master/slave PGSQL: -- I've the resource to use sync replication. Also I am using PGSQL 9.2.3</div>
<div> </div>
<div>pcs resource create PGSQL ocf:heartbeat:pgsql params pgctl="/usr/pgsql-9.2/bin/pg_ctl" pgdata="/var/lib/pgsql/9.2/data" config="/var/lib/pgsql/9.2/data/postgresql.conf" stop_escalate="5"<b> rep_mode="sync" </b>node_list="<a href="http://p1.example.com/" target="_blank">p1.example.com</a> p2.<a href="http://example.com/" target="_blank">example.com</a> p3.<a href="http://example.com/" target="_blank">example.com</a>" restore_command='cp /var/lib/pgsql/9.2/archive/%f "%p"' master_ip="10.1.22.48" repuser="postgres" restart_on_promote="true" tmpdir="/var/lib/pgsql/9.2/tmpdir" xlog_check_count="3" crm_attr_timeout="5" check_wal_receiver="true" --master</div>
<div> </div>
<div>I'm able to successfully get all the nodes in the cluster started and the PGVIP resource starts on the 1st node and the PGSQL:[012] resource start on each node in the cluster. The one thing I don't understand is why none of the slaves is taking over the master role.</div>
</div>
<div> </div>
<div>Also how would I go about force promoting one of the slaves into the master role via the PCS command line utility. </div>
<div> </div>
<div>v/r</div>
<div> </div>
<div>STEVE</div>
</div>
_______________________________________________<br/>
Pacemaker mailing list: <a> Pacemaker@oss.clusterlabs.org</a><br/>
<a href="http://oss.clusterlabs.org/mailman/listinfo/pacemaker" target="_blank">http://oss.clusterlabs.org/mailman/listinfo/pacemaker</a><br/>
<br/>
Project Home: <a href="http://www.clusterlabs.org" target="_blank">http://www.clusterlabs.org</a><br/>
Getting started: <a href="http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf" target="_blank"> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf</a><br/>
Bugs: <a href="http://bugs.clusterlabs.org" target="_blank">http://bugs.clusterlabs.org</a></blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br/>
Pacemaker mailing list: <a href="Pacemaker@oss.clusterlabs.org" target="_parent">Pacemaker@oss.clusterlabs.org</a><br/>
<a href="http://oss.clusterlabs.org/mailman/listinfo/pacemaker" target="_blank">http://oss.clusterlabs.org/mailman/listinfo/pacemaker</a><br/>
<br/>
Project Home: http://www.clusterlabs.org<br/>
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf<br/>
Bugs: http://bugs.clusterlabs.org</blockquote>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>