implement high availability in the same way that the influxdb-js library does it

see influxdb/influxdb-js@b9abd7e