宝塔安装mongodb无法开启解决笔记!
2021-09-06 本文已影响0人
DragonersLi
宝塔
mongodb
安装v4.4.6
面板上无法启动.service mongodb start
命令行启动提示如下,打开配置文件找到fork
改成false
或直接注销,再次执行启动没有提示信息。
There doesn't seem to be a server running with dbpath: /www/server/mongodb/data
about to fork child process, waiting until server is ready for connections.
forked process: 10864
ERROR: child process failed, exited with 14
To see additional information in this output, start without the "--fork" option.
mongod
服务未启动,启动客户端mongo
报错:
[root@test bin]# ./mongo
MongoDB shell version v4.4.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
bindIp:
0.0.0.0
不能是127.0.0.1
服务器上测试,一个窗口开启mongod:./mongod --dbpath /www/server/mongodb/data/
,
另一个窗口开启mongo:./mongo
是可以的,但这样肯定是不正常的。
sudo /etc/init.d/mongodb restart
等各种方式都无法正常启动
最后发现是mongodb使用的端口
27017
未开放。宝塔卸载mongodb
,删除/www/server/mongodb
目录。阿里云开放入端口27017
,源0.0.0.0/0
,重新安装自动开启。
windows
命令行开启mongodb
D:\workplace\mongodb\bin>
mongod.exe --config D:\workplace\mongodb\mongodb.conf --install --serviceName "mongodb"
D:\workplace\mongodb\bin>net start mongodb
#或者
D:\workplace\mongodb\bin>sc start mongodb
#打开windows服务查看
D:\workplace\mongodb\bin>services.msc