Access a service from a swarm outside docker

Hi there!
I’m trying to set up a postgres cluster using docker swarm mode with 4 nodes. So to access my database I’ll need to connect to any out of those 4 nodes on a dedicated port. My question is how could I access the cluster if a node with IP address I connect is down? Is the only option to have my client go through the list of IP addresses or there is an option to get “virtual ip” updated based on docker nodes state?