Close #195. Allow configuring bind address

pull/194/head
Julien Ammous 2014-01-22 19:35:42 +01:00 committed by John Shahid
parent 5c1fc6a36c
commit 50942ef746
5 changed files with 26 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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(`
+---------------------------------------------+
| _____ __ _ _____ ____ |