Work on PD replication

add closest replica locationing based on hostname
improved error handling