aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Yacoby <33892515+yuvalyacoby@users.noreply.github.com>2023-10-08 17:03:18 +0300
committerGitHub <noreply@github.com>2023-10-08 07:03:18 -0700
commit3fe00996b244886e4a89f3aa4250a391919db106 (patch)
tree135f8b1452c85c121160c4e4cca4261fe73caa13
parent082f67bfe95b3914a12669e6f9d1e934b602deb1 (diff)
downloadseaweedfs-3fe00996b244886e4a89f3aa4250a391919db106.tar.xz
seaweedfs-3fe00996b244886e4a89f3aa4250a391919db106.zip
added healthz endpoint to filer (#4899)
-rw-r--r--weed/server/filer_server.go1
-rw-r--r--weed/server/filer_server_handlers.go5
2 files changed, 6 insertions, 0 deletions
diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go
index 788ee150a..0f110f1ec 100644
--- a/weed/server/filer_server.go
+++ b/weed/server/filer_server.go
@@ -157,6 +157,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
handleStaticResources(defaultMux)
if !option.DisableHttp {
+ defaultMux.HandleFunc("/healthz", fs.filerHealthzHandler)
defaultMux.HandleFunc("/", fs.filerHandler)
}
if defaultMux != readonlyMux {
diff --git a/weed/server/filer_server_handlers.go b/weed/server/filer_server_handlers.go
index 54ddfb8b2..6bfae3dc1 100644
--- a/weed/server/filer_server_handlers.go
+++ b/weed/server/filer_server_handlers.go
@@ -179,3 +179,8 @@ func (fs *FilerServer) maybeCheckJwtAuthorization(r *http.Request, isWrite bool)
return true
}
}
+
+func (fs *FilerServer) filerHealthzHandler(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Server", "SeaweedFS Filer "+util.VERSION)
+ w.WriteHeader(http.StatusOK)
+}