On Tue, 2019-07-16 at 12:28 +0530, Nishant Nakate wrote: > > On Tue, Jul 16, 2019 at 11:33 AM Ulrich Windl < > [email protected]> wrote: > > >>> Nishant Nakate <[email protected]> schrieb am 16.07.2019 > > um 05:37 in > > Nachricht > > <CANTAVSkfNnx=ZQv+UftaKs76Htk3VU+kO=bqhroj4sszx+o...@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 pacemaker, this is a typical promotable (master/slave) clone workload. See the Pacemaker Explained section on clones: https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/2.0/html-single/Pacemaker_Explained/index.html#s-resource-clone (That's for pacemaker 2.0, the syntax is slightly different but the concepts are the same for 1.1.) As others have mentioned, you don't need to care about the DC for this -- pacemaker will automatically select one of your nodes to be your master. > 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 ? > > > > 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++. You can keep your services in C++ and write a small OCF agent as a shell script wrapper (almost identical to an init script, if you're familiar with those). See the Pacemaker Administration section on OCF agents: https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/2.0/html-single/Pacemaker_Administration/#_ocf_resource_agents That's pretty basic; you can find more guides elsewhere online. You can start with the Stateful dummy resource agent shipped with pacemaker as a template. One thing that's not covered in detail is master scores. Your agent has to set a master score for each node, and the node with the highest master score will be chosen as master. Your agent uses the crm_master command to do this (see its man page for details). Good luck, and let us know how it goes. > > > > > > Please let me know if you need any clarification or any other > > information. > > > > > > Thanks in advance !!! -- Ken Gaillot <[email protected]> _______________________________________________ Manage your subscription: https://lists.clusterlabs.org/mailman/listinfo/users ClusterLabs home: https://www.clusterlabs.org/
