[ClusterLabs] Antw: Interacting with Pacemaker from my code

Andrei Borzenkov arvidjaar at gmail.com
Tue Jul 16 03:24:42 EDT 2019


On Tue, Jul 16, 2019 at 9:48 AM Nishant Nakate <technonsquare at gmail.com> wrote:
>
>
> 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.

No, it does not. You still did not explain why your service must run
on the node that currently has DC role. You either misunderstand what
DC is or you use "DC" for something that is not pacemaker Designated
Coordinator.

The behavior you describe is default pacemaker behavior - resource
will run on one node and will be restarted on another node in case of
failures (node or resource). No need to do anything special.

>
> 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 ?
>
>>
>> > 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++.
>>
>>
>> >
>> > 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/
>
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/users
>
> ClusterLabs home: https://www.clusterlabs.org/


More information about the Users mailing list