无法使用mongo shell

时间:2018-05-29 14:51:28

标签: python windows mongodb command-line

C:\Windows\system32>c:\mongodb\bin\mongo.exe --port=14014
MongoDB shell version v3.4.7
connecting to: mongodb://127.0.0.1:14014/
2018-05-29T20:10:06.939+0530 W NETWORK  [thread1] Failed to connect to 127.0.0.1:14014 after 5000ms milliseconds, giving up.
2018-05-29T20:10:06.939+0530 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:14014, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

我在连接到数据库时遇到问题,我在本地运行的端口号为14014的Windows服务。

我能够看到该服务使用Windows任务管理器成功运行,我也可以使用Python访问它。但是我无法通过键入以下命令使用命令行连接它:

  

C:> C:\ mongodb \ bin \ mongo.exe --port = 14014

但是,我能够使用mongod.exe连接到我正在运行的端口27017上的另一个数据库。这非常莫名其妙!我希望有人可以帮助我!

我还在从端口14014运行的数据库服务的日志下方附加。

2018-05-29T20:06:00.169+0530 I CONTROL  [main] Trying to start Windows service 'MongoDB'
2018-05-29T20:06:00.170+0530 I CONTROL  [initandlisten] MongoDB starting : pid=6964 port=14041 dbpath=C:\Users\Lubna\Desktop\My Naseef\My Freelancing\mongodatabase\db 64-bit host=Lubna-PC
2018-05-29T20:06:00.170+0530 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten] db version v3.4.7
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten] git version: cf38c1b8a0a8dca4a11737581beafef4fe120bcd
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1u-fips  22 Sep 2016
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten] allocator: tcmalloc
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten] modules: none
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten] build environment:
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten]     distarch: x86_64
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten]     target_arch: x86_64
2018-05-29T20:06:00.171+0530 I CONTROL  [initandlisten] options: { config: "C:\Users\Lubna\Desktop\My Naseef\My Freelancing\mongodatabase\config\nwdb.cfg", net: { port: 14041 }, service: true, storage: { dbPath: "C:\Users\Lubna\Desktop\My Naseef\My Freelancing\mongodatabase\db" }, systemLog: { destination: "file", path: "C:\Users\Lubna\Desktop\My Naseef\My Freelancing\mongodatabase\log\nwdb.log" } }
2018-05-29T20:06:00.198+0530 I -        [initandlisten] Detected data files in C:\Users\Lubna\Desktop\My Naseef\My Freelancing\mongodatabase\db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-05-29T20:06:00.198+0530 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=949M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2018-05-29T20:06:02.582+0530 I CONTROL  [initandlisten] 
2018-05-29T20:06:02.582+0530 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-05-29T20:06:02.583+0530 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-05-29T20:06:02.583+0530 I CONTROL  [initandlisten] 
2018-05-29T20:06:02.583+0530 I CONTROL  [initandlisten] Hotfix KB2731284 or later update is not installed, will zero-out data files.
2018-05-29T20:06:02.583+0530 I CONTROL  [initandlisten] 
2018-05-29T20:06:03.960+0530 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/Users/Lubna/Desktop/My Naseef/My Freelancing/mongodatabase/db/diagnostic.data'
2018-05-29T20:06:03.961+0530 I NETWORK  [thread1] waiting for connections on port 14041
2018-05-29T20:06:03.961+0530 I STORAGE  [initandlisten] Service running
2018-05-29T20:06:56.578+0530 I NETWORK  [thread1] connection accepted from 127.0.0.1:50811 #1 (1 connection now open)
2018-05-29T20:06:56.645+0530 I NETWORK  [conn1] received client metadata from 127.0.0.1:50811 conn1: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Windows", name: "Windows 7", architecture: "AMD64", version: "6.1.7601-SP1" }, platform: "CPython 3.6.0.final.0" }
2018-05-29T20:06:56.709+0530 I NETWORK  [thread1] connection accepted from 127.0.0.1:50812 #2 (2 connections now open)
2018-05-29T20:06:56.709+0530 I NETWORK  [conn2] received client metadata from 127.0.0.1:50812 conn2: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Windows", name: "Windows 7", architecture: "AMD64", version: "6.1.7601-SP1" }, platform: "CPython 3.6.0.final.0" }
2018-05-29T20:06:57.017+0530 I COMMAND  [conn2] command workdb_test.cud_db command: find { find: "cud_db", filter: {} } planSummary: COLLSCAN keysExamined:0 docsExamined:4 cursorExhausted:1 numYields:0 nreturned:4 reslen:1116 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_query 297ms
2018-05-29T20:06:57.357+0530 I -        [conn1] end connection 127.0.0.1:50811 (2 connections now open)
2018-05-29T20:06:57.357+0530 I -        [conn2] end connection 127.0.0.1:50812 (2 connections now open)
2018-05-29T20:08:15.569+0530 I NETWORK  [thread1] connection accepted from 127.0.0.1:50855 #3 (1 connection now open)
2018-05-29T20:08:15.570+0530 I NETWORK  [conn3] received client metadata from 127.0.0.1:50855 conn3: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Windows", name: "Windows 7", architecture: "AMD64", version: "6.1.7601-SP1" }, platform: "CPython 3.6.0.final.0" }
2018-05-29T20:08:15.572+0530 I NETWORK  [thread1] connection accepted from 127.0.0.1:50856 #4 (2 connections now open)
2018-05-29T20:08:15.582+0530 I NETWORK  [conn4] received client metadata from 127.0.0.1:50856 conn4: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Windows", name: "Windows 7", architecture: "AMD64", version: "6.1.7601-SP1" }, platform: "CPython 3.6.0.final.0" }
2018-05-29T20:08:16.105+0530 I -        [conn4] end connection 127.0.0.1:50856 (2 connections now open)
2018-05-29T20:08:16.105+0530 I -        [conn3] end connection 127.0.0.1:50855 (1 connection now open)

1 个答案:

答案 0 :(得分:1)

我认为您的端口号码输入了一个拼写错误 - 最后两位数应该是相反的。

服务器正在接受端口140 41 上的连接,但您尝试连接端口140 14

相关问题