I want to setup an HA installation of a Java application - one instance active and one instance in stand-by on different machines - that processes every 15 minutes some data saved in a DB. I want that in case the active instance crashes (or the host machine) the stand-by instance takes over and continues the processing.
I’ve looked at the documentation but I haven’t found information regarding HA.
Am I on a wrong way?
HA isn’t part of Docker, but Docker can help.
For that specific case, I would suggest having a work queue in the same database, and let both Java-worker machines poll it. Let them both work rather than keeping one in standby. When a worker checks for a job, it also checks to see if the previous jobs have completed. Come up with a strategy for retrying old jobs (you would have needed this in any HA setup) if they’re not completed.
So if either worker goes down, the other keeps going. If the database itself goes down, there’s no work to do anyway (though you could have the workers alert you).
In this case, Docker helps make deploying identical workers trivial. The
docker daemon will automatically restart a worker container if it crashes, so that helps with resilience.