开发者

Fault-Tolerant in client-server architectire

开发者 https://www.devze.com 2023-03-05 18:16 出处:网络
I have a java server that serve many clients using Sockets In case of a failure of the main server I wanted a back server to take over automaticaly.

I have a java server that serve many clients using Sockets In case of a failure of the main server I wanted a back server to take over automaticaly. What I did is, I put the ip开发者_StackOverflow中文版 address and the port of the back up server in the client side and when a timeout occure I just connect to the back up server. Is it the right decision or I should put the backup server coordinates on the server side and transfer it to the client when it connect ?

Thanks


Having the server send a backup address to the client is a good idea, it is easier to administer this data centrally.

The backup server addresses should be in a property file on the client too however (or in a central configuration databse read by the clients and servers), otherwise it cannot find the backup when it starts while the primary is down.


I suppose it would be more robust to store the backup server info on the server -- that way it could be much more easily changed. And if the client switched to the backup, the backup could announce where it's backup was.

It is possible to handle this with a hardware load-balancer, as well, although this works much more easily with connectionless protocols. It is certainly simpler, though, just to use hardware that lets the backup machine step in automatically when the main server goes down.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号