Cluster a custom application

Hi guys.
I have a custom application which is written by java. I want to know is it possible to cluster this application by pacemaker. For example copy this application in two different nodes and setup a cluster by pacemaker. In one time only one application work and when primary node goes down my application start to work on second node in simple word i need a way to cluster my simple application like clustering nginx server with packemaker,

And also is there any solution to cluster two OS. If first OS goes down second OS start to serve request ?

Thanks in advance

High Availibility with Active/Passive Scenario should not be that hard. Clustering different Systems("OS") that way is also possible.

One major point is data storage. Most applications store data and thus this data needs to be shared between both systems. Either with a shared network storage, which has to be HA-enabled too or with a replication technology like drbd(aka "shared nothing") which is replicating the data in realtime.

In Front of your two application servers you may have a loadbalancer, which of course should also be HA-enabled.

All this could be done with pacemaker.

1 Like

thanks for your reply.
But I have a big problem. my application does not act like service ( port , init , systemd ). it's an application which is process some messages and send request to another server thus i can't use load balancer in front of my service. I want to know is there any solution to HA my application with pacemaker or other tools. because I dont know is there any resource for custom application.

Well if your application is not a service, that other clients can send requests to, then a loadbalancer is just not needed. You just have to make sure, that your service is up and healthy(scripting) and if not to fence(forcefully remote initiated shutdown/disconnect) the failed server/vm/container.

Common fencing methods are for example:

  • shutdown by baseboard power control(IPMI,AMT,iDrac,iLo,Remote Controllable Rack Power Distributor,..)
  • shutdown switch port of a managed switch
  • executing an arbitrary command(ssh vmhost kill vm, ...)

Further there is a need for clusters to have an unequal number of nodes within the cluster, so if there are different views of the system state on the different nodes, the cluster can reliably decide which node is failing. So you need at least 3 instances.

My practical experience of the pacemaker stack is a bit limited. I have read some about it and created several test setups, but I did not operate those directly managed systems. I have some few prebuilt solutions like proxmox(preferred, Open Source Variant available) or XCP NG(Open Source, Clone of Citrix XenServer aka Citrix Hypervisor), that offer HA-functionality for virtual machines.

1 Like

Thanks for your reply.
I want to deploy application on physical servers and I cannot use virtualization and VM. Furthermore methods like Vmware FT has some limitations like max no of VCPU and also RAM.
I think it should be much easier if I can use pacemaker as a cluster resource manager but I dont know how to introduce my application as a resource and how to route all traffic to my primary server and when server or application goes down traffic and requests route to other node.

Unfortunately my application is not like a service. normally my application gathers information from different servers and sends them to another servers thus methods like loadbalancer is not suitable for my scenario.

                                       *************\(floating IP\)************

| ***route all traffic on every port ***|
| ***************|
ServerA
ServerB
(APP) **************************(Stopped App)

I need a floating IP for my cluster and when serverA goes down All traffic switch to ServerB( Input and Output) also cluster start Stopped application on serverB. And when ServerA backs online all requests (Input or Output ) route to ServerA and Stop App on ServerB.

Hi,

what you write should be pretty basic functionality of corosync/pacemaker. Since I'm not very deep into this topic, I would have to read the documentation to give further hints on exactly how to do it.

So that's all I have to give right now. You may want to check google and the documentation for yourself, and I would be happy if you share your experiences and maybe configs afterwards.

Regards,
stomp

It might be clearer if you took this bit:

.... and wrapped it in CODE tags, the edited it to look how you would like.

Wrapping in CODE tags will respect the spaces which is important for indenting or fixed-width data, or in your case a text-based diagram. I've tried, but I'm not quite sure what you want to show.

A short tutorial is included below. The look/feel of the forum has changed, as have the buttons, but method 1 still works just fine.

Kind regards,
Robin

thanks for your reply rbatte1



                                          (floating IP)
                                                |
                                                |

                               route all traffic on every port                                                             
                                             /      \
                                           /          \

                                         /              \

                          ServerA                                                                                                ServerB 
                          (APP)                           (Stopped App)


When App On primary server fails



                                          (floating IP)
                                                |
                                                |

                               route all traffic on every  port                                                           
                                             /      \
                                           /          \

                                         /              \

                           ServerA                                                                                                 ServerB 
                          (APP is Down)             (Sart App On ServerB)



My application does not work based on port and it has send and receive on different ports.

1 Like

Any systemd or init script can be implemented in linux cluster as a resource.
So, you will need to write one of those, it should be fairly simple reading the docs.

Be sure to use resource group, as resources in it will follow constraint order, start from first defined to last, stop from last defined to first.

But, applications are mostly load balanced not clustered in classic way, as stomp mentioned.
Can you elaborate more on your application receiving data on any port, does it listen on thousands of ports :confused:

Using opensource with haproxy and keepalived one can do great things with backend app balancing and failover using VRRP.
Fairly short and simple configuration, unlike linux cluster which is a complex product.
Keep it simple, stupid if you can.

Hope that helps.
Regards
Peasant.

1 Like