Tag: cqlsh

使用IN查询使用nodejs'cassandra-driver'准备好的查询

这是一个潜在的新手问题,但我无法在野外find答案。 我目前正在build立一个简单的用户事件日志这个表单(一些属性避免这个简单): CREATE TABLE events.by_hour ( level tinyint, /* 60 = FATAL, 10 = TRACE */ hour int, /* in YYYYMMDDHH format */ insertion_time timeuuid, userid TEXT, message TEXT, PRIMARY KEY ((type,hour),userid,insertion_time)) WITH CLUSTERING ORDER BY (userid ASC, insertion_time ASC); 我想做一个准备好的查询来获取所有的事件,任意过滤一个给定的用户在几个小时的过程中理想的一套水平。 我可以轻松构build查询单个级别和小时的查询: var cassandra = require('cassandra-driver'); var client = new cassandra.Client({contactPoints: ['127.0.0.1']}); var query = […]

公开在Kubernetes上运行的Cassandra

我正在Kubernetes上运行Cassandra(3个实例),并想将其暴露给外部,我的应用程序还没有在Kubernetes中。 所以我策划了一个负载平衡的服务,如下所示: apiVersion: v1 kind: Service metadata: namespace: getquanty labels: app: cassandra name: cassandra annotations: kubernetes.io/tls-acme: "true" spec: clusterIP: ports: – port: 9042 name: cql nodePort: 30001 – port: 7000 name: intra-node nodePort: 30002 – port: 7001 name: tls-intra-node nodePort: 30003 – port: 7199 name: jmx nodePort: 30004 selector: app: cassandra type: LoadBalancer 这是结果是: NAME […]

如何在Cassandra中使用cqlsh在map <text,boolean>字段中插入自定义types?

我得到这样的错误: field is not of type frozen<map<text, boolean>> 插入自定义types对象的任何示例,其中一个字段的types为frozen<map<text, boolean>> ? 任何想法如何使用nodejs cassandra-driver做到这一点? UPDATE 试图@Olivier Michallat提到。 但是我的答案如下。 任何想法,为什么它是这样而不是一个JOSN? cqlsh:test> create type t(m map<text, boolean>); cqlsh:test> create table foo(k int primary key, v frozen<t>); cqlsh:test> insert into foo(k,v) values (1, {m: {'foo': true}}); cqlsh:test> select * from foo; k | v —+————————————————————————- 1 | \x00\x00\x00\x10\x00\x00\x00\x01\x00\x00\x00\x03foo\x00\x00\x00\x01\x01 (1 […]