Merge pull request #2091 from influxdb/allow_snapshot_disable

Allow snapshot endpoint to be disabled
pull/2093/head
Philip O'Toole 2015-03-26 16:20:34 -07:00
commit c4871513a2
4 changed files with 18 additions and 10 deletions

View File

@ -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.

View File

@ -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

View File

@ -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 {

View File

@ -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