尝试访问mongodb时遇到连接失败的错误。
我不知道问题出在哪里。我已经按照以下教程安装了mongo:[https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/] 和 [https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu-16.04/] 配置: 我使用的是Ubuntu 18.04。 非常感谢您的任何帮助,我已经阅读过很多答案并尝试了所有方法,但仍然面临相同的问题。提前致谢。
经过许多尝试后,我得到了以下结果:
while running
mongod
command I am getting2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] MongoDB starting : pid=2580 port=27017 dbpath=/data/db 64-bit host=gten 2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] db version v3.6.3 2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5 2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017 2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] allocator: tcmalloc 2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] modules: none 2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] build environment: 2019-02-25T11:05:05.871+0530 I CONTROL [initandlisten] distarch: x86_64 2019-02-25T11:05:05.871+0530 I CONTROL [initandlisten] target_arch: x86_64 2019-02-25T11:05:05.871+0530 I CONTROL [initandlisten] options: {} 2019-02-25T11:05:05.962+0530 I STORAGE [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating 2019-02-25T11:05:05.962+0530 I CONTROL [initandlisten] now exiting 2019-02-25T11:05:05.962+0530 I CONTROL [initandlisten] shutting down with code:100
当我运行 mongo
命令时,遇到了以下问题
MongoDB shell version v4.0.6
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-02-25T11:16:44.802+0530 E QUERY [js] 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:343:13
@(connect):1:6
exception: connect failed
我不知道问题出在哪里。我已经按照以下教程安装了mongo:[https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/] 和 [https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu-16.04/] 配置: 我使用的是Ubuntu 18.04。 非常感谢您的任何帮助,我已经阅读过很多答案并尝试了所有方法,但仍然面临相同的问题。提前致谢。
经过许多尝试后,我得到了以下结果:
2019-02-25T18:52:27.197+0530 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] MongoDB starting : pid=27390 port=27017 dbpath=/data/db 64-bit host=gten
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] db version v4.0.6
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] git version: caa42a1f75a56c7643d0b68d3880444375ec42e3
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] allocator: tcmalloc
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] modules: none
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] build environment:
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] distmod: ubuntu1804
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] distarch: x86_64
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] target_arch: x86_64
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] options: {}
2019-02-25T18:52:27.200+0530 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] now exiting
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] shutting down with code:48