From e3090cb0c315869983db9e24dc884632bb8d426c Mon Sep 17 00:00:00 2001 From: Linh Vo Date: Fri, 7 Jul 2017 15:12:16 -0500 Subject: [PATCH] update doc for configuration --- cmd/root_test.go | 4 ++-- cmd/server_test.go | 14 +++++++------- config.go | 2 +- ctl/generate_config.go | 4 ++-- ctl/server.go | 2 +- docs/configuration.md | 22 +++++++++++----------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cmd/root_test.go b/cmd/root_test.go index e1aaaf31d..37c235322 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" -bind = "127.0.0.1:10101" +host = "127.0.0.1:10101" [cluster] - poll-interval = "2m0s" + polling-interval = "2m0s" replicas = 2 partitions = 128 hosts = [ diff --git a/cmd/server_test.go b/cmd/server_test.go index 10851e45b..4a8fa349f 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", "--bind", "example.com:10111"}, - env: map[string]string{"PILOSA_DATA_DIR": "/tmp/myEnvDatadir", "PILOSA_CLUSTER.POLL_INTERVAL": "3m2s"}, + 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"}, cfgFileContent: ` data-dir = "/tmp/myFileDatadir" - bind = "localhost:0" + host = "localhost:0" [cluster] - poll-interval = "45s" + polling-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: ` - bind = "localhost:0" + host = "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: ` - bind = "localhost:19444" + host = "localhost:19444" data-dir = "` + actualDataDir + `" [cluster] - poll-interval = "2m0s" + polling-interval = "2m0s" hosts = [ "localhost:19444", ] diff --git a/config.go b/config.go index cf886464f..f3479e214 100644 --- a/config.go +++ b/config.go @@ -69,7 +69,7 @@ type Config struct { Metric struct { Service string `toml:"service"` Host string `toml:"host"` - PollingInterval Duration `toml:"poll-interval"` + PollingInterval Duration `toml:"polling-interval"` } `toml:"metric"` } diff --git a/ctl/generate_config.go b/ctl/generate_config.go index 87f866bb8..62d59b784 100644 --- a/ctl/generate_config.go +++ b/ctl/generate_config.go @@ -43,7 +43,7 @@ bind = "localhost:10101" max-writes-per-request = 5000 [cluster] - poll-interval = "2m0s" + polling-interval = "2m0s" replicas = 1 hosts = [ "localhost:10101", @@ -59,7 +59,7 @@ max-writes-per-request = 5000 [metric] service = "statsd" host = "127.0.0.1:8125" - poll-interval = "0m15s" + polling-interval = "0m15s" [plugins] path = "" diff --git a/ctl/server.go b/ctl/server.go index 7860dfe5f..9e07fcd9c 100644 --- a/ctl/server.go +++ b/ctl/server.go @@ -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.poll-interval", "", time.Minute*0, "Polling interval metrics.") + flags.DurationVarP((*time.Duration)(&srv.Config.Metric.PollingInterval), "metric.polling-interval", "", time.Minute*0, "Polling interval metrics.") } diff --git a/docs/configuration.md b/docs/configuration.md index f93647cb5..40d06a595 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.poll-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.polling-interval=2m0s` and `--cluster.replicas=1` look like this in the config file: ```toml [cluster] - poll-interval = "2m0s" + polling-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" ``` -#### Bind +#### Host * Description: host:port on which the Pilosa server will listen for requests. Host defaults to localhost and port to 10101. -* Flag: `--bind="localhost:10101"` +* Flag: `--host="localhost:10101"` * Env: `PILOSA_BIND="localhost:10101"` * Config: ```toml - bind = localhost:10101 + host = 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.poll-interval="1m0s"` -* Env: `PILOSA_CLUSTER.POLL_INTERVAL="1m0s"` +* Flag: `cluster.polling-interval="1m0s"` +* Env: `PILOSA_CLUSTER.POLLING_INTERVAL="1m0s"` * Config: ```toml [cluster] - poll-interval = "1m0s" + polling-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.poll-interval=ā€0m15sā€` -* Env: `PILOSA_METRIC.POLL_INTERVAL=0m15s` +* Flag: `metric.polling-interval=ā€0m15sā€` +* Env: `PILOSA_METRIC.POLLING_INTERVAL=0m15s` * Config: ```toml [metric] - poll-interval = "0m15s" + polling-interval = "0m15s" ``` \ No newline at end of file