Search code examples
architecturefailoverterracotta

Single point of access for failover


This is what I am trying to achieve but I'm not familiar with the subject well enough, so please bear with me :)

I've got a server to which some devices get connected and periodically upload some data. Communication is done over plain TCP sockets using a proprietary protocol we designed for speed and efficiency. Every such connection is basically a session which is open as long as device stays connected. What I need now is (1) design failover mechanism and (2) scale up. There would be another server node which would pick up once first instance fails. I've been looking at Terracotta to do a lightweight cluster. But what I don't understand is HOW would devices know to run for the second node?? I could probably "teach" them to try several access points.. but this would really be a pain as some of them are out of my control. Ideally, I want some magic in a middle which would re-redirect connection automatically to any available node in a cluster.

Now. First thing I want to know is how such tools called in a world. Second - I need simple off-the-shelf solution, preferably free or open source with friendly commercial license. We don't use any heavy weight containers, server instance is a bunch of POJO's wired up with Spring, everything runs in one JVM. Ideally, I would like to place such magic box on one of the nodes, expose single IP/port for all devices and do some config. setup. Is this possible or am I dreaming for cheap solution on a tough problem?


Solution

  • You are looking for Load balancing, I think. You can pick from software or hardware solution. In both cases idea is the same: load balancer will monitor the state of both nodes and route connections to one which is alive.

    Try this link, as an example.