Sharding JDBC middleware master-slave separation how to do failover to achieve high availability ah?

configured one master and two slaves, master write slave read, found that if a slave, or master, the system will not work, always trying to connect to the failed database. What about this situation?

my goal from low to high is: 1 if you hang up one slave, let the other slave work, one master and one slave, wait for the failed slave to start manually, and then restore one master and two slaves

2 if you hang up two slaves, master will do all the reading and writing

.

3 if you hang up master, two slaves will become one master and one slave

is it possible for sharding jdbc to do this?

at least you can"t fail to work because a database is down.

May.10,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaf53b-2248.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaf53b-2248.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?