@@ -25,7 +25,7 @@ import (
25
25
func main () {
26
26
const usage = `
27
27
Usage:
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 ]
29
29
codis-dashboard --default-config
30
30
codis-dashboard --version
31
31
@@ -88,12 +88,45 @@ Options:
88
88
log .Warnf ("option --host-admin = %s" , s )
89
89
}
90
90
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
+
91
112
client , err := models .NewClient (config .CoordinatorName , config .CoordinatorAddr , time .Minute )
92
113
if err != nil {
93
114
log .PanicErrorf (err , "create '%s' client to '%s' failed" , config .CoordinatorName , config .CoordinatorAddr )
94
115
}
95
116
defer client .Close ()
96
117
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
+
97
130
s , err := topom .New (client , config )
98
131
if err != nil {
99
132
log .PanicErrorf (err , "create topom with config file failed\n %s" , config )
0 commit comments