diff --git a/weed/server/common.go b/weed/server/common.go index c5956143f..20177df0e 100644 --- a/weed/server/common.go +++ b/weed/server/common.go @@ -170,6 +170,11 @@ func parseURLPath(path string) (vid, fid, filename, ext string, isVolumeIdOnly b return } +func statsHealthHandler(w http.ResponseWriter, r *http.Request) { + m := make(map[string]interface{}) + m["Version"] = util.VERSION + writeJsonQuiet(w, r, http.StatusOK, m) +} func statsCounterHandler(w http.ResponseWriter, r *http.Request) { m := make(map[string]interface{}) m["Version"] = util.VERSION diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go index f3284fd21..9cae40b70 100644 --- a/weed/server/filer_server.go +++ b/weed/server/filer_server.go @@ -185,7 +185,7 @@ func (fs *FilerServer) detectHealthyMaster(masterNode string) (master string, e } func checkMaster(masterNode string) error { - statUrl := "http://" + masterNode + "/stats" + statUrl := "http://" + masterNode + "/stats/health" glog.V(4).Infof("Connecting to %s ...", statUrl) _, e := util.Get(statUrl) return e diff --git a/weed/server/filer_server_handlers_api.go b/weed/server/filer_server_handlers_api.go index 93a0dd751..0fad5631d 100644 --- a/weed/server/filer_server_handlers_api.go +++ b/weed/server/filer_server_handlers_api.go @@ -20,6 +20,9 @@ func (fs *FilerServer) apiHandler(w http.ResponseWriter, r *http.Request) { glog.V(0).Infoln("failing to read request", r.RequestURI, request) writeJsonError(w, r, http.StatusInternalServerError, err) } + + glog.V(2).Infof("api request: %+v", apiRequest) + switch apiRequest.Command { case "lookupDirectoryEntry": res := filer.LookupDirectoryEntryResult{} diff --git a/weed/server/master_server.go b/weed/server/master_server.go index 8c73b6019..9fd07072f 100644 --- a/weed/server/master_server.go +++ b/weed/server/master_server.go @@ -75,9 +75,10 @@ func NewMasterServer(r *mux.Router, port int, metaFolder string, r.HandleFunc("/vol/vacuum", ms.proxyToLeader(ms.guard.WhiteList(ms.volumeVacuumHandler))) r.HandleFunc("/submit", ms.guard.WhiteList(ms.submitFromMasterServerHandler)) r.HandleFunc("/delete", ms.guard.WhiteList(ms.deleteFromMasterServerHandler)) - r.HandleFunc("/{fileId}", ms.proxyToLeader(ms.redirectHandler)) + r.HandleFunc("/stats/health", ms.guard.WhiteList(statsHealthHandler)) r.HandleFunc("/stats/counter", ms.guard.WhiteList(statsCounterHandler)) r.HandleFunc("/stats/memory", ms.guard.WhiteList(statsMemoryHandler)) + r.HandleFunc("/{fileId}", ms.proxyToLeader(ms.redirectHandler)) ms.Topo.StartRefreshWritableVolumes(garbageThreshold, ms.preallocate)