mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
feat(cmd): enable pprof configuration for signle-node deployment #22779997
Signed-off-by: zhumingze <zhumingze@oppo.com>
This commit is contained in:
parent
0a7b6fda95
commit
18ae97d850
11
cmd/cmd.go
11
cmd/cmd.go
@ -52,6 +52,8 @@ import (
|
||||
|
||||
const (
|
||||
ConfigKeyRole = "role"
|
||||
ConfigKeyLocalIp = "localIP"
|
||||
ConfigKeyBindIp = "bindIp"
|
||||
ConfigKeyLogDir = "logDir"
|
||||
ConfigKeyLogLevel = "logLevel"
|
||||
ConfigKeyLogRotateSize = "logRotateSize"
|
||||
@ -173,6 +175,8 @@ func main() {
|
||||
*/
|
||||
|
||||
role := cfg.GetString(ConfigKeyRole)
|
||||
bindIp := cfg.GetBool(ConfigKeyBindIp)
|
||||
localIp := cfg.GetString(ConfigKeyLocalIp)
|
||||
logDir := cfg.GetString(ConfigKeyLogDir)
|
||||
logLevel := cfg.GetString(ConfigKeyLogLevel)
|
||||
logRotateSize := cfg.GetInt64(ConfigKeyLogRotateSize)
|
||||
@ -343,7 +347,12 @@ func main() {
|
||||
}
|
||||
})
|
||||
mainMux.Handle("/", mainHandler)
|
||||
e := http.ListenAndServe(fmt.Sprintf(":%v", profPort), mainMux)
|
||||
addr := fmt.Sprintf(":%v", profPort)
|
||||
if bindIp {
|
||||
addr = fmt.Sprintf("%v:%v", localIp, profPort)
|
||||
}
|
||||
e := http.ListenAndServe(fmt.Sprintf("%v", addr), mainMux)
|
||||
|
||||
if e != nil {
|
||||
log.LogFlush()
|
||||
err = errors.NewErrorf("cannot listen pprof %v err %v", profPort, e)
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
"role": "datanode",
|
||||
"listen": "17310",
|
||||
"localIP": "_ip_",
|
||||
"prof": "17320",
|
||||
"bindIp": "true",
|
||||
"raftHeartbeat": "17330",
|
||||
"raftReplica": "17340",
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
"role": "metanode",
|
||||
"listen": "17210",
|
||||
"localIP": "_ip_",
|
||||
"prof": "17220",
|
||||
"bindIp": "true",
|
||||
"raftHeartbeatPort": "17230",
|
||||
"raftReplicaPort": "17240",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user