diff --git a/cmd/root_test.go b/cmd/root_test.go index 37c235322..e1aaaf31d 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -178,10 +178,10 @@ func TestRootCommand_Config(t *testing.T) { panic(err) } config := `data-dir = "/tmp/pil5_0" -host = "127.0.0.1:10101" +bind = "127.0.0.1:10101" [cluster] - polling-interval = "2m0s" + poll-interval = "2m0s" replicas = 2 partitions = 128 hosts = [ diff --git a/cmd/server_test.go b/cmd/server_test.go index 4a8fa349f..10851e45b 100644 --- a/cmd/server_test.go +++ b/cmd/server_test.go @@ -44,14 +44,14 @@ func TestServerConfig(t *testing.T) { tests := []commandTest{ // TEST 0 { - args: []string{"server", "--data-dir", actualDataDir, "--cluster.hosts", "example.com:10111,example.com:10110", "--host", "example.com:10111"}, - env: map[string]string{"PILOSA_DATA_DIR": "/tmp/myEnvDatadir", "PILOSA_CLUSTER.POLLING_INTERVAL": "3m2s"}, + args: []string{"server", "--data-dir", actualDataDir, "--cluster.hosts", "example.com:10111,example.com:10110", "--bind", "example.com:10111"}, + env: map[string]string{"PILOSA_DATA_DIR": "/tmp/myEnvDatadir", "PILOSA_CLUSTER.POLL_INTERVAL": "3m2s"}, cfgFileContent: ` data-dir = "/tmp/myFileDatadir" - host = "localhost:0" + bind = "localhost:0" [cluster] - polling-interval = "45s" + poll-interval = "45s" replicas = 2 hosts = [ "localhost:19444", @@ -72,7 +72,7 @@ func TestServerConfig(t *testing.T) { args: []string{"server", "--anti-entropy.interval", "9m0s"}, env: map[string]string{"PILOSA_CLUSTER.HOSTS": "example.com:1110,example.com:1111", "PILOSA_BIND": "example.com:1110"}, cfgFileContent: ` - host = "localhost:0" + bind = "localhost:0" data-dir = "` + actualDataDir + `" [cluster] hosts = [ @@ -94,10 +94,10 @@ func TestServerConfig(t *testing.T) { args: []string{"server", "--log-path", logFile.Name()}, env: map[string]string{"PILOSA_PROFILE.CPU_TIME": "1m"}, cfgFileContent: ` - host = "localhost:19444" + bind = "localhost:19444" data-dir = "` + actualDataDir + `" [cluster] - polling-interval = "2m0s" + poll-interval = "2m0s" hosts = [ "localhost:19444", ] diff --git a/config.go b/config.go index f3479e214..aa743dcef 100644 --- a/config.go +++ b/config.go @@ -39,14 +39,14 @@ const ( // Config represents the configuration for the command. type Config struct { DataDir string `toml:"data-dir"` - Host string `toml:"host"` + Host string `toml:"bind"` Cluster struct { ReplicaN int `toml:"replicas"` Type string `toml:"type"` Hosts []string `toml:"hosts"` InternalHosts []string `toml:"internal-hosts"` - PollingInterval Duration `toml:"polling-interval"` + PollingInterval Duration `toml:"poll-interval"` InternalPort string `toml:"internal-port"` GossipSeed string `toml:"gossip-seed"` LongQueryTime Duration `toml:"long-query-time"` @@ -69,7 +69,7 @@ type Config struct { Metric struct { Service string `toml:"service"` Host string `toml:"host"` - PollingInterval Duration `toml:"polling-interval"` + PollingInterval Duration `toml:"poll-interval"` } `toml:"metric"` } diff --git a/ctl/server.go b/ctl/server.go index 9e07fcd9c..b1b77a71a 100644 --- a/ctl/server.go +++ b/ctl/server.go @@ -25,13 +25,13 @@ import ( func BuildServerFlags(cmd *cobra.Command, srv *server.Command) { flags := cmd.Flags() flags.StringVarP(&srv.Config.DataDir, "data-dir", "d", "~/.pilosa", "Directory to store pilosa data files.") - flags.StringVarP(&srv.Config.Host, "host", "", ":10101", "Default URI on which pilosa should listen.") + flags.StringVarP(&srv.Config.Host, "bind", "b", ":10101", "Default URI on which pilosa should listen.") flags.IntVarP(&srv.Config.MaxWritesPerRequest, "max-writes-per-request", "", srv.Config.MaxWritesPerRequest, "Number of write commands per request.") flags.IntVarP(&srv.Config.Cluster.ReplicaN, "cluster.replicas", "", 1, "Number of hosts each piece of data should be stored on.") flags.StringSliceVarP(&srv.Config.Cluster.Hosts, "cluster.hosts", "", []string{}, "Comma separated list of hosts in cluster.") flags.StringSliceVarP(&srv.Config.Cluster.InternalHosts, "cluster.internal-hosts", "", []string{}, "Comma separated list of hosts in cluster used for internal communication.") - flags.DurationVarP((*time.Duration)(&srv.Config.Cluster.PollingInterval), "cluster.polling-interval", "", time.Minute, "Polling interval for cluster.") // TODO what actually is this? - flags.DurationVarP((*time.Duration)(&srv.Config.Cluster.LongQueryTime), "cluster.long-query-time", "", time.Minute, "Long time query.") + flags.DurationVarP((*time.Duration)(&srv.Config.Cluster.PollingInterval), "cluster.poll-interval", "", time.Minute, "Polling interval for cluster.") // TODO what actually is this? + flags.DurationVarP((*time.Duration)(&srv.Config.Cluster.LongQueryTime), "cluster.long-query-time", "", time.Minute, "Long Query Time.") flags.StringVarP(&srv.Config.Plugins.Path, "plugins.path", "", "", "Path to plugin directory.") flags.StringVar(&srv.Config.LogPath, "log-path", "", "Log path") flags.DurationVarP((*time.Duration)(&srv.Config.AntiEntropy.Interval), "anti-entropy.interval", "", time.Minute*10, "Interval at which to run anti-entropy routine.") @@ -42,5 +42,5 @@ func BuildServerFlags(cmd *cobra.Command, srv *server.Command) { flags.StringVarP(&srv.Config.Cluster.InternalPort, "cluster.internal-port", "", "", "Port to which pilosa should bind for internal state sharing.") flags.StringVarP(&srv.Config.Metric.Service, "metric.service", "", "nop", "Default URI on which pilosa should listen.") flags.StringVarP(&srv.Config.Metric.Host, "metric.host", "", "", "Default URI to send metrics.") - flags.DurationVarP((*time.Duration)(&srv.Config.Metric.PollingInterval), "metric.polling-interval", "", time.Minute*0, "Polling interval metrics.") + flags.DurationVarP((*time.Duration)(&srv.Config.Metric.PollingInterval), "metric.poll-interval", "", time.Minute*0, "Polling interval metrics.") } diff --git a/docs/configuration.md b/docs/configuration.md index 40d06a595..f93647cb5 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -20,10 +20,10 @@ Every command line flag has a corresponding environment variable. The environmen ### Config file -The config file is in the [toml format](https://github.com/toml-lang/toml) and has exactly the same options available as the flags and environment variables. Any flag which contains a dot (".") denotes nesting within the config file, so the two flags `--cluster.polling-interval=2m0s` and `--cluster.replicas=1` look like this in the config file: +The config file is in the [toml format](https://github.com/toml-lang/toml) and has exactly the same options available as the flags and environment variables. Any flag which contains a dot (".") denotes nesting within the config file, so the two flags `--cluster.poll-interval=2m0s` and `--cluster.replicas=1` look like this in the config file: ```toml [cluster] - polling-interval = "2m0s" + poll-interval = "2m0s" replicas = 1 ``` @@ -47,15 +47,15 @@ Any flag that has a value that is a comma separated list on the command line bec interval = "10m0s" ``` -#### Host +#### Bind * Description: host:port on which the Pilosa server will listen for requests. Host defaults to localhost and port to 10101. -* Flag: `--host="localhost:10101"` +* Flag: `--bind="localhost:10101"` * Env: `PILOSA_BIND="localhost:10101"` * Config: ```toml - host = localhost:10101 + bind = localhost:10101 ``` #### Cluster Hosts @@ -97,13 +97,13 @@ Any flag that has a value that is a comma separated list on the command line bec #### Cluster Poll Interval * Description: Polling interval for cluster. -* Flag: `cluster.polling-interval="1m0s"` -* Env: `PILOSA_CLUSTER.POLLING_INTERVAL="1m0s"` +* Flag: `cluster.poll-interval="1m0s"` +* Env: `PILOSA_CLUSTER.POLL_INTERVAL="1m0s"` * Config: ```toml [cluster] - polling-interval = "1m0s" + poll-interval = "1m0s" ``` #### Cluster Replicas @@ -192,11 +192,11 @@ Any flag that has a value that is a comma separated list on the command line bec ##### Metric Poll Interval * Description: Polling interval for runtime metrics. -* Flag: `metric.polling-interval=ā€0m15sā€` -* Env: `PILOSA_METRIC.POLLING_INTERVAL=0m15s` +* Flag: `metric.poll-interval=ā€0m15sā€` +* Env: `PILOSA_METRIC.POLL_INTERVAL=0m15s` * Config: ```toml [metric] - polling-interval = "0m15s" + poll-interval = "0m15s" ``` \ No newline at end of file diff --git a/server/server_test.go b/server/server_test.go index f1ee11b23..72c8243e3 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -346,7 +346,7 @@ func TestMain_FrameRestore(t *testing.T) { // Ensure the host can be parsed. func TestConfig_Parse_Host(t *testing.T) { - if c, err := ParseConfig(`host = "local"`); err != nil { + if c, err := ParseConfig(`bind = "local"`); err != nil { t.Fatal(err) } else if c.Host != "local" { t.Fatalf("unexpected host: %s", c.Host)