Skip to content

Commit b3c19ae

Browse files
authored
Merge pull request #140 from arangodb-helper/bind_address
Added `--starter.host` option
2 parents 84851d3 + 94b0131 commit b3c19ae

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Changes from version 0.10.4 to master
22

3+
- Added `--starter.host` option, to bind the HTTP server to a specific network interface instead of the default `0.0.0.0`.
34
- Added `POST /data-auto-upgrade` support to perform a rolling upgrade of all servers (with single `--database.auto-upgrade` restart)
45
- Renamed mode option `resilientsingle` to `activefailover`. (`resilientsingle` is being supported as alias for a while)
56
- Added support for log file rotation for started server components.

docs/Manual/Programs/Starter/Options.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ that `--cluster.agency-size` is set to 1 (see below), the master has to know
6161
under which address it can be reached from the outside. If you specify
6262
`localhost` here, then all instances must run on the local machine.
6363

64+
- `--starter.host=addr`
65+
66+
`addr` is the address to which this server binds. (default "0.0.0.0")
67+
68+
Usually there is no need to specify this option.
69+
Only when you want to bind the starter to specific network device,
70+
would you set this.
71+
Note that setting this option to `127.0.0.1` will make this starter
72+
unreachable for other starters, which is only allowed for
73+
`single` server deployments or when using `--starter.local`.
74+
6475
- `--docker.image=image`
6576

6677
`image` is the name of a Docker image to run instead of the normal

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ var (
9797
mode string
9898
dataDir string
9999
ownAddress string
100+
bindAddress string
100101
masterAddresses []string
101102
verbose bool
102103
serverThreads int
@@ -148,6 +149,7 @@ func init() {
148149
f.StringVar(&mode, "starter.mode", "cluster", "Set the mode of operation to use (cluster|single|activefailover)")
149150
f.BoolVar(&startLocalSlaves, "starter.local", false, "If set, local slaves will be started to create a machine local (test) cluster")
150151
f.StringVar(&ownAddress, "starter.address", "", "address under which this server is reachable, needed for running in docker or in single mode")
152+
f.StringVar(&bindAddress, "starter.host", "0.0.0.0", "address used to bind the starter to")
151153
f.StringVar(&id, "starter.id", "", "Unique identifier of this peer")
152154
f.IntVar(&masterPort, "starter.port", service.DefaultMasterPort, "Port to listen on for other arangodb's to join")
153155
f.BoolVar(&allPortOffsetsUnique, "starter.unique-port-offsets", false, "If set, all peers will get a unique port offset. If false (default) only portOffset+peerAddress pairs will be unique.")
@@ -650,6 +652,7 @@ func mustPrepareService(generateAutoKeyFile bool) (*service.Service, service.Boo
650652
RrPath: rrPath,
651653
DataDir: dataDir,
652654
OwnAddress: ownAddress,
655+
BindAddress: bindAddress,
653656
MasterAddresses: masterAddresses,
654657
Verbose: verbose,
655658
ServerThreads: serverThreads,

service/service.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type Config struct {
5858
RrPath string
5959
DataDir string
6060
OwnAddress string // IP address of used to reach this process
61+
BindAddress string // IP address the HTTP server binds to (typically '0.0.0.0')
6162
MasterAddresses []string
6263
Verbose bool
6364
ServerThreads int // If set to something other than 0, this will be added to the commandline of each server with `--server.threads`...
@@ -935,7 +936,7 @@ func (s *Service) createHTTPServer(config Config) (srv *httpServer, containerPor
935936
if err != nil {
936937
return nil, 0, "", "", maskAny(err)
937938
}
938-
containerAddr = fmt.Sprintf("0.0.0.0:%d", containerPort)
939+
containerAddr = net.JoinHostPort(config.BindAddress, strconv.Itoa(containerPort))
939940
hostAddr = net.JoinHostPort(config.OwnAddress, strconv.Itoa(hostPort))
940941

941942
// Create HTTP server

0 commit comments

Comments
 (0)