2014-01-27 54 views
1

免責聲明:這與我詢問here的另一個問題有關。我被建議提出一個新問題,而不是更新那個問題,我希望這是正確的。如果沒有,請讓我知道並忽略這個問題。使用node.js發佈到Neo4j服務器

我一直在試圖在Microsoft Azure中使用Neo4j,使用this tutorial。我創建了一個運行Linux和neo4j的虛擬機。我知道他的工作很好,因爲我可以通過Web管理門戶訪問數據庫,我可以在其中創建和刪除條目。然而,當我嘗試使用node.js插入元素時,問題就出現了。

這裏是腳本代碼:

function insert(item, user, request) { 
    //comment to trigger .js creation 
    var neo4j = require('neo4j'); 
    var db = new neo4j.GraphDatabase('http://<username>:<password>@neo4jmobile.cloudapp.net:7474'); 
    var node = db.createNode({ name: item.name }); 
    node.save(function (err, node) { 
     if (err) { 
      console.error('Error saving new node to database:', err); 
     } 
     else { 
      console.log('Node saved to database with id:', node.id); 
     } 
    }); 

    request.execute(); 

} 

我收到此錯誤信息:

Error saving new node to database: { [Error: connect ETIMEDOUT] 
    stack: [Getter/Setter], 
    code: 'ETIMEDOUT', 
    errno: 'ETIMEDOUT', 
    syscall: 'connect', 
    __frame: 
    { name: 'GraphDatabase_prototype__getRoot__1', 
    line: 76, 
    file: '\\\\10.211.156.195\\volume-0-default\\bf02c8bd8f7589d46ba1\\4906fa4587734dd087df8e641513f602\\site\\wwwroot\\App_Data\\config\\scripts\\node_modules\\neo4j\\lib\\GraphDatabase.js', 
    prev: 
     { name: 'GraphDatabase_prototype_getServices__2', 
     line: 99, 
     file: '\\\\10.211.156.195\\volume-0-default\\bf02c8bd8f7589d46ba1\\4906fa4587734dd087df8e641513f602\\site\\wwwroot\\App_Data\\config\\scripts\\node_modules\\neo4j\\lib\\GraphDatabase.js', 
     prev: [Object], 
     active: false, 
     offset: 5, 
     col: 12 }, 
    active: false, 
    offset: 5, 
    col: 12 }, 
    rawStack: [Getter] } 

任何幫助,將不勝感激!

+0

你可以訪問目標Linux服務器的Neo4j瀏覽器嗎?這看起來像是一個防火牆問題。 –

回答

1

您的網址仍然是錯誤的:http://<username>:<password>@http://neo4jmobile.cloudapp.net:7474應該是http://<username>:<password>@neo4jmobile.cloudapp.net:7474

在所涉及的教程(這是BTW相當不錯的),他說:

var db = new neo4j.GraphDatabase('http://<username>:<password>@<your neo url>.cloudapp.net:7474'); 

哪裏是指主機名,即:neo4jmobile

+0

我已經改變了這一點,正如我在前一篇文章中所說的那樣。我在這篇文章中意外地沒有糾正它。但我已經解決了這個問題,這不是問題。感謝您花時間回覆,但我很抱歉,我搞砸了。 –

相關問題