mongodb启动错误(Failed to set up listener: SocketException: Cannot assign requested address)

Posted xibuhaohao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mongodb启动错误(Failed to set up listener: SocketException: Cannot assign requested address)相关的知识,希望对你有一定的参考价值。

错误原因:
集群服务器修改过一次IP,但是对应的/etc/hosts文件没有修改
错误日志
cat /var/log/mongdb/mongd.log  
2019-01-16T09:50:44.675+0800 E STORAGE  [initandlisten] Failed to set up listener: SocketException: Cannot assign requested address
2019-01-16T09:50:44.675+0800 I CONTROL  [initandlisten] now exiting
2019-01-16T09:50:44.675+0800 I CONTROL  [initandlisten] shutting down with code:48
问题原因:配置文件mongod.conf中bindip填写有误
应该填写私有ip地址,而不是公网ip地址
解决办法:
修改/etc/hosts
 
 

以上是关于mongodb启动错误(Failed to set up listener: SocketException: Cannot assign requested address)的主要内容,如果未能解决你的问题,请参考以下文章

关于安装MongoDB4.0.9启动服务时显示connect failed错误的解决

基于WSL2 的 Docker Desktop 启动时 Failed to set version to docker-desktop exit code -1的解决方法

mongodb连接失败connect failed, fail to connect安装问题,js:257:13

mongodb启动报错,child process failed, exited with error number 1

tomcat启动时错误:Failed to start component [StandardEngine[Catalina].StandardHost[localhost].错误

mongodb使用mongo报错: Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: