Problema com o bind_ip no mongodb mon Virtualbox

1

Eu tenho lutado com mongo bind IP por um tempo, acho que esta é a hora de pedir ajuda. Estou usando somente o host% network192.168.56.0/24. Eu tenho 4 caixas. 3 caixas para mongo 192.168.56.111,192.168.56.112,192.168.56.113 . e uma caixa para o aplicativo 192.168.56.114 .

Portanto, para o mongo bind param é: bind_ip =127.0.0.1,192.168.56.114,192.168.56.113,192.168.56.112,192.168.56.111,10.0.2.1

2015-08-22T12:35:44.547+0000 E NETWORK  [initandlisten] listen(): bind() failed errno:99 Cannot assign requested address for socket: 192.168.56.114:27017
2015-08-22T12:35:44.553+0000 I JOURNAL  [initandlisten] journal dir=/var/lib/mongodb/journal
2015-08-22T12:35:44.554+0000 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2015-08-22T12:35:44.623+0000 I JOURNAL  [durability] Durability thread started
2015-08-22T12:35:44.624+0000 I JOURNAL  [journal writer] Journal writer thread started
2015-08-22T12:35:44.624+0000 I CONTROL  [initandlisten] MongoDB starting : pid=3519 port=27017 dbpath=/var/lib/mongodb 64-bit host=vagrant-ubuntu-trusty-64
2015-08-22T12:35:44.625+0000 I CONTROL  [initandlisten] db version v3.0.5
2015-08-22T12:35:44.625+0000 I CONTROL  [initandlisten] git version: 8bc4ae20708dbb493cb09338d9e7be6698e4a3a3
2015-08-22T12:35:44.625+0000 I CONTROL  [initandlisten] build info: Linux ip-10-183-35-50 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2015-08-22T12:35:44.625+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2015-08-22T12:35:44.626+0000 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1,192.168.56.114,192.168.56.113,192.168.56.112,192.168.56.111,10.0.2.15", port: 27017 }, storage: { dbPath: "/var/lib/mongodb" }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2015-08-22T12:35:44.631+0000 I CONTROL  [initandlisten] now exiting
2015-08-22T12:35:44.631+0000 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2015-08-22T12:35:44.632+0000 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2015-08-22T12:35:44.632+0000 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2015-08-22T12:35:44.632+0000 I NETWORK  [initandlisten] shutdown: going to close sockets...
2015-08-22T12:35:44.632+0000 I STORAGE  [initandlisten] shutdown: waiting for fs preallocator...
2015-08-22T12:35:44.632+0000 I STORAGE  [initandlisten] shutdown: final commit...
2015-08-22T12:35:44.635+0000 I JOURNAL  [initandlisten] journalCleanup...
2015-08-22T12:35:44.635+0000 I JOURNAL  [initandlisten] removeJournalFiles
2015-08-22T12:35:44.636+0000 I JOURNAL  [initandlisten] Terminating durability thread ...
2015-08-22T12:35:44.735+0000 I JOURNAL  [journal writer] Journal writer thread stopped
2015-08-22T12:35:44.736+0000 I JOURNAL  [durability] Durability thread stopped
2015-08-22T12:35:44.736+0000 I STORAGE  [initandlisten] shutdown: closing all files...
2015-08-22T12:35:44.736+0000 I STORAGE  [initandlisten] closeAllFiles() finished
2015-08-22T12:35:44.737+0000 I STORAGE  [initandlisten] shutdown: removing fs lock...
2015-08-22T12:35:44.737+0000 I CONTROL  [initandlisten] dbexit:  rc: 48

Eu realmente não vejo nada de errado com qualquer outro IP. Além de loopback, IP próprio e 0.0.0.0/0, qualquer outro IP falha ao iniciar o mongodb.

    
por black sensei 22.08.2015 / 15:01

1 resposta

1

A diretiva bind_ip destina-se a especificar os endereços IP no mesmo sistema para o qual o MongoDB escuta conexões, não endereços IP dos quais recebe conexões.

Set this option to configure the mongod or mongos process to bind to and listen for connections from applications on this address. You may attach mongod or mongos instances to any interface; however, if you attach the process to a publicly accessible interface, implement proper authentication or firewall restrictions to protect the integrity of your database.

Portanto, ele deve estar ausente (recomendado) ou conter 127.0.0.1 para aceitar apenas as conexões locais ou o endereço IP da interface de rede local.

Se você quiser restringir quais endereços IP podem se conectar ao MongoDB, será necessário usar o firewall.

    
por 25.08.2015 / 00:21