我试图在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文件套接字的东西。任何想法?
答案 0 :(得分:0)
我在arrangojs上打开了一个关于unix文件套接字缺乏支持的错误报告。他们回答说它不受支持。尚不支持unix://
,但nodejs的http.request
支持socketPath
参数。