Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow snapshot endpoint to be disabled #2091

Merged
merged 1 commit into from
Mar 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions cmd/influxd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type Config struct {
} `toml:"data"`

Snapshot struct {
Enabled bool `toml:"enabled"`
BindAddress string `toml:"bind-address"`
Port int `toml:"port"`
}
Expand Down Expand Up @@ -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
Expand Down
24 changes: 14 additions & 10 deletions cmd/influxd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions etc/config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down