merge master

This commit is contained in:
Xiang Li
2013-12-02 22:36:38 -05:00
14 changed files with 158 additions and 66 deletions

View File

@@ -96,6 +96,11 @@ func (s *Server) PeerURL(name string) (string, bool) {
return s.registry.PeerURL(name)
}
// ClientURL retrieves the Client URL for a given node name.
func (s *Server) ClientURL(name string) (string, bool) {
return s.registry.ClientURL(name)
}
// Returns a reference to the Store.
func (s *Server) Store() store.Store {
return s.store

View File

@@ -26,8 +26,9 @@ Options:
-vv Enabled very verbose logging.
Cluster Configuration Options:
-peers=<peers> Comma-separated list of peers (ip + port) in the cluster.
-peers-file=<path> Path to a file containing the peer list.
-peers-file=<path> Path to a file containing the peer list.
-peers=<host:port>,<host:port> Comma-separated list of peers. The members
should match the peer's '-peer-addr' flag.
Client Communication Options:
-addr=<host:port> The public host:port used for client communication.

View File

@@ -23,7 +23,7 @@ func GetHandler(w http.ResponseWriter, req *http.Request, s Server) error {
// Help client to redirect the request to the current leader
if req.FormValue("consistent") == "true" && s.State() != raft.Leader {
leader := s.Leader()
hostname, _ := s.PeerURL(leader)
hostname, _ := s.ClientURL(leader)
url := hostname + req.URL.Path
log.Debugf("Redirect consistent get to %s", url)
http.Redirect(w, req, url, http.StatusTemporaryRedirect)

View File

@@ -13,6 +13,7 @@ type Server interface {
CommitIndex() uint64
Term() uint64
PeerURL(string) (string, bool)
ClientURL(string) (string, bool)
Store() store.Store
Dispatch(raft.Command, http.ResponseWriter, *http.Request) error
}