Springboot bootstrap.xml配置连接mongodb数据库带账号密码 以及连接Time out after...

项目导入的包的版本

 

 

 

系统: 

  Centos7, 64位

  mongo,mongodb-linux-x86_64-rhel70-4.0.10

配置如下:

 

 

 

如果配置正确,报以下错误,可以考虑是不是防火墙没关的原因

 

 

 

 

用linux本地连接mongo测试是没有问题的,证明服务没有问题

 

那是什么呢?检查防火墙

 

[root@localhost data]# systemctl stop firewalld.service #停止firewall
[root@localhost data]# systemctl disable firewalld.service #禁止firewall开机启动
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost data]# 

 

Linux启动命令:进入bin,启动

 ./mongod --dbpath=/data/db/ --config=./mongodb.conf &

 

 

 

 

 

菜鸟程序媛,若有需修正之处,望指正~

WeChat/QQ:2463105280

【顺便说一下湖南有需要报考学历、证件的可以咨询我,保证毕业拿证,学信网可查学籍!给娃赚点尿不湿~】

posted @ 2022-01-11 10:14  阿迪di  阅读(498)  评论(0编辑  收藏  举报
Title