2 nameservers, 2 hosting companies, if one goes down go to the other

Hi

I have 2 hosting, I want to point my domain to both.
In case one goes down then point it to the other.

For example, lets say the first hosting gets hacked, how can I bypass it automatically to go to the second
without waiting for the DNS to update. Its a bit hard to explain, I hope you understand.

Thanks,
Chris

you’ll need a loadbalancer or failover dns

It can be done using some DNS hackery (I don’t recommend it), however… you’d need to make sure the entire site was replicated and if theres a data base behind it, you could start running into Master < - > Master replication issues to keep the 2 in sync?