2012-09-24 2 views
2

에 원격 몽고 서버에 다음과 같은 삽입 내가 로컬를 을 실행할 때 않는 몽고에 삽입 할 수 없습니다,하지만 난 내 appfog 서버에서 실행할 때 삽입하지 않습니다.노드 + 몽고는 몇 가지 이유를 들어 로컬 호스트

function record_visit(req, res){ 
    res.write("<br/>Connecting to "+mongourl+"<br/>"); 
    mongo.connect(mongourl, function(err, conn){ 
     res.write("<br/>mongo.connect success. Err = "+err+"<br/>"); 
     conn.collection('ips', function(err, coll){ 
      res.write("<br/>conn.collection called on collection ips, err = "+err+"<br/>"); 
      object_to_insert = { 'ip': req.connection.remoteAddress, 'ts': new Date() }; 
      coll.insert(object_to_insert, {safe:true}, function(err){ 
       res.write("Inserted in collection 'ips' Err= "+err); 
       res.end('<br/>Done\n'); 
      }); 
     }); 
    }); 
} 

내 출력은 다음과 같습니다

Connecting to [correct authenticated url to mongo here] 

mongo.connect success. Err = null 

conn.collection called on collection ips, err = null 
Inserted in collection 'ips' Err= null 
Done 

내가 어딘가에 몇 가지 권한을 지정해야합니까?

답변

0

mongod에 --bind_ip arg를 사용하여 서버를 실제 컴퓨터의 IP에 바인딩 할 수 있습니다. 기본 동작은 모든 로컬 IP를 청취하고 있지만 서버의 실제 IP에 바인딩되어 있다는 것을 의미하지는 않습니다.

0

AppFog에서 mongo 서비스에 연결할 수없는 몇 가지 이유가 있습니다. 이 문서가 작동하지 않는 경우

http://docs.appfog.com/services/mongodb

, 당신은 [email protected]에서 그들의 지원에 직접 연락하거나 당신이 얻을 수 : 여기에 문서 AppFog에 몽고를 사용하여 시작하는 방법에 대한 URL은 운영중인 Google 그룹의 고객으로부터 직접 의견을 보내주세요. https://groups.google.com/forum/#!forum/appfog-users

관련 문제