Merge pull request #2091 from influxdb/allow_snapshot_disable
Allow snapshot endpoint to be disabledpull/2093/head
commit
c4871513a2
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue