From 4d8f54912384f949b1d944a30ce9abd0f8ce9f2c Mon Sep 17 00:00:00 2001 From: tnextday Date: Mon, 4 Apr 2016 16:20:26 +0800 Subject: [PATCH] add http debug interface --- weed/topology/store_replicate.go | 3 +++ weed/weedserver/master_server.go | 4 ++++ weed/weedserver/volume_server.go | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/weed/topology/store_replicate.go b/weed/topology/store_replicate.go index dd4a96c30..caeb5befc 100644 --- a/weed/topology/store_replicate.go +++ b/weed/topology/store_replicate.go @@ -50,6 +50,9 @@ func ReplicatedWrite(masterNode string, s *storage.Store, _, err := operation.Upload(u, string(needle.Name), bytes.NewReader(needle.Data), needle.IsGzipped(), string(needle.Mime), jwt) + if err != nil { + glog.V(0).Infof("write replication to %s err, %v", u, err) + } return err == nil } if !distributedOperation(masterNode, s, volumeId, repWrite) { diff --git a/weed/weedserver/master_server.go b/weed/weedserver/master_server.go index fc320430e..739f42589 100644 --- a/weed/weedserver/master_server.go +++ b/weed/weedserver/master_server.go @@ -7,6 +7,8 @@ import ( "net/url" "sync" + "net/http/pprof" + "github.com/chrislusf/raft" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/security" @@ -80,6 +82,8 @@ func NewMasterServer(r *mux.Router, port int, metaFolder string, r.HandleFunc("/{fileId}", ms.proxyToLeader(ms.redirectHandler)) r.HandleFunc("/stats/counter", ms.guard.WhiteList(statsCounterHandler)) r.HandleFunc("/stats/memory", ms.guard.WhiteList(statsMemoryHandler)) + r.HandleFunc("/debug/pprof/", ms.guard.WhiteList(pprof.Index)) + r.HandleFunc("/debug/pprof/{name}", ms.guard.WhiteList(pprof.Index)) ms.Topo.StartRefreshWritableVolumes() diff --git a/weed/weedserver/volume_server.go b/weed/weedserver/volume_server.go index 312bb2e93..726b36b63 100644 --- a/weed/weedserver/volume_server.go +++ b/weed/weedserver/volume_server.go @@ -5,6 +5,8 @@ import ( "net/http" "time" + "net/http/pprof" + "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/storage" @@ -64,6 +66,8 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string, adminMux.HandleFunc("/stats/counter", vs.guard.WhiteList(statsCounterHandler)) adminMux.HandleFunc("/stats/memory", vs.guard.WhiteList(statsMemoryHandler)) adminMux.HandleFunc("/stats/disk", vs.guard.WhiteList(vs.statsDiskHandler)) + adminMux.HandleFunc("/debug/pprof/", vs.guard.WhiteList(pprof.Index)) + adminMux.HandleFunc("/debug/pprof/{name}", vs.guard.WhiteList(pprof.Index)) adminMux.HandleFunc("/delete", vs.guard.WhiteList(vs.batchDeleteHandler)) adminMux.HandleFunc("/", vs.privateStoreHandler) if publicMux != adminMux {