diff --git a/CHANGELOG.md b/CHANGELOG.md index d9225bf198..7051f6d02b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -165,7 +165,7 @@ - [Issue #184](https://github.com/influxdb/influxdb/issues/184). Implement Raft log compaction. - [Issue #153](https://github.com/influxdb/influxdb/issues/153). Implement continuous queries -## Bugfixes +### Bugfixes - [Issue #90](https://github.com/influxdb/influxdb/issues/90). Group by multiple columns panic - [Issue #89](https://github.com/influxdb/influxdb/issues/89). 'Group by' combined with 'where' not working @@ -192,3 +192,11 @@ - deprecate endpoints `/db/:db/admins/:user` in favor of using `/db/:db/users/:user` which should be used to update user flags, password, etc. - Querying for column names that don't exist no longer throws an error. + +## v0.5.0 [unreleased] + +### Bugfixes + +- [Issue #195](https://github.com/influxdb/influxdb/issues/195). Allow the bind address to be configurable, Thanks @schmurfy. + +### Deprecated diff --git a/config.toml.sample b/config.toml.sample index 4335373e25..1523a0a9eb 100644 --- a/config.toml.sample +++ b/config.toml.sample @@ -5,6 +5,8 @@ # that can be resovled here. # hostname = "" +bind-address = "0.0.0.0" + [logging] # logging level can be one of "debug", "info", "warn" or "error" level = "info" diff --git a/src/configuration/configuration.go b/src/configuration/configuration.go index afd35994ac..b1039142a8 100644 --- a/src/configuration/configuration.go +++ b/src/configuration/configuration.go @@ -45,6 +45,7 @@ type TomlConfiguration struct { Cluster ClusterConfig Logging LoggingConfig Hostname string + BindAddress string `toml:"bind-address"` } type Configuration struct { @@ -59,6 +60,7 @@ type Configuration struct { Hostname string LogFile string LogLevel string + BindAddress string } func LoadConfiguration(fileName string) *Configuration { @@ -93,6 +95,7 @@ func parseTomlConfiguration(filename string) (*Configuration, error) { LogFile: tomlConfiguration.Logging.File, LogLevel: tomlConfiguration.Logging.Level, Hostname: tomlConfiguration.Hostname, + BindAddress: tomlConfiguration.BindAddress, } return config, nil @@ -117,15 +120,15 @@ func parseJsonConfiguration(fileName string) (*Configuration, error) { } func (self *Configuration) AdminHttpPortString() string { - return fmt.Sprintf(":%d", self.AdminHttpPort) + return fmt.Sprintf("%s:%d", self.BindAddress, self.AdminHttpPort) } func (self *Configuration) ApiHttpPortString() string { - return fmt.Sprintf(":%d", self.ApiHttpPort) + return fmt.Sprintf("%s:%d", self.BindAddress, self.ApiHttpPort) } func (self *Configuration) ProtobufPortString() string { - return fmt.Sprintf(":%d", self.ProtobufPort) + return fmt.Sprintf("%s:%d", self.BindAddress, self.ProtobufPort) } func (self *Configuration) HostnameOrDetect() string { diff --git a/src/coordinator/raft_server.go b/src/coordinator/raft_server.go index ff5a4b3965..85fdc40309 100644 --- a/src/coordinator/raft_server.go +++ b/src/coordinator/raft_server.go @@ -35,6 +35,7 @@ type RaftServer struct { host string port int path string + bind_address string router *mux.Router raftServer raft.Server httpServer *http.Server @@ -69,6 +70,7 @@ func NewRaftServer(config *configuration.Configuration, clusterConfig *ClusterCo host: config.HostnameOrDetect(), port: config.RaftServerPort, path: config.RaftDir, + bind_address: config.BindAddress, clusterConfig: clusterConfig, notLeader: make(chan bool, 1), router: mux.NewRouter(), @@ -449,7 +451,7 @@ func (s *RaftServer) runContinuousQuery(db string, query *parser.SelectQuery, st } func (s *RaftServer) ListenAndServe() error { - l, err := net.Listen("tcp", fmt.Sprintf(":%d", s.port)) + l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", s.bind_address, s.port)) if err != nil { panic(err) } diff --git a/src/daemon/influxd.go b/src/daemon/influxd.go index c83bbc8510..2e9538ec4b 100644 --- a/src/daemon/influxd.go +++ b/src/daemon/influxd.go @@ -130,8 +130,12 @@ func main() { panic(err) } } - - log.Info("Starting Influx Server...") + + if config.BindAddress == "" { + log.Info("Starting Influx Server...") + } else { + log.Info("Starting Influx Server bound to %s ...", config.BindAddress) + } log.Info(` +---------------------------------------------+ | _____ __ _ _____ ____ |