MongoDB – bind()が失敗しましたerrno:99ソケットに要求されたアドレスを割り当てることができません
サーバー環境を確認します。サーバーBがサーバーA MongoDBデータベースにアクセスできるようにする必要があります。
Server A - MongoDB server Private IP - 192.168.162.129 / 17 Server B - Application Server Private IP - 192.168.204.205 / 17
bind_ip
を更新しますが、mongod
プロセスを開始できなくなります。
/etc/mongod.conf
#$ vim /etc/mongod.conf # Listen to local interface only. Comment out to listen on all interfaces. bind_ip = 127.0.0.1, 192.168.162.129, 192.168.204.205
/var/log/mongodb/mongod.log
E NETWORK [initandlisten] listen(): bind() failed errno:99 Cannot assign requested address for socket: 192.168.204.205:27017 E STORAGE [initandlisten] Failed to set up sockets during startup.
溶液
bind_ip
は「ローカルインターフェイスのみ」用です。同じLAN上のクライアント(サーバーBなど)がアクセスするには、put192.168.162.129
(サーバーAのプライベートIP)で十分です。
/etc/mongod.conf
#$ vim /etc/mongod.conf # Listen to local interface only. Comment out to listen on all interfaces. bind_ip = 127.0.0.1, 192.168.162.129