diff --git a/CHANGELOG.md b/CHANGELOG.md index 65e56b939f1..373445c7d2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Features - [#2076](https://github.com/influxdb/influxdb/pull/2076): Seperate stdout and stderr output in init.d script +- [#2091](https://github.com/influxdb/influxdb/pull/2091): Support disabling snapshot endpoint. ### Bugfixes - [#2084](https://github.com/influxdb/influxdb/pull/2084): Allowing leading underscores in identifiers. diff --git a/cmd/influxd/config.go b/cmd/influxd/config.go index f0cc42ca470..2a1390c3b18 100644 --- a/cmd/influxd/config.go +++ b/cmd/influxd/config.go @@ -113,6 +113,7 @@ type Config struct { } `toml:"data"` Snapshot struct { + Enabled bool `toml:"enabled"` BindAddress string `toml:"bind-address"` Port int `toml:"port"` } @@ -182,6 +183,7 @@ func NewConfig() (*Config, error) { c.Data.RetentionCheckEnabled = true c.Data.RetentionCheckPeriod = Duration(10 * time.Minute) c.Data.RetentionCreatePeriod = Duration(DefaultRetentionCreatePeriod) + c.Snapshot.Enabled = true c.Snapshot.BindAddress = DefaultSnapshotBindAddress c.Snapshot.Port = DefaultSnapshotPort c.Admin.Enabled = true diff --git a/cmd/influxd/run.go b/cmd/influxd/run.go index 2ed98fdcdf7..6cba7eb3a37 100644 --- a/cmd/influxd/run.go +++ b/cmd/influxd/run.go @@ -115,16 +115,20 @@ func Run(config *Config, join, version string) (*messaging.Broker, *influxdb.Ser } log.Printf("data node #%d listening on %s", s.ID(), config.DataAddr()) - // Start snapshot handler. - go func() { - log.Fatal(http.ListenAndServe( - config.SnapshotAddr(), - &httpd.SnapshotHandler{ - CreateSnapshotWriter: s.CreateSnapshotWriter, - }, - )) - }() - log.Printf("snapshot endpoint listening on %s", config.SnapshotAddr()) + if config.Snapshot.Enabled { + // Start snapshot handler. + go func() { + log.Fatal(http.ListenAndServe( + config.SnapshotAddr(), + &httpd.SnapshotHandler{ + CreateSnapshotWriter: s.CreateSnapshotWriter, + }, + )) + }() + log.Printf("snapshot endpoint listening on %s", config.SnapshotAddr()) + } else { + log.Println("snapshot endpoint disabled") + } // Start the admin interface on the default port if config.Admin.Enabled { diff --git a/etc/config.sample.toml b/etc/config.sample.toml index 7b00f8d7436..ed00e291149 100644 --- a/etc/config.sample.toml +++ b/etc/config.sample.toml @@ -86,6 +86,7 @@ dir = "/tmp/influxdb/development/state" # Configuration for snapshot endpoint. [snapshot] +enabled = true # Enabled by default if not set. bind-address = "127.0.0.1" port = 8087