0

我正在尝试在 Gentoo Linux 上使用带有 unix 文件套接字的 Nodejs 7.5.0 连接到 arangodb3。

我在 /tmp/mysocket 启动了带有 unix 套接字的 arrangodb3 服务器。

我尝试了两个不同的模块:

const arangojs = require('arangojs');

let db = arangojs({
  url: `unix:///tmp/mysocket`,
    databaseName: false // don't automatically append database path to URL
    });

db.createDatabase('mydb', function (err, info) {
    if (err) console.error(err.stack);
    else {
    console.info('database created');
        // database created
    }
});

这给了我:

Error: connect ECONNREFUSED ::1:80
    at Object.exports._errnoException (util.js:1023:11)
    at exports._exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)

所以它尝试连接到 localhost 端口 80,忽略我的 unix 套接字文件位置

我也试过:

var arango = require('arango');

var db = arango.Connection("unix:///tmp/mysocket");

 db.collection.list().done(function(res){
   console.log("collections: %j", res);
   });

这给了我:

Error: Cannot find module 'unix'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Xhr (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/xhr.js:23:12)
    at Arango.request (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/arango.js:166:2)
    at Arango.(anonymous function) [as get] (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/arango.js:204:14)
    at Object.list (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/api/collection/index.js:125:16)
    at Object.instance.(anonymous function) [as list] (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/api/api.js:121:25)
    at Object.<anonymous> (/home/ufk/work-projects/bingo/arrango/index2.js:5:16)

我真的不在乎使用哪个模块.. 只是在寻找支持 unix 文件套接字的东西。有任何想法吗 ?

4

1 回答 1

0

我打开了关于 arrangojs 的关于缺乏对 unix 文件套接字的支持的错误报告。他们回应说不支持。unix://尚不支持,但 nodejs 的支持http.request参数socketPath

于 2017-02-15T11:36:41.213 回答