mirror of https://github.com/etcd-io/dbtester.git
*: clean up flags
This commit is contained in:
parent
5d9d73afb7
commit
144612b5fe
|
|
@ -44,6 +44,8 @@ type (
|
|||
Monitor bool
|
||||
MonitorInterval time.Duration
|
||||
MonitorResultPath string
|
||||
|
||||
StorageSecretKeyPath string
|
||||
}
|
||||
|
||||
// ZookeeperConfig is zookeeper configuration.
|
||||
|
|
@ -110,14 +112,16 @@ func init() {
|
|||
if len(shell) == 0 {
|
||||
shell = "sh"
|
||||
}
|
||||
Command.PersistentFlags().StringVarP(&globalFlags.GRPCPort, "agent-port", "p", ":3500", "Port to server agent gRPC server.")
|
||||
Command.PersistentFlags().StringVarP(&globalFlags.WorkingDir, "working-directory", "d", homeDir(), "Working directory to store data.")
|
||||
Command.PersistentFlags().StringVar(&globalFlags.GRPCPort, "agent-port", ":3500", "Port to server agent gRPC server.")
|
||||
Command.PersistentFlags().StringVar(&globalFlags.WorkingDir, "working-directory", homeDir(), "Working directory to store data.")
|
||||
|
||||
Command.PersistentFlags().StringVar(&globalFlags.DatabaseLogPath, "database-log-path", "database.log", "Path to save database log.")
|
||||
|
||||
Command.PersistentFlags().BoolVar(&globalFlags.Monitor, "monitor", false, "Periodically records resource usage.")
|
||||
Command.PersistentFlags().DurationVar(&globalFlags.MonitorInterval, "monitor-interval", time.Second, "Resource monitor interval.")
|
||||
Command.PersistentFlags().StringVar(&globalFlags.MonitorResultPath, "monitor-result-path", "monitor.csv", "File path to store monitor results.")
|
||||
|
||||
Command.PersistentFlags().StringVar(&globalFlags.StorageSecretKeyPath, "storage-secret-key-path", "", "Key to use for uploading logs and data.")
|
||||
}
|
||||
|
||||
func CommandFunc(cmd *cobra.Command, args []string) {
|
||||
|
|
@ -136,6 +140,9 @@ func CommandFunc(cmd *cobra.Command, args []string) {
|
|||
if !filepath.HasPrefix(globalFlags.MonitorResultPath, globalFlags.WorkingDir) {
|
||||
globalFlags.MonitorResultPath = filepath.Join(globalFlags.WorkingDir, globalFlags.MonitorResultPath)
|
||||
}
|
||||
if !filepath.HasPrefix(globalFlags.StorageSecretKeyPath, globalFlags.WorkingDir) {
|
||||
globalFlags.StorageSecretKeyPath = filepath.Join(globalFlags.WorkingDir, globalFlags.StorageSecretKeyPath)
|
||||
}
|
||||
|
||||
log.Printf("gRPC has started serving at %s\n", globalFlags.GRPCPort)
|
||||
log.Printf("Database log path: %s\n", globalFlags.DatabaseLogPath)
|
||||
|
|
@ -143,6 +150,7 @@ func CommandFunc(cmd *cobra.Command, args []string) {
|
|||
log.Printf("Zookeeper working directory: %s\n", zkWorkingDir)
|
||||
log.Printf("Zookeeper data directory: %s\n", zkDataDir)
|
||||
log.Printf("Monitor result path: %s\n", globalFlags.MonitorResultPath)
|
||||
log.Printf("Storage key secret path: %s\n", globalFlags.StorageSecretKeyPath) // TODO: use this to upload to Google cloud storage
|
||||
|
||||
var (
|
||||
grpcServer = grpc.NewServer()
|
||||
|
|
|
|||
|
|
@ -55,14 +55,14 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
StartCommand.PersistentFlags().StringVarP(&globalFlags.Database, "database", "d", "etcd", "'etcd' or 'zookeeper' (or 'zk').")
|
||||
|
||||
StartCommand.PersistentFlags().StringSliceVarP(&globalFlags.AgentEndpoints, "agent-endpoints", "e", []string{""}, "Endpoints to send client requests to. Then the agent automatically configures the database.")
|
||||
StopCommand.PersistentFlags().StringSliceVarP(&globalFlags.AgentEndpoints, "agent-endpoints", "e", []string{""}, "Endpoints to send client requests to. Then the agent automatically configures the database.")
|
||||
RestartCommand.PersistentFlags().StringSliceVarP(&globalFlags.AgentEndpoints, "agent-endpoints", "e", []string{""}, "Endpoints to send client requests to. Then the agent automatically configures the database.")
|
||||
|
||||
StartCommand.PersistentFlags().StringVar(&globalFlags.Database, "database", "", "etcd, zookeeper, zk, etcd2, consul.")
|
||||
StartCommand.PersistentFlags().StringSliceVar(&globalFlags.AgentEndpoints, "agent-endpoints", []string{""}, "Endpoints to send client requests to, then it automatically configures.")
|
||||
StartCommand.PersistentFlags().Int64Var(&globalFlags.ZookeeperPreAllocSize, "zk-pre-alloc-size", 65536*1024, "Disk pre-allocation size in bytes.")
|
||||
StartCommand.PersistentFlags().Int64Var(&globalFlags.ZookeeperMaxClientCnxns, "zk-max-client-conns", 5000, "Maximum number of concurrent zookeeper connection.")
|
||||
StartCommand.PersistentFlags().Int64Var(&globalFlags.ZookeeperMaxClientCnxns, "zk-max-client-conns", 5000, "Maximum number of concurrent Zookeeper connection.")
|
||||
|
||||
StopCommand.PersistentFlags().StringSliceVar(&globalFlags.AgentEndpoints, "agent-endpoints", []string{""}, "Endpoints to send client requests to, then it automatically configures.")
|
||||
|
||||
RestartCommand.PersistentFlags().StringSliceVar(&globalFlags.AgentEndpoints, "agent-endpoints", []string{""}, "Endpoints to send client requests to, then it automatically configures.")
|
||||
}
|
||||
|
||||
func CommandFunc(cmd *cobra.Command, args []string) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue