[ClusterLabs] Antw: Interacting with Pacemaker from my code

Klaus Wenninger kwenning at redhat.com
Tue Jul 16 02:39:13 EDT 2019


On 7/16/19 8:03 AM, Ulrich Windl 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.
DC is actually a pacemaker-internal role and it would really have
to be checked carefully if an application role should be tied to that
pacemaker role.
If you are looking for the possibility of giving a single instance of your
application on one of the nodes a special role you might have a
look at promotable-resources (master/slave-resources historically).
If you still want to know which node has the DC role you can of
course use the same interface crm_mon is using
(read the cib - some kind of cluster-database holding both
configuration and live-data). There are new interfaces in the works
apart from this C-API but I'm not sure if anything is already available
right now.
As a last resort - or your method of choice depending on how often you
need the information and how quickly you need to be updated - you can
of course consider parsing the output ofsome existing cmdline-tool
(e.g. xml-output of crm_mon).

Klaus
>
>> 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.
>
>> 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