patternMinor
Bind MongoDB to IPv4, as well as IPv6
Viewed 0 times
ipv4mongodbwellbindipv6
Problem
Mongo v. 3.4
respective part of config file:
No matter the format I've used:
I always get:
How do I properly bind Mongo to listen on IPv6 address? Note that this is version 3.4, where net.ipv6 is not necessary anymore.
respective part of config file:
#network interfaces
net:
port: 27017
bindIp: 127.0.0.1,192.168.0.15,2001:db8:0:0:0:0:2:1 (IPs are made up)No matter the format I've used:
- [2001:db8:0:0:0:0:2:1]
- [2001:db8:0:0:0:0:2:1%eth1]
I always get:
2017-05-17T09:54:54.358 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1,192.168.0.15,2001:db8:0:0:0:0:2:1", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongod.pid" }, storage: { dbPath: "/var/lib/mongo", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongo/mongod.log" } }
2017-05-17T09:54:54.384 I NETWORK [initandlisten] getaddrinfo("2001:db8:0:0:0:0:2:1") failed: Address family for hostname not supported
2017-05-17T09:54:54.385 E NETWORK [initandlisten] listen(): socket is invalid.
2017-05-17T09:54:54.385 E NETWORK [initandlisten] Failed to set up sockets during startup.
2017-05-17T09:54:54.385 E STORAGE [initandlisten] Failed to set up listener: InternalError: Failed to set up sockets
2017-05-17T09:54:54.385 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-05-17T09:54:54.385 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-05-17T09:54:54.385 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-05-17T09:54:54.385 I CONTROL [initandlisten] now exiting
2017-05-17T09:54:54.385 I CONTROL [initandlisten] shutting down with code:48How do I properly bind Mongo to listen on IPv6 address? Note that this is version 3.4, where net.ipv6 is not necessary anymore.
Solution
Did you find an answer yet? If not, here is the solution:
IPv6 is disabled by default, you have to enable it for binding on IPv6. The following net-config should work:
IPv6 is disabled by default, you have to enable it for binding on IPv6. The following net-config should work:
net:
ipv6: true
port: 27017
bindIp: 127.0.0.1,192.168.0.15,2001:db8:0:0:0:0:2:1 (IPs are made up)Code Snippets
net:
ipv6: true
port: 27017
bindIp: 127.0.0.1,192.168.0.15,2001:db8:0:0:0:0:2:1 (IPs are made up)Context
StackExchange Database Administrators Q#173781, answer score: 2
Revisions (0)
No revisions yet.