cassandra

Range query on clustering key

不想你离开。 提交于 2021-02-10 06:31:12
问题 I have a table where I am logging user activity performed on my website. My table structure looks like: CREATE TABLE key_space.log ( id uuid, time bigint, ip text, url text, user_id int, PRIMARY KEY (id, time) ) WITH CLUSTERING ORDER BY (time DESC) Now I want to fetch all the records which came in last 5 minutes. For doing the same, I am using select * from key_space.log where time>current_timestamp - 5 minutes ALLOW FILTERING; But this query is not returning any result & i am getting

Cassandra Query Performance: Using IN clause for one portion of the composite partition key

穿精又带淫゛_ 提交于 2021-02-10 05:42:11
问题 I currently have a table set up in Cassandra that has either text, decimal or date type columns with a composite partition key of a business_date and an account_number. For queries to this table, I need to be able to support look-ups for a single account, or for a list of accounts, for a given date. Example: select x,y,z from my_table where business_date = '2019-04-10' and account_number IN ('AAA', 'BBB', 'CCC') //Note: Both partition keys are provided for this query I've been struggling to

Cassandra Query Performance: Using IN clause for one portion of the composite partition key

大城市里の小女人 提交于 2021-02-10 05:41:48
问题 I currently have a table set up in Cassandra that has either text, decimal or date type columns with a composite partition key of a business_date and an account_number. For queries to this table, I need to be able to support look-ups for a single account, or for a list of accounts, for a given date. Example: select x,y,z from my_table where business_date = '2019-04-10' and account_number IN ('AAA', 'BBB', 'CCC') //Note: Both partition keys are provided for this query I've been struggling to

Cassandra Query Performance: Using IN clause for one portion of the composite partition key

感情迁移 提交于 2021-02-10 05:41:15
问题 I currently have a table set up in Cassandra that has either text, decimal or date type columns with a composite partition key of a business_date and an account_number. For queries to this table, I need to be able to support look-ups for a single account, or for a list of accounts, for a given date. Example: select x,y,z from my_table where business_date = '2019-04-10' and account_number IN ('AAA', 'BBB', 'CCC') //Note: Both partition keys are provided for this query I've been struggling to

How to delete a row in cassandra materialiezed view?

匆匆过客 提交于 2021-02-10 05:28:05
问题 I have a cassadra namespace with a table and a materialized view from it. A row got deleted in the base table but the change was not propagated to the materialized view. I don't know the exact reason why this happend. So now I am stuck with that row in the MV and I am not able to delete it. Any ideas? 回答1: Yeah, materialized views are still very much broken. The two main problems are: There isn't a way to know when a MV is out of sync. Once it's out of sync, there really isn't a way to get it

Node.js Streaming/Piping Error Handling (Change Response Status on Error)

巧了我就是萌 提交于 2021-02-08 19:57:46
问题 I have millions of rows in my Cassandra db that I want to stream to the client in a zip file (don't want a potentially huge zip file in memory). I am using the stream() function from the Cassandra-Node driver, piping to a Transformer which extracts the one field from each row that I care about and appends a newline, and pipes to archive which pipes to the Express Response object. This seems to work fine but I can't figure out how to properly handle errors during streaming. I have to set the

What is the index structure of Cassandra

徘徊边缘 提交于 2021-02-08 08:29:02
问题 Cassandra uses LSM tree for storage, but what exactly is the index structure of cassandra ? For e.g Both Mongo and Couchbase use BTree. 回答1: It depends on the version of Cassandra you are actually using. For version prior to 3.4 indexes are implemented as hidden Cassandra tables holding the key value of the data you wish to access. Main disadvantage of this strategy is that since SStables are subjected to compactions, you cannot reference data directly, instead you are given a key, and you

What is the index structure of Cassandra

佐手、 提交于 2021-02-08 08:28:20
问题 Cassandra uses LSM tree for storage, but what exactly is the index structure of cassandra ? For e.g Both Mongo and Couchbase use BTree. 回答1: It depends on the version of Cassandra you are actually using. For version prior to 3.4 indexes are implemented as hidden Cassandra tables holding the key value of the data you wish to access. Main disadvantage of this strategy is that since SStables are subjected to compactions, you cannot reference data directly, instead you are given a key, and you

SSL options in gocql

萝らか妹 提交于 2021-02-08 05:16:04
问题 In my Cassandra config I have enabled user authentication and connect with cqlsh over ssl. I'm having trouble implementing the same with gocql, following is my code: cluster := gocql.NewCluster("127.0.0.1") cluster.Authenticator = gocql.PasswordAuthenticator{ Username: "myuser", Password: "mypassword", } cluster.SslOpts = &gocql.SslOptions { CertPath: "/path/to/cert.pem", } When I try to connect I get following error: gocql: unable to create session: connectionpool: unable to load X509 key

Datastax QueryBuilder insert statement

我是研究僧i 提交于 2021-02-07 20:21:06
问题 What would be the right way to build a insert statement with QueryBuilder from Datastax Java Driver for Cassandra I am using Cassandra 2.x with Java Driver 2.0.0-rc1 I know i could use a prepared statement to achieve the same but i am looking forward to using the QueryBuilder @Test public void testTableInsert() { Insert insert = QueryBuilder .insertInto(KEYSPACE_NAME, TABLE_NAME) .value("username", "jdoe") .value("first", "John") .value("last", "Doe"); System.out.println(insert.toString());