有台Linux系统上安装了mongo,只能本机访问,其他机器无法连接。
解决方案:
1、修改mongodb配置文件
bind_ip = 0.0.0.0
port = 27017
auth=true
2.重启mongodb
service mongodb stop
service mongodb start
以上内容参考:
http://www.111cn.net/database/MongoDB/54906.htm
但是,经过上述的修改后,log文件报了错误:
org.springframework.data.mongodb.UncategorizedMongoDbException: not authorized for query on users; nested exception is com.mongodb.MongoException: not authorized for query on users
我一看,not authorized(未经授权), 应该是auth=true导致的,将其注释。
果然,一切OK。