diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-07-31 09:39:48 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-07-31 09:39:48 -0700 |
| commit | f5a69a0e4423db70cffb3501c05bf5d4ed593370 (patch) | |
| tree | d70180196a429ebe5ad4f14b3f4b915f85dc71ed /weed/command/server.go | |
| parent | 899963ac20556f6a48aad431eec8ec995e982dd3 (diff) | |
| parent | 6ba65c3382d8e6e73bfa5312ed9c04c5b17aece5 (diff) | |
| download | seaweedfs-f5a69a0e4423db70cffb3501c05bf5d4ed593370.tar.xz seaweedfs-f5a69a0e4423db70cffb3501c05bf5d4ed593370.zip | |
Merge branch 'master' into add_remote_storage
Diffstat (limited to 'weed/command/server.go')
| -rw-r--r-- | weed/command/server.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/weed/command/server.go b/weed/command/server.go index 97f117665..9bac2be97 100644 --- a/weed/command/server.go +++ b/weed/command/server.go @@ -3,6 +3,7 @@ package command import ( "fmt" "github.com/chrislusf/seaweedfs/weed/util/grace" + "net/http" "os" "strings" "time" @@ -16,6 +17,8 @@ import ( type ServerOptions struct { cpuprofile *string memprofile *string + debug *bool + debugPort *int v VolumeServerOptions } @@ -78,6 +81,8 @@ var ( func init() { serverOptions.cpuprofile = cmdServer.Flag.String("cpuprofile", "", "cpu profile output file") serverOptions.memprofile = cmdServer.Flag.String("memprofile", "", "memory profile output file") + serverOptions.debug = cmdServer.Flag.Bool("debug", false, "serves runtime profiling data, e.g., http://localhost:6060/debug/pprof/goroutine?debug=2") + serverOptions.debugPort = cmdServer.Flag.Int("debug.port", 6060, "http port for debugging") masterOptions.port = cmdServer.Flag.Int("master.port", 9333, "master server http listen port") masterOptions.metaFolder = cmdServer.Flag.String("master.dir", "", "data directory to store meta data, default to same as -dir specified") @@ -139,6 +144,10 @@ func init() { func runServer(cmd *Command, args []string) bool { + if *serverOptions.debug { + go http.ListenAndServe(fmt.Sprintf(":%d", *serverOptions.debugPort), nil) + } + util.LoadConfiguration("security", false) util.LoadConfiguration("master", false) |
