modified clientr.go so that it first tries primary and then backup