[ClusterLabs] Antw: Re: Antw: Interacting with Pacemaker from my code

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Tue Jul 16 05:19:36 EDT 2019

>>> Nishant Nakate <technonsquare at gmail.com> schrieb am 16.07.2019 um 08:58 in
<CANTAVSnEyDUVqrs4TwiOcpuc+HUc4YPWrZu5PSiXpRADvGBXxQ at mail.gmail.com>:
> On Tue, Jul 16, 2019 at 11:33 AM Ulrich Windl <
> Ulrich.Windl at rz.uni-regensburg.de> wrote:
>> >>> Nishant Nakate <technonsquare at gmail.com> schrieb am 16.07.2019 um
>> 05:37 in
>> Nachricht
>> <CANTAVSkfNnx=ZQv+UftaKs76Htk3VU+kO=bqHrOj4ssZx+Ou4A at mail.gmail.com>:
>> > Hi All,
>> >
>> > I am new to this community and HA tools. Need some guidance on my current
>> > handling pacemaker.
>> >
>> > For one of my projects, I am using pacekmaker for high availability.
>> > Following the instructions provided in setup document, I am able to
>> create
>> > a new cluster with three nodes. Tested the failover and it works as
>> > expected. Now, I need to run our own code on this nodes. I am going to
>> use
>> > Active-Pasive topology for our system architecture.
>> >
>> > I would like to know, how can I detect from my code if DC has changed ?
>> So
>> > that tools running on new DC can take over the controll of application
>> > logic.
>> Why would you need that? crm_mon shows where ther DC is.
>> Thanks you Ulrich for your quick response.
> I will give you a quick overview of the system. There would be 3 nodes
> configured in a cluster. One would act as a leader and others as followers.
> Our system would be actively running on all the three nodes and serve
> external services assigned to them. On top of that, the Leader would have
> some services running. In case the leader node (DC) fails, load of failed
> leader needs to be distributed among followers. One should get elected as
> next leader and start the additional services the previous leader was
> running.
> In this case, a our system daemon running on the next node (designated as
> new coordinater) needs to know that DC has changed and start the additional
> services. Hope this clarifies my need.
> AFAIK, crm_mon (or dcs) needs to be run from command line. Are you
> suggesting that I create a service which runs crm_mon and parse the ourput
> in a loop to check changes in DC/resources ?


Still I don't see the dependency on the cluster's DC: You could put your coordinator resources in a group (for example) and place the other resources on different nodes. That group could run on any node, DC or not.

>> > Also, how to configure my processes (tools) as resources so that
>> Pacemaker
>> > can make them HA.
>> You'll have to write an RA (resource agent) at least, but more importantly
>> the application has the be designed for HA to be effective.
> We are currently designing the services which are all stateless. If you
> have any quick suggestions to be considered, please let me know. Also, what
> type of RA would be helpful in this case. My services would be written in
> C++.

C++ will give you top performance and great control, but usually RAs are written as shell scripts, being able to use a library of convenience functions like ocf_log:

ocf_log info "$1: activating crontab $crontab"

>> >
>> > Please let me know if you need any clarification or any other
>> information.
>> >
>> > Thanks in advance !!!
>> _______________________________________________
>> Manage your subscription:
>> https://lists.clusterlabs.org/mailman/listinfo/users 
>> ClusterLabs home: https://www.clusterlabs.org/ 

More information about the Users mailing list