0
我處於與mongodb遠程連接的一種奇怪的情況。 我在ec2實例上有一個Mongo DB,並且已經配置了密碼驗證。Mongo在遠程服務器上顯示集合在Windows上工作,但在Ubuntu上Stucks
當我連接它並在Windows平臺上瀏覽集合時,它工作正常,但是當我嘗試在Amazon ec2(Ubuntu)上執行相同操作時,它只會卡住。 儘管我可以在Ubuntu實例上連接,但是當我嘗試運行commmand show collections時,服務器只是掛起。
Windows的
E:\check\scheduler\trunk>mongo 54.xxx.xx.xx:27017/vdb -u vadmin -p [email protected]
MongoDB shell version: 2.6.4
connecting to: 54.xxx.xx.xx:27017/vdb
> use vdb;
switched to db vdb
> show collections;
activity
user
adminpush
adminuserlog
friend
demo
addressbook
branddemovideo
的Ubuntu(EC2實例)
[email protected]:~$ mongo 54.xxx.xx.xx:27017/vdb -u vadmin -p '[email protected]'
MongoDB shell version: 2.6.5
connecting to: 54.xxx.xx.xx:27017/vdb
> show databases;
admin 0.078125GB
local 0.078125GB
vdb 1.49951171875GB
> use vdb;
switched to db vdb
> show collections;
Its Just Stuck over here.
最後一段時間後,我看到了人爲錯誤的
Mon Oct 20 19:52:51.949 Socket recv() errno:104 Connection reset by peer 54.xxx.xx.xx:27017
Mon Oct 20 19:52:51.954 SocketException: remote: 54.xxx.xx.xx:27017 error: 9001 socket exception [RECV_ERROR] server [54.xxx.xx.xx:27017]
Mon Oct 20 19:52:51.954 DBClientCursor::init call() failed
Mon Oct 20 19:52:51.955 Error: error doing query: failed at src/mongo/shell/query.js:78
Mon Oct 20 19:52:51.955 trying reconnect to 54.xxx.xx.xx:27017
Mon Oct 20 19:52:51.969 reconnect 54.xxx.xx.xx:27017 ok
蒙戈如下─
給出日誌本地服務器
[email protected]:/var/log/mongodb$ tail -f mongodb.log
2014-10-20T20:34:50.621+0530 [clientcursormon] connections:0
2014-10-20T20:39:50.633+0530 [clientcursormon] mem (MB) res:36 virt:342
2014-10-20T20:39:50.633+0530 [clientcursormon] mapped (incl journal view):160
2014-10-20T20:39:50.633+0530 [clientcursormon] connections:0
2014-10-20T20:44:50.645+0530 [clientcursormon] mem (MB) res:36 virt:342
2014-10-20T20:44:50.645+0530 [clientcursormon] mapped (incl journal view):160
2014-10-20T20:44:50.645+0530 [clientcursormon] connections:0
2014-10-20T20:49:50.658+0530 [clientcursormon] mem (MB) res:36 virt:342
2014-10-20T20:49:50.658+0530 [clientcursormon] mapped (incl journal view):160
2014-10-20T20:49:50.658+0530 [clientcursormon] connections:0
遠程服務器 -
2014-10-20T20:55:05.688+0530 [initandlisten] connection accepted from 54.xxx.xxx.xxx:57881 #42 (11 connections now open)
2014-10-20T20:55:05.692+0530 [conn42] authenticate db: vdb { authenticate: 1, nonce: "xxx", user: "vadmin", key: "xxx" }
2014-10-20T20:55:36.039+0530 [conn13] query vdb.video query: { query: { videoType: 5, viewType: 1, status: { $nin: [ 2, 5, 3 ] }, location.regionId: 2, frameHeight: { $gt: 0 } }, orderby: { popularRating: -1 } } planSummary: IXSCAN { location.regionId: 1 }, IXSCAN { location.regionId: 1 } cursorid:86724525795 ntoreturn:3 ntoskip:0 nscanned:2892 nscannedObjects:2892 keyUpdates:0 numYields:1 locks(micros) r:232390 nreturned:3 reslen:8101 116ms
2014-10-20T20:55:36.087+0530 [conn9] query vdb.video query: { query: { videoType: 5, viewType: 1, status: { $nin: [ 2, 5, 3 ] }, location.regionId: 2, frameHeight: { $gt: 0 } }, orderby: { popularRating: -1 } } planSummary: IXSCAN { location.regionId: 1 }, IXSCAN { location.regionId: 1 } cursorid:86710924707 ntoreturn:3 ntoskip:0 nscanned:2892 nscannedObjects:2892 keyUpdates:0 numYields:1 locks(micros) r:162238 nreturned:3 reslen:8101 112ms
mongo服務器的日誌說什麼? – RickyA 2014-10-20 15:13:54
最後我解決了它。 我在VPC工作,必須使用私有IP連接到遠程mongo以及mysql。 – Rahul 2014-10-20 17:45:10
不錯........... – RickyA 2014-10-20 17:49:29