0

I am a newbie with cluster... We use a Tomcat application which works on CentOS servers.

Does it possible to get a Load Balancing with only 2 servers ? An active/active cluster. I know it's possible with HAProxy but in this case, we have to add a third server.

Does it possible to create a cluster architecture with my 2 CentOS servers and have a virtual IP to join my both servers ?

Thanks

3 Answers 3

0

Regarding terminology, I do not call most load balancers clusters. The hosts behind them can be quite independent, unlike clusters.

A load balancer can be in front of one or more hosts. Yes all the back end hosts can be active. Two or more for high availability.

In many designs, the load balancer is the only component that needs a virtual IP (aka service address). It will pick a host and forward the request to be serviced.

You probably want at least 3 VMs, one for the load balancer, and two for the back end hosts to serve requests. The number and specs would need design depending on your high availability and performance requirements. For example, you might make the load balancer a highly available VM or use a hardware appliance.

Whether or not your application needs shared state (database) and how to implement that it is another topic.

3
  • Hi John,Thank for your answer...our needs is to be able to join a Tomcat Application which are on 2 servers (the database on a third server). I have to isntall an other server with HAProxy ? It's not possible to do this with Keepalived (so keeping only 2servers and without using HAproxy ) ? Thank you very much !
    – Djé Djé
    Jan 30, 2017 at 13:21
  • Different designs are possible. You could simply put two A or AAAA records in DNS for the service name, but you have no control over clients preferring one or the other. Read Red Hat's Load Balancer Administration guide. Its sample configurations using keepalived and/or haproxy use 4 hosts, to make both the load balancer and backend highly available. Jan 31, 2017 at 0:57
  • Oki, thank you John... So I need one more server to have my Load Balancing !
    – Djé Djé
    Jan 31, 2017 at 7:03
0

We want to do the same things as you : have a virtual IP which is assigned to both servers.

We are running on CentOS 7.

So we do this :

  • Cluster01 : 10.10.10.11
  • Cluster02 : 10.10.10.12
  • VirtualIP : 10.10.10.10

On Cluster 01 :

iptables -I INPUT -i ens160 -d 10.10.10.10 -j CLUSTERIP --new --hashmode sourceip --clustermac 01:00:5E:00:00:20 --total-nodes 2 --local-node 1
ip addr add 10.10.10.10/24 dev ens160

On Cluster 02 :

iptables -I INPUT -d 10.66.66.10 -i ens160  -j CLUSTERIP --new --hashmode sourceip --clustermac 01:00:5E:00:00:20 --total-nodes 2 --local-node 2
ip addr add 10.10.10.10/24 dev ens160

We are able to ping the VirtualIP (but only from Cluster01 & Cluster02). We add manually the HW address on arp cache :

arp -i ens160 -s 10.10.10.10 01:00:5E:00:00:20 

iptables -L -n -v

Chain INPUT (policy ACCEPT 2221 packets, 151K bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 CLUSTERIP  all  --  ens160 *       0.0.0.0/0            10.10.10.10          CLUSTERIP hashmode=sourceip clustermac=01:00:5E:00:00:20 total_nodes=2 local_node=2 hash_init=0

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 1536 packets, 1412K bytes)
 pkts bytes target     prot opt in     out     source               destination

On both servers we have the file /proc/net/ipt_CLUSTERIP/10.66.66.10

From my workstation, I can access to my web page on Cluster01 & Cluster02 & VirtualIP. But the Load Balancing doesn't work...it is only the same server which answer...

-1

I'm a little bit sad because we can do this with Windows but not with Linux: / (with NLB)

It's not possible to do this with CLUSTERIP ?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .