Tag: helenus

Cassandra – NodeJS – 检索地图types值时发出

我在我的node-js项目中使用helenus来获取/设置cassandra的值。 我在表中有一个MapType字段,但是当我从表中检索值时,我得到一个空的键值集。 下面是我的表的架构 CREATE TABLE datapoints ( id uuid PRIMARY KEY, created_at timestamp, properties map<text,text> ); 我使用下面的查询插入了来自cql的值 INSERT INTO datapoints (id, properties) VALUES (24053e20-63e9-11e3-8d81-0002a5d5c51b, { 'fruit' : 'apple', 'band' : 'Beatles' }); 以下是我的nodejs代码: var helenus = require('/usr/local/lib/node_modules/helenus') var pool = new helenus.ConnectionPool({ hosts : ['localhost:9160'], keyspace : 'mykeyspace', timeout : 3000 }); pool.connect(function(err, keyspace){ if(err){ […]

Node.js lsof – 许多打开的数据库连接

当我在我的服务器上运行“lsof | grep node”(运行node.js应用程序)时,我得到了大约1000多行(db连接到端口9160)。 每行看起来像这样: node 17006 root 160u IPv4 1362100969 0t0 TCP localhost:47813->localhost:9160 (ESTABLISHED) 这是一个testingnode.js服务器,做一些非常简单的事情。 (使用Helenus模块将请求logging到Cassandra DB) 我很惊讶有这么多的开放式的连接,现在肯定不应该有1-2个连接。 这是否意味着我不能在Node应用程序中正确结束我的数据库连接? 我的代码如下。 谢谢。 var express = require('express') , routes = require('./routes') , app = express.createServer(); app.configure(function(){ app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); }); process.on('uncaughtException', function (err) { logger.error('Caught exception: ' + err); }); function respond_test(req, res, next) { var […]

如何从UUID v1(TimeUUID)使用JavaScript提取时间戳?

我使用Cassandra DB和Helenus模块来控制nodejs。 我有一些包含TimeUUID列的行。 如何从JavaScript中的TimeUUID获取时间戳?

在CQL查询中更改Helenus一致性级别

我正在用Cassandra和Node.JS驱动程序Helenus做一些testing。 有没有办法改变一个查询的一致性级别,使用CQL? Helenus文档仅显示使用Helenus Thrift连接器执行此操作的示例,但我想使用CQL连接器。 我试图像这样查询Cassandra conn.cql(cqlRead, vals, {ConsistencyLevel:ANY, gzip:true}, cb); 但节点抛出这个错误 ReferenceError: ANY is not defined 然后,我将“ANY”更改为“1”,节点运行代码,但没有发现任何差异。