首页 > 解决方案 > Mongodb:连接被拒绝

问题描述

我想在远程服务器上启动一个配置节点,但是当我启动一个mongod进程时,用mongo命令打不开。甚至在本地节点上也打不开。</p>

root@Ubuntu04:~/mongodb# mongod --configsvr --replSet mongoConfig --dbpath config2/data --bind_ip [localhost,master] --port 21000 --logpath config2/log/config.log --fork
about to fork child process, waiting until server is ready for connections.
forked process: 833
child process started successfully, parent exiting
root@Ubuntu04:~/mongodb# mongo localhost:21000
MongoDB shell version v4.2.5
connecting to: mongodb://localhost:21000/test?compressors=disabled&gssapiServiceName=mongodb
2020-03-27T17:15:23.552+0800 E  QUERY    [js] Error: couldn't connect to server localhost:21000, connection attempt failed: SocketException: Error connecting to localhost:21000 (127.0.0.1:21000) :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-03-27T17:15:23.555+0800 F  -        [main] exception: connect failed
2020-03-27T17:15:23.555+0800 E  -        [main] exiting with code 1

标签: mongodb

解决方案


推荐阅读