@@ -25,7 +25,7 @@ import (
2525func main () {
2626 const usage = `
2727Usage:
28- codis-dashboard [--ncpu=N] [--config=CONF] [--log=FILE] [--log-level=LEVEL] [--host-admin=ADDR] [--pidfile=FILE]
28+ codis-dashboard [--ncpu=N] [--config=CONF] [--log=FILE] [--log-level=LEVEL] [--host-admin=ADDR] [--zookeeper=ADDR|--etcd=ADDR|--filesystem=ROOT] [--product_name=NAME] [--product_auth=AUTH] [-- pidfile=FILE] [--remove-lock ]
2929 codis-dashboard --default-config
3030 codis-dashboard --version
3131
@@ -88,12 +88,45 @@ Options:
8888 log .Warnf ("option --host-admin = %s" , s )
8989 }
9090
91+ switch {
92+ case d ["--zookeeper" ] != nil :
93+ config .CoordinatorName = "zookeeper"
94+ config .CoordinatorAddr = utils .ArgumentMust (d , "--zookeeper" )
95+ case d ["--etcd" ] != nil :
96+ config .CoordinatorName = "etcd"
97+ config .CoordinatorAddr = utils .ArgumentMust (d , "--etcd" )
98+ case d ["--filesystem" ] != nil :
99+ config .CoordinatorName = "filesystem"
100+ config .CoordinatorAddr = utils .ArgumentMust (d , "--filesystem" )
101+ }
102+
103+ if s , ok := utils .Argument (d , "--product_name" ); ok {
104+ config .ProductName = s
105+ log .Warnf ("option --product_nam = %s" , s )
106+ }
107+ if s , ok := utils .Argument (d , "--product_auth" ); ok {
108+ config .ProductAuth = s
109+ log .Warnf ("option --product_auth = %s" , s )
110+ }
111+
91112 client , err := models .NewClient (config .CoordinatorName , config .CoordinatorAddr , time .Minute )
92113 if err != nil {
93114 log .PanicErrorf (err , "create '%s' client to '%s' failed" , config .CoordinatorName , config .CoordinatorAddr )
94115 }
95116 defer client .Close ()
96117
118+ if d ["--remove-lock" ].(bool ) {
119+ store := models .NewStore (client , config .ProductName )
120+ defer store .Close ()
121+
122+ log .Warnf ("force remove-lock" )
123+ if err := store .Release (); err != nil {
124+ log .WarnErrorf (err , "force remove-lock failed" )
125+ } else {
126+ log .Warnf ("force remove-lock OK" )
127+ }
128+ }
129+
97130 s , err := topom .New (client , config )
98131 if err != nil {
99132 log .PanicErrorf (err , "create topom with config file failed\n %s" , config )
0 commit comments