2012-06-22 10 views
0

mongo 서버 또는 서버 또는 해당 ip : port에서 실행중인 서비스가 없지만 여전히 이러한 종류의 오류가 발생합니다.Mongo 서버에 연결할 수 없습니다.

(lockerdb) Database connection error: { [Error: failed to connect to [127.0.0.1:10004]] 
    [stack]: [Getter/Setter], 
    [message]: 'failed to connect to [127.0.0.1:10004]', 
    [arguments]: undefined, 
    [type]: undefined } 


node.js:201 

     throw e; // process.nextTick error, or 'error' event on first tick 






     ^

TypeError: Cannot call method 'close' of null 
    at /home/<user>/Documents/Server_v1/ssc/ssc-lac/lac-util.js:1653:15 
    at /home/<user>/node_modules/mongodb/lib/mongodb/db.js:247:16 
    at [object Object].<anonymous> (/home/<user>/node_modules/mongodb/lib/mongodb/connection/server.js:383:7) 
    at [object Object].emit (events.js:88:20) 
    at [object Object].<anonymous> (/home/<user>/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:93:15) 
    at [object Object].emit (events.js:70:17) 
    at Socket.<anonymous> (/home/<user>/node_modules/mongodb/lib/mongodb/connection/connection.js:385:10) 
    at Socket.emit (events.js:67:17) 
    at Array.0 (net.js:319:25) 
    at EventEmitter._tickCallback (node.js:192:41) 

이 오류의 원인은 무엇입니까?

+0

개인 정보 보호를 위해 일부 문자열을 수정했습니다. D –

답변

0

대부분의 경우 해당 포트의 서비스에 계속 연결하려고합니다.

기본 동작은 연결을 시도하고 볼 수없는 오류로 종료 할 수없는 경우입니다. 90 %의 연결 오류가 다운 된 DB를 의미하기 때문에 안전하지 못한 이유입니다. 귀하의 경우와 마찬가지로 나쁜 것이며 무시해서는 안됩니다.

이 오류를 극복하는 가장 쉬운 방법은 연결 오류가 수신 된 시점을 이해하고 그에 대해 조치를 취할 수 있도록 try catch 연결 블록입니다.

관련 문제