question
stringlengths
11
28.2k
answer
stringlengths
26
27.7k
tag
stringclasses
130 values
question_id
int64
935
78.4M
score
int64
10
5.49k
How would I have multiple $or operations? So far I've tried the following but it silently ignores the 2nd $or. { $or: [{a: 2}, {a: 3}], $or: [{b: 5}, {b: 4}] } I assume this is because I'm using two identical keys. Is there any way around this?
Mongo 2.0 added an $and operator, so you can do a query like this: db.things.find({$and: [{$or : [{'a':1},{'b':2}]},{$or : [{'a':2},{'b':3}]}] }) http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24and
MongoDB
5,150,061
90
In MongoDB, if I were to store an array (say ["red", "blue"]) in a field "color", does it index "red" and "blue" so I could query for "red", for example, or does in make {"red", "blue"} a composite index?
When it comes to indexing arrays, MongoDB indexes each value of the array so you can query for individual items, such as "red." For example: > db.col1.save({'colors': ['red','blue']}) > db.col1.ensureIndex({'colors':1}) > db.col1.find({'colors': 'red'}) { "_id" : ObjectId("4ccc78f97cf9bdc2a2e54ee9"), "colors" : [ "red...
MongoDB
4,059,126
90
The following is my MongoDB connection dial from GoLang. But it's returning a panic "server returned error on SASL authentication step: Authentication failed.". My username, password, hostAddrs and dbName are correct. What am I missing here? dbName: = os.Getenv("ENV_DBNAME") userName: = os.Getenv("ENV_DBUSER") password...
I faced similar error and added --authenticationDatabase parameter and it worked while we connecting to a remote MongoDB Use the similar below format in your code : $mongorestore --host databasehost:98761 --username restoreuser --password restorepwd --authenticationDatabase admin --db targetdb ./path/to/dump/
MongoDB
38,744,131
89
MongoDB bulk operations have two options: Bulk.find.updateOne() Adds a single document update operation to a bulk operations list. The operation can either replace an existing document or update specific fields in an existing document. Bulk.find.replaceOne() Adds a single document replacement operation to a bulk...
With replaceOne() you can only replace the entire document, while updateOne() allows for updating fields. Since replaceOne() replaces the entire document - fields in the old document not contained in the new will be lost. With updateOne() new fields can be added without losing the fields in the old document. For exampl...
MongoDB
35,848,688
89
I have a collection of documents : { "networkID": "myNetwork1", "pointID": "point001", "param": "param1" } { "networkID": "myNetwork2", "pointID": "point002", "param": "param2" } { "networkID": "myNetwork1", "pointID": "point003", "param": "param3" } ... pointIDs are unique but netw...
I think you can use db.collection.distinct(field, query, options) mongosh method as documented here You will be able to get the distinct values in your case for NetworkID. The options argument (and even the query argument) are optional, so you can specify just the field argument as 'NetworkID' It should be something li...
MongoDB
28,155,857
89
If someone can provide some insights here I would GREATLY appreciate it. I had a express/node.js app running on MongoDB locally successfully, but upon restarting my computer, I attempted to restart the Mongo server and it began giving errors and wouldn't start. Since then, I have re-installed Mongo several times only t...
If you have installed mongodb through homebrew then you can simply start mongodb through (mongodb-community if installted mongodb-community brew services start mongodb OR brew services start mongodb-community Then access the shell by mongo You can shut down your db by brew services stop mongodb You can restart your...
MongoDB
18,452,023
89
I'm doing a python script that writes some data to a mongodb. I need to close the connection and free some resources, when finishing. How is that done in Python?
Use close() method on your MongoClient instance: client = pymongo.MongoClient() # some code here client.close() Cleanup client resources and disconnect from MongoDB. End all server sessions created by this client by sending one or more endSessions commands. Close all sockets in the connection pools and stop the mon...
MongoDB
18,401,015
89
I have over 300k records in one collection in Mongo. When I run this very simple query: db.myCollection.find().limit(5); It takes only few miliseconds. But when I use skip in the query: db.myCollection.find().skip(200000).limit(5) It won't return anything... it runs for minutes and returns nothing. How to make it bet...
One approach to this problem, if you have large quantities of documents and you are displaying them in sorted order (I'm not sure how useful skip is if you're not) would be to use the key you're sorting on to select the next page of results. So if you start with db.myCollection.find().limit(100).sort({created_date:tru...
MongoDB
7,228,169
89
I would like to connect to the database specified in the connection string, without specifying it again in GetDatabase. For example, if I have a connection string like this; mongodb://localhost/mydb I would like to be able to db.GetCollection("mycollection") from mydb. This would allow the database name to be config...
Update: MongoServer.Create is obsolete now (thanks to @aknuds1). Instead this use following code: var _server = new MongoClient(connectionString).GetServer(); It's easy. You should first take database name from connection string and then get database by name. Complete example: var connectionString = "mongodb://localh...
MongoDB
7,201,847
89
I'm new to mongodb and am trying to query child objects. I have a collection of States, and each State has child Cities. One of the Cities has a Name property that is null, which is causing errors in my app. How would I query the State collections to find child Cities that have a name == null?
If it is exactly null (as opposed to not set): db.states.find({"cities.name": null}) (but as javierfp points out, it also matches documents that have no cities array at all, I'm assuming that they do). If it's the case that the property is not set: db.states.find({"cities.name": {"$exists": false}}) I've tested the ...
MongoDB
4,762,947
89
I am preparing to build an Android/iOS app that will require me to make complex polygon and containment geospatial queries. I like Apache Cassandra's no single point of failure, fault tolerance and data center awareness. Cassandra does not have direct support for geospatial queries (that I am aware of) but MongoDB and ...
Aerospike just released Server Community Edition 3.7.0, which includes Geospatial Indexes as a feature. Aerospike can now store GeoJSON objects and execute various queries, allowing an application to track rapidly changing Geospatial objects or simply ask the question of “what’s near me”. Internally, we use Google’s S2...
Cassandra
24,121,192
11
I have had issues with spark-cassandra-connector (1.0.4, 1.1.0) when writing batches of 9 millions rows to a 12 nodes cassandra (2.1.2) cluster. I was writing with consistency ALL and reading with consistency ONE but the number of rows read was every time different from 9 million (8.865.753, 8.753.213 etc.). I've check...
Nicola and I communicated over email this weekend and thought I'd provide an update here with my current theory. I took a look at the github project Nicola shared and experimented with an 8 node cluster on EC2. I was able to reproduce the issue with 2.1.2, but did observe that after a period of time I could re-execute...
Cassandra
27,667,228
11
I have a table with a column of type list and I would like to check if there is an item inside the list, using CONTAINS keyword. According to scylla documentation: The CONTAINS operator may only be used on collection columns (lists, sets, and maps). In the case of maps, CONTAINS applies to the map values. The CONTAINS...
Support for CONTAINS keyword for filtering is already implemented in Scylla, but it's not part of any official release yet - it will be included in the upcoming 3.1 release (or, naturally, if you build it yourself from the newest source). Here's the reference from the official tracker: https://github.com/scylladb/scyll...
Cassandra
57,874,319
11
I want to use batch statement to delete a row from 3 tables in my database to ensure atomicity. The partition key is going to be the same in all the 3 tables. In all the examples that I read about batch statements, all the queries were for a single table? In my case, is it a good idea to use batch statements? Or, shoul...
Yes, you can use batch to ensure atomicity. Single partition batches are faster (same table and same partition key) but only for a limited number of partitions (in your case three) it is okay. But don't use it for performance optimization (Ex: reduce of multiple requests). If you need atomicity you can use it. You can ...
Cassandra
49,356,986
11
I understand in Mongo we can have one master and multiple slaves where the master will be used for writes and slaves will be used for reading operations. Say M1, M2, M3 are nodes with M1 as master But I read Cassandra is said to be a master-less model. Every node is said to be master. I did not get what it means? Say ...
You are right, the nodes in Cassandra are equal and all of them can respond to user's query. That's because Cassandra picks Availability and Partition Tolerance in the CAP Theorem (whereas MongoDB picks Consistency and Partition Tolerance). And Cassandra can have linear scalability by simply adding new nodes into the n...
Cassandra
48,434,860
11
I have a 5 node cluster of Cassandra, with ~650 GB of data on each node involving a replication factor of 3. I have recently started seeing the following error in /var/log/cassandra/system.log. INFO [ReadStage-5] 2017-10-17 17:06:07,887 NoSpamLogger.java:91 - Maximum memory usage reached (1.000GiB), cannot allocate ch...
Based on the cfhistograms output posted, the partitions are enormous. 95% percentile of raw_data table has partition size of 107MB and max of 3.44GB. 95% percentile of customer_profile_history has partition size of 1.99GB and max of 5.96GB. This clearly relates to the problem you notice every half-hour as these ...
Cassandra
46,796,021
11
I have seen this warning everywhere but cannot find any detailed explanation on this topic.
For starters The maximum number of cells (rows x columns) in a single partition is 2 billion. If you allow a partition to grow unbounded you will eventually hit this limitation. Outside that theoretical limit, there are practical limitations tied to the impacts large partitions have on the JVM and read times. Thes...
Cassandra
46,272,571
11
I'm always getting the following error.Can somebody help me please? Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/Logging at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineCla...
org.apache.spark.Logging is available in Spark version 1.5.2 or lower version. It is not in the 2.0.0. Pls change versions as follows <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-streaming_2.11</artifactId> <version>1.5.2</version> </dependency> <dependency> ...
Cassandra
40,287,289
11
I am using Spark to consume data from Kafka and save it in Cassandra. My program is written in Java. I am using the spark-streaming-kafka_2.10:1.6.2 lib to accomplish this. My code is: SparkConf sparkConf = new SparkConf().setAppName("name"); JavaStreamingContext jssc = new JavaStreamingContext(sparkConf, new Duration(...
Below is the code for reference you may need to change the things as per your requirement. What I have done with the code and approach is that maintain Kafka partition wise offset for each topic in Cassandra(This can be done in zookeeper also as a suggestion using its java api). Store or update the the latest offset ra...
Cassandra
39,167,776
11
I get bulk write request for let say some 20 keys from client. I can either write them to C* in one batch or write them individually in async way and wait on future to get them completed. Writing in batch does not seem to be a goo option as per documentation as my insertion rate will be high and if keys belong to diffe...
Your idea is right, but there is no built-in way, you usually do that manually. Main rule here is to use TokenAwarePolicy, so some coordination would happen on driver side. Then, you could group your requests by equality of partition key, that would probably be enough, depending on your workload. What I mean by 'grou...
Cassandra
38,931,909
11
I have read over several documents regarding the Cassandra commit log and, to me, there is conflicting information regarding this "structure(s)". The diagram shows that when a write occurs, Cassandra writes to the memtable and commit log. The confusing part is where this commit log resides. The diagram that I've seen o...
Generally when explaining the write path, the commit log is characterized as a file - and it's true the commit log is the on-disk storage mechanism that provides durability. The confusion is introduced when going deeper and the part about buffer cache and having to issue fsyncs is introduced. The reference to "commit...
Cassandra
38,506,734
11
After posting a question and reading this and that articles, I still do not understand the relations between those three operations- Cassandra compaction tasks nodetool repair nodetool cleanup Is repair task can be processed while compaction task is running, or cleanup while compaction task is running? Is cleanup i...
A cleanup is a compaction that just removes things outside the nodes token range(s). A repair has a "Validation Compaction" to build a merkle tree to compare with the other nodes, so part of nodetool repair will have a compaction. Is repair task can be processed while compaction task is running, or cleanup while compa...
Cassandra
37,684,547
11
I'm on my path to learning Cassandra, and the differences in CQL and SQL, but I'm noticing the absence of a way to check to see if a record exists with Cassandra. Currently, the best way that I have is to use SELECT primary_keys FROM TABLE WHERE primary_keys = blah, and checking to see if the results set is empty. I...
Using count will make it traverse all the matching rows just to be able to count them. But you only need to check one, so just limit and return whatever. Then interpret the presence of the result as true and absence - as false. E.g., SELECT primary_keys FROM TABLE WHERE primary_keys = blah LIMIT 1
Cassandra
34,455,098
11
I have a problem when i use spark streaming to read from Cassandra. https://github.com/datastax/spark-cassandra-connector/blob/master/doc/8_streaming.md#reading-from-cassandra-from-the-streamingcontext As the link above, i use val rdd = ssc.cassandraTable("streaming_test", "key_value").select("key", "value").where("fu ...
You can create a ConstantInputDStream with the CassandraRDD as input. ConstantInputDStream will provide the same RDD on each streaming interval, and by executing an action on that RDD you will trigger a materialization of the RDD lineage, leading to executing the query on Cassandra every time. Make sure that the data b...
Cassandra
32,451,614
11
I am performing a cql query on a column that stores the values as unix timestmap, but want the results to output as datetime. Is there a way to do this? i.e. something like the following: select convertToDateTime(column) from table;
I'm trying to remember if there's an easier, more direct route. But if you have a table with a UNIX timestamp and want to show it in a datetime format, you can combine the dateOf and min/maxTimeuuid functions together, like this: aploetz@cqlsh:stackoverflow2> SELECT datetime,unixtime,dateof(mintimeuuid(unixtime)) FROM...
Cassandra
31,300,682
11
I am trying to find the total physical size occupied by cassandra keyspace. I have a msg generator which dumps lot of messages to cassandra . I want to find out the total physical size of messages in cassandra Table. When I do du -h /mnt/data/keyspace linux says only 12kb. I am sure that the data size is much greater ...
What is Compaction? SStables are immutable -- once a memtable is flushed to disk, it remains unchanced until it is deleted (expired) or compacted. Compaction is the process of combining sstables together. This is important when your workload is update heavy and you may have several instances of a CQL row stored in your...
Cassandra
29,915,307
11
Is there any limit on maximum length we can specify for a column while creating Cassandra table, if yes, then how much we can specify? I am new to using Cassandra, please let me know
The maximum number of cells (rows x columns) in a single partition is 2 billion and the maximum column key (and row key) size is 64KB and the maximum column value size is 2 GB. you can refer this https://cwiki.apache.org/confluence/display/CASSANDRA2/CassandraLimitations
Cassandra
27,968,287
11
Created a table in Cassandra where the primary key is based on two columns(groupname,type). When I'm trying to insert more than 1 row where the groupname and type is same, then in such situation its not storing more than one row, subsequent writes where in the groupname and type are same.. then the latest write is repl...
All inserts to the Cassandra database are actually insert/update operations and there can only be on set of non-key values per uniquely defined primary key. This means that you can not ever have more than one set of values for one primary key and that you will only see the last write. More info: http://www.datastax.com...
Cassandra
25,817,451
11
Disclaimer: This is quite a long post. I first explain the data I am dealing with, and what I want to do with it. Then I detail three possible solutions I have considered, because I've tried to do my homework (I swear :]). I end up with a "best guess" which is a variation of the first solution. My ultimate question is:...
First, you don't need to use memcache or redis. Cassandra will give you very fast access to that information. You could certainly have a table that was something like: create table superdoc_structures { doc_id varchar; version_date timestamp; /* stuff */ primary key (doc_id, version_date) } with cluster...
Cassandra
25,449,640
11
Im a Cassandra newbie. I understand the purpose of the seed node. But are there any costs associated with a seed node? If so, what are they. Else, I wondering why just not make every node a seed node?
There are essentially no local runtime costs associated with being a seed, other than you may receive more gossip traffic than a non-seed node. However with increasing number of seeds, this local effect will be progressively less pronounced. More interesting are distributed effects. Seed nodes are favored for gossipi...
Cassandra
22,569,260
11
When importing datastax cassandra-driver(python) get the following error Error File "cassandra.py", line 1, in <module> from cassandra.cluster import Cluster File "/home/vagrant/cassandra.py", line 1, in <module> from cassandra.cluster import Cluster ImportError: No module named cluster This is the code from c...
Well, it looks like names conflict. Your script is cassandra.py and so it is the module for the driver. Try to rename your script (and don't forget to delete its .pyc) and try again
Cassandra
22,449,688
11
First of all I am relatively new to Big Data and the Hadoop world and I have just started to experiment a little with the Hortonworks Sandbox (Pig and Hive so far). I was wondering in which cases could I use the above mentioned tools of Hadoop, Hive, Pig, HBase and Cassandra? In my sandbox environment with a file of j...
Your guesses are somewhat accurate. By Hadoop, I guess you are referring to MapReduce? Hadoop as such is an ecosystem which consists of many components (including MapReduce, HDFS, Pig and Hive). MapReduce is good when you need to write the logic for processing data at the Map() and Reduce() method level. In my work, I ...
Cassandra
21,439,029
11
I run nodetool status on a Cassandra 2.0.3 instance, the output shows: Datacenter: eu-west =================== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns Host ID Rack UN xx.xxx.xxx.xxx 154.81 KB 256 33.8% bcfb1057-60d7-4d94-b...
U=Up N=Normal It's the first letter of Status followed by the first letter of State.
Cassandra
20,678,366
11
I'm currently using and researching about data modeling practices in cassandra. So far, I get that you need have a data modeling based on the queries executed. However, multiple select requirements make data modeling even harder or impossible to handle it on 1 table. So, when you can't handle these requirements on 1 ta...
The ALLOW FILTERING warning is because Cassandra is internally skipping over data, rather than using an index and seeking. This is unpredictable because you don't know how much data Cassandra is going to skip over per row returned. You could be scanning through all your data to return zero rows, in the worst case. This...
Cassandra
18,694,413
11
I need to fetch rows without specific keys. for sample: select * from users where user_id not in ("mikko"); I have tried with "not in" and this is the response: Bad Request: line 1:35 no viable alternative at input 'not'
"not in" is not a supported operation in CQL. Cassandra at its heart is still based on key indexed rows. So that query is basically the same as "select * from users", as you have to go through every row and figure out if it does not match the in. If you want to do that type of query you will want to setup a map redu...
Cassandra
18,498,445
11
I am using Cassandra 1.2.5. After creating a column family in Cassandra using cassandra-cli, is it possible to modify the primary key on the column family using either cassandra-cli or CQL? Specifically, I currently have the following table (from CQL): CREATE TABLE "table1" ( key blob, column1 blob, value blob, ...
The primary keys directly determine how and where cassandra stores the data contained in a table (column family). The primary key consists of partition key and clustering key (optional). The partition key determines which node stores the data. It is responsible for data distribution across the nodes. The additional c...
Cassandra
18,421,668
11
CQL 3 allows for a "compound" primary key using a definition like this: CREATE TABLE timeline ( user_id varchar, tweet_id uuid, author varchar, body varchar, PRIMARY KEY (user_id, tweet_id) ); With a schema like this, the partition key (storage engine row key) will consist of the user_id value, whi...
Actually, yes you can. That functionality was added in this ticket: https://issues.apache.org/jira/browse/CASSANDRA-4179 The format for you would be: CREATE TABLE timeline ( user_id varchar, tweet_id uuid, author varchar, body varchar, PRIMARY KEY ((user_id, tweet_id)) );
Cassandra
13,938,288
11
Is it possible in Cassandra to use multiple conditions union ed together after the where clause in a select statement like in any of the RDBMS. Here is my code : SELECT * from TABLE_NAME WHERE COND1= 'something' OR COND2 = 'something';
Assuming COND is the name of your table's primary key, you can do: SELECT * from TABLE_NAME WHERE COND1 in ('something', 'something'); So, there is no fully general OR operation, but it looks like this may be equivalent to what you were trying to do. Remember, as you use CQL, that query planning is not meant to be one...
Cassandra
10,139,390
11
I have the cassandra cluster of 12 nodes on EC2. Because of some failure we lost one of the node completely.I mean that machine do not exist anymore. So i have created the new EC2 instance with different ip and same token as that of the dead node and i also had the backup of data on that node so it works fine But the ...
I had the same problem and I resolved it with removenode, which does not require you to find and change the node token. First, get the node UUID: nodetool status DN 192.168.56.201 ? 256 13.1% 4fa4d101-d8d2-4de6-9ad7-a487e165c4ac r1 DN 192.168.56.202 ? 256 12.6% e11d219a-0b65-461e-babc-...
Cassandra
8,589,938
11
I want to export all data from a keyspace in a cassandra cluster and import it into another cluster, that has the same schema but the keyspace is differently named. I've looked into the sstable2json /json2sstable utility. However, I don't want to go to each node and deal with each individual sstable.
Simpler: take a snapshot on each node, then use the bulk loader to stream them into the new cluster.
Cassandra
7,650,254
11
Read-your-own-writes consistency is great improvement from the so called eventual consistency: if I change my profile picture I don't care if others see the change a minute later, but it looks weird if after a page reload I still see the old one. Can this be achieved in Cassandra without having to do a full read-check ...
Good question. We've had http://issues.apache.org/jira/browse/CASSANDRA-876 open for a while to add this, but nobody's bothered finishing it because CL.ONE is just fine for a LOT of workloads without any extra gymnastics Reads are so fast anyway that doing the extra one is not a big deal (and in fact Read Repair, whic...
Cassandra
6,865,545
11
I'm trying to use the sstableloader to load data into an existing Cassandra ring, but cant figure out how to actually get it to work. I'm trying to run it on a machine that has a running cassandra node on it, but when I run it I get an error saying that port 7000 is already in use, which is the port the running Cassan...
Played around with sstableloader, read the source code, and finally figured out how to run sstableloader on the same machine that hosts a running cassandra node. There are two key points to get this running. First you need to create a copy of the cassandra install folder for sstableloader. This is becase sstableload...
Cassandra
6,832,285
11
We are working with a Cassandra database that will store data in the petabyte range. We are thinking of using either ElasticSearch or Solandra, but we are having a fun time deciding between which to use. I'm wondering if the our database might get too large. I know ElasticSearch is scalable, but to what extent - especi...
Solandra is being used in the 10s of Terabytes range. Are you saying you want to index a PB of data in solandra or a subset? I think if you want 1 big index with a PB of data you are stretching the limits. but If you want a PB of indexes, then this will scale the same as Cassandra. How many nodes are you planning to r...
Cassandra
6,359,712
11
I'm investigating both Cassandra and MongoDB for a new project because they share some good qualities that I will need to take advantage of for this project. I've seen plenty of shallow examples for Cassandra and MongoDB - basically how to configure and start up the database, how to add new items, how to query the it...
Please look at http://www.10gen.com/video There are various postings and videos explaining MongoDB from scratch including examples. Also look at http://www.mongodb.org/display/DOCS/Schema+Design Key remarks: no JOINs use embedded documents otherwise or look at database reference denormalization is kind of common An...
Cassandra
5,465,762
11
I'm trying to build small web-system (url shortcutting) using nonsql Cassandra DB, the problem I stack is id auto generation. Did someone already stack with this problem? Thanks. P.S. UUID not works for me, I do need to use ALL numbers from 0 to Long.MAX_VALUE (java). so I do need something that exactly works like sql ...
Don't know about Cassandra, but with mongo you can have an atomic sequence (it won't scale, but will work the way it should, even in sharded environment if the query has the sharded field). It can be done by using the findandmodify command. Let's consider we have a special collection named sequences and we want to have...
Cassandra
2,771,399
11
I am in the middle of building a new app which will have very similar features to Facebook and although obviously it wont ever have to deal with the likes of 400,000,000 million users it will still be used by a substantial user base and most of them will demand it run very very quickly. I have extensive experience with...
I would suggest doing some testing with MySQL and with Cassandra. When we had to make a choice between PostgreSQL and MongoDB in one of my jobs, we compared query time on millions of records in both and found out that with about 10M records Postgres would provide us with adequate response times. We knew that we wouldn...
Cassandra
2,581,465
11
I am learning about the Apache Cassandra database [sic]. Does anyone have any good/bad experiences with deploying Cassandra to less than dedicated hardware like the offerings of Linode or Slicehost? I think Cassandra would be a great way to scale a web service easily to meet read/write/request load... just add anoth...
How much ram you needs really depends on your workload: if you are write-mostly you can get away with less, otherwise you will want ram for the read cache. You do get more ram for you money at my employer, rackspace cloud: http://www.rackspacecloud.com/cloud_hosting_products/servers/pricing. (our machines also have r...
Cassandra
2,291,442
11
I am using Spring Boot 2.4.4 and Spring Data Cassandra dependency to connect to the Cassandra database. During the application startup, I am getting a DriverTimeout error (I am using VPN). I have gone through all the Stack Overflow questions similar to this and none of them worked for me. I have cross-posted the same q...
I am answering my own question here to make this complete and let others know how I fixed this particular problem. I am using Spring Boot 2.4.5. and I started facing this timeout issue when I upgraded to version 2.3+ onwards. Based on my experience with this issue, below is what I found. Irrespective of whatever timeou...
Cassandra
67,217,692
10
How is columnar storage in the context of a NoSQL database like Cassandra different from that in Redshift. If Cassandra is also a columnar storage then why isn't it used for OLAP applications like Redshift?
The storage engines of Cassandra and Redshift are very different, and are created for different cases. Cassandra's storage not really "columnar" in wide known meaning of this type of databases, like Redshift, Vertica etc, it is much more closer to key-value family in NoSQL world. The SQL syntax used in Cassandra is not...
Cassandra
52,739,192
10
In the CQL shell, how do I list all users? I can't seem to find it anywhere on Stack Overflow.
Prior to the introduction of roles in Cassandra 2.2, authentication and authorization were based around the concept of a USER. Cassandra 2.2 onward CQL uses database roles to represent users and group of users. So to list users use below command accordingly. LIST USERS; -- cassandra version < 2.2 LIST ROLES; -- cas...
Cassandra
52,617,258
10
I started using SASI indexing and used the following setup, CREATE TABLE employee ( id int, lastname text, firstname text, dateofbirth date, PRIMARY KEY (id, lastname, firstname) ) WITH CLUSTERING ORDER BY (lastname ASC, firstname ASC)); CREATE CUSTOM INDEX employee_firstname_idx ON employee (first...
1) Could somebody explain how it differs from normal secondary index in Cassandra? Normal secondary index is essentially another lookup table comprising secondary index columns & primary key. Hence it has its own set of sstable files (disk), memtable (memory) and write overhead (cpu). SASI was an improvement open sour...
Cassandra
48,734,670
10
I'm trying to find a way to log all queries done on a Cassandra from a python code. Specifically logging as they're done executing using a BatchStatement Are there any hooks or callbacks I can use to log this?
2 options: Stick to session.add_request_init_listener From the source code: a) BoundStatement https://github.com/datastax/python-driver/blob/3.11.0/cassandra/query.py#L560 The passed values are stored in raw_values, you can try to extract it b) BatchStatement https://github.com/datastax/python-driver/blob/3.11.0/cassa...
Cassandra
46,773,522
10
I am using the following filters in Postman to make a POST request in a Web API but I am unable to make a simple POST request in Python with the requests library. First, I am sending a POST request to this URL (http://10.61.202.98:8081/T/a/api/rows/cat/ect/tickets) with the following filters in Postman applied to the ...
Your Postman request is a JSON body. Just reproduce that same body in Python. Your Python code is not sending JSON, nor is it sending the same data as your Postman sample. For starters, sending a dictionary via the data arguments encodes that dictionary to application/x-www-form-urlencoded form, not JSON. Secondly, you...
Cassandra
45,201,628
10
I understand that text and varchar are aliases, which store UTF-8 strings. What about ASCII, which in the documentation says "US-ASCII character string"? What's the difference besides encoding? Is there any size difference? Is the a preferred choice between these two when I'm storing large strings (~500KB)?
Regarding this anwer: If the data is a piece of text, for example a String in Java, which is encoded in UTF-16 in the runtime, but when serialized in Cassandra with text type then UTF-8 is used. UTF-16 always use 2 bytes per character and sometime 4 bytes, but UTF-8 is space efficient and depending on the character ca...
Cassandra
45,017,699
10
Is there an "IF EXISTS UPDATE ELSE INSERT" command in CQL (Cassandra)? If not, what's the most efficient way to perform such a query?
Basically you should use update. In cassandra they have a bit different mechanics when compared to relational world and will work as implied inserts. Answer: Does an UPDATE become an implied INSERT
Cassandra
43,395,738
10
I use Cassandra java driver. I receive 150k requests per second, which I insert to 8 tables having different partition keys. My question is which is a better way: batch inserting to these tables inserting one by one. I am asking this question because , considering my request size (150k), batch sounds like the bett...
Please check my answer from below link: Cassandra batch query performance on tables having different partition keys Batches are not for improving performance. They are used for ensuring atomicity and isolation. Batching can be effective for single partition write operations. But batches are often mistakenly used in ...
Cassandra
42,930,498
10
In "Cassandra The Definitive Guide" (2nd edition) by Jeff Carpenter & Eben Hewitt, the following formula is used to calculate the size of a table on disk (apologies for the blurred part): ck: primary key columns cs: static columns cr: regular columns cc: clustering columns Nr: number of rows Nv: it's used for counti...
It's because of Cassandra's version < 3 internal structure. There is only one entry for each distinct partition key value. For each distinct partition key value there is only one entry for static column There is an empty entry for the clustering key For each column in a row there is a single entry for each cluster...
Cassandra
42,736,040
10
I was trying out a simple connection to my Cassandra instance through Java. I made a 'demo' keyspace to cqlsh and created a table in the java program. The code is below: Jars Used: slf4j.api-1.6.1 cassandra-all-2.1.2 public class CassandraConnection { public static void main(String[] args){ String ipAddr...
You have to make sure that the logback JAR is within your classpath. See here for starters; and beyond that; the real take-away here: the runtime is telling you that it can't find a certain class; and it gives you the full name of that class. Or you look here to read what Cassandra has to say about logback. You take th...
Cassandra
42,205,247
10
The exact Exception is as follows com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [varchar <-> java.math.BigDecimal] These are the versions of Software I am using Spark 1.5 Datastax-cassandra 3.2.1 CDH 5.5.1 The code I am trying to execute is a Spark program u...
When you call bind(params...) on a PreparedStatement the driver expects you to provide values w/ java types that map to the cql types. This error ([timestamp <-> java.lang.String]) is telling you that there is no such Codec registered that maps the java String to a cql timestamp. In the java driver, the timestamp typ...
Cassandra
37,588,733
10
I'm testing Cassandra as time series database. I create data model as below: CREATE KEYSPACE sm WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': 1 }; USE sm; CREATE TABLE newdata (timestamp timestamp, deviceid int, tagid int, decvalue decimal, alphavalue text, PRIMARY KEY (deviceid,ta...
I’m new to Cassandra and a bit confused about the partition key and clustering key. It sounds like you understand partition keys, so I'll just add that your partition key helps Cassandra figure out where (which token range) in the cluster to store your data. Each node is responsible for several primary token ranges ...
Cassandra
36,048,660
10
As stated in title I'm wondering if is it necessary to spark-submit *.jar? I'm using Datastax Enterprise Cassandra for a while, but now I need to use Spark too. I watched almost all videos from DS320: DataStax Enterprise Analytics with Apache Spark and there is nothing about connecting to spark remotely from java appli...
I would greatly recommend using dse spark-submit with dse. While it is not required it is definitely much easier than ensuring that your security and class path options as set up for DSE will work with your cluster. It also provides a much simpler approach (in my opinion) for configuring your SparkConf and placing jars...
Cassandra
34,876,451
10
I'm trying to use the spark-cassandra-connector via spark-shell on dataproc, however I am unable to connect to my cluster. It appears that there is a version mismatch since the classpath is including a much older guava version from somewhere else, even when I specify the proper version on startup. I suspect this is lik...
Unfortunately, Hadoop's dependency on Guava 11 (which doesn't have the Futures.withFallback method mentioned) is a longstanding issue and indeed Hadoop 2.7.1 still depends on Guava 11. Spark core uses Guava 14, as can be seen here but this is worked around by shading Guava inside the Spark assembly: $ jar tf /usr/lib/s...
Cassandra
34,209,329
10
I have a 4 node cluster with 16 core CPU and 100 GB RAM on each box (2 nodes on each rack). As of now, all are running with default JVM settings of Cassandra (v2.1.4). With this setting, each node uses 13GB RAM and 30% CPU. It is a write heavy cluster with occasional deletes or updates. Do I need to tune the JVM sett...
Do I need to tune the JVM settings of Cassandra to utilize more memory? The DataStax Tuning Java Resources doc actually has some pretty sound advice on this: Many users new to Cassandra are tempted to turn up Java heap size too high, which consumes the majority of the underlying system's RAM. In most cases, incr...
Cassandra
30,207,779
10
Is there a way I could control max size of a SSTable, for example 100 MB so that when there is actually more than 100MB of data for a CF, then Cassandra creates next SSTable?
Unfortunately the answer is not so simple, the sizes of your SSTables will be influenced by your compaction Strategy and there is no direct way to control your max sstable size. SSTables are initially created when memtables are flushed to disk as SSTables. The size of these tables initially depends on your memtable se...
Cassandra
29,392,153
10
There doesn't seem to be any direct way to know affected rows in cassandra for update, and delete statements. For example if I have a query like this: DELETE FROM xyztable WHERE PKEY IN (1,2,3,4,5,6); Now, of course, since I've passed 6 keys, it is obvious that 6 rows will be affected. But, like in RDBMS world, is th...
In the eventually consistent world you can look at these operations as if it was saving a delete request, and depending on the requested consistency level, waiting for a confirmation from several nodes that this request has been accepted. Then the request is delivered to the other nodes asynchronously. Since there is ...
Cassandra
28,611,459
10
My understanding that rows are overwritten when another row with identical primary keys is inserted. For example: I have columns (user_id int, item_id int, site_id int), and my PRIMARY KEY(user_id, item_id) If I had the following table: user_id, item_id, site_id 2 3 4 and I insert user_id : 2, item_id ...
Yes, this is how Cassandra is designed to operate. In all cases where an UPDATE or INSERT is executed, data will be updated (based on the keys) if it exists, and inserted it it does not. An important point to remember, is that under the hood, UPDATE and INSERT are synonymous. If you think about those two as being th...
Cassandra
28,350,630
10
I'm trying to get the number of key value pairs in a Cassandra column family. Following is the code I used. PreparedStatement statement = client.session .prepare("select count(*) from corpus.word_usage"); ResultSet results = client.session.execute(statement.bind()); Row row = results.one(); System.out.pr...
You can get value as a long, instead. I couldn't test it but could you try this: PreparedStatement statement = client.session.prepare("select count(*) from corpus.word_usage"); ResultSet results = client.session.execute(statement.bind()); Row row = results.one(); long expected = row.getLong("count");
Cassandra
27,421,535
10
I was wondering if it was a good idea (performance wise) to have multiple counters on the same table/columnfamily in Cassandra? My current setup is this: CREATE TABLE IF NOT EXISTS contentCounters ( downvotes counter, comments counter, upvotes counter, contentid uuid, PRIMARY KEY (contentid) ); But I'm not sure whethe...
I don't think this should be an issue. Cassandra doesn't update "rows" in their entirety. The "row" itself isn't locked during updates, but based on this article for 2.1+, just the counter column in the UPDATE statement identified by the specified partition key. There is a better counter implementation in 2.1+ than in ...
Cassandra
25,146,373
10
I am wondering what is the advantage of using BoundStatement over PreparedStatement? PreparedStatement statement = session.prepare( "INSERT INTO simplex.songs " + "(id, title, album, artist) " + "VALUES (?, ?, ?, ?);"); BoundStatement boundStatement = n...
No advantage: a BoundStatement is nothing more than a PreparedStatement with variables bounded. The bind() method of a PreparedStatements, in fact, returns a BoundStatement.
Cassandra
25,130,236
10
So, my original problem was using the token() function to page through a large data set in Cassandra 1.2.9, as explained and answered here: Paging large resultsets in Cassandra with CQL3 with varchar keys The accepted answer got the select working with tokens and chunk size, but another problem manifested itself. My ta...
Ok, so I used the info in this post to work out a solution: http://www.datastax.com/dev/blog/cql3-table-support-in-hadoop-pig-and-hive (section "CQL3 pagination"). First, I execute this cql: select * from ip limit 5000; From the last row in the resultset, I get the key (i.e. '85.166.4.140') and the value from column1 ...
Cassandra
23,625,481
10
I am new to Datastax cassandra. While going through the installation procedure of cassandra. It is recommended that the swap area of OS should be turned off. Does anyone provide the reason for that? Will it affect any OS level operations ?
In production, if your database is using swap you will have very bad performance. In a ring of Cassandra nodes, you are better off having one node go completely down than allowing it to limp along in swap. The easiest way to ensure that you never go into swap is to simply disable it.
Cassandra
22,988,824
10
We're looking to be able to do something like.. select * from User where rewards.size > 0 when the schema is create table user ( id uuid primary key, network_id uuid, rewards set<uuid>, name text );
sadly Cassandra is eager performing very quick reads and on the other hand is not perfectly done supporting collections: Get count of elements in Set type column in Cassandra unfortunately the Collections-support even in CQL Driver v2 is not perfect: you may add or delete items in upsert statements. But more on th...
Cassandra
20,555,428
10
How can I check if a non-primary key field's value is either 'A' or 'B' with a Cassandra CQL query? (I'm using Cassandra 2.0.1) Here's the table definition: CREATE TABLE my_table ( my_field text, my_field2 text, PRIMARY KEY (my_field) ); I tried: 1> SELECT * FROM my_table WHERE my_field2 IN ('A', 'B'); 2> SELEC...
This is the intentional functionality of cassandra. You cannot query using a WHERE clause on columns that are not the partition key part of a composite key This is because your data is partitioned around a ring of cassandra nodes. You want to avoid having to ask the entire ring to return the answer to your query. ...
Cassandra
19,231,778
10
How do you query and filter by timeuuid, ie assuming you have a table with create table mystuff(uuid timeuuid primary key, stuff text); ie how do you do: select uuid, unixTimestampOf(uuid), stuff from mystuff order by uuid desc limit 2000 I also want to be able to fetch the next older 2000 and so on, but thats a diff...
I would recommend that you design your table a bit differently. It would be rather hard to achieve what you're asking for with the design you have currently. At the moment each of your entries in the audit_event table will receive another uuid, internally Cassandra will create many short rows. Querying for such rows is...
Cassandra
18,274,007
10
I have a little misunderstanding about composite row keys with CQL in Cassandra. Let's say I have the following cqlsh:testcql> CREATE TABLE Note ( ... key int, ... user text, ... name text ... , PRIMARY KEY (key, user) ... ); cqlsh:testcql> INSERT INTO Note (key, u...
So, after diging a bit more and reading an article suggested by Lyuben Todorov (thank you) I found the answer to my question. Cassandra stores data in data structures called rows which is totally different than relational databases. Rows have a unique key. Now, what's happening in my example... In table Note I have a ...
Cassandra
17,705,328
10
How can I pull in a range of Composite columns with CQL3? Consider the following: CREATE TABLE Stuff ( a int, b text, c text, d text, PRIMARY KEY (a,b,c) ); In Cassandra what this effectively does is creates a ColumnFamily with integer rows (values of a) and with CompositeColumns composed of the va...
Auto paging is done https://issues.apache.org/jira/browse/CASSANDRA-4415, it's release to Cassandra 2.0.1
Cassandra
17,664,438
10
I am newbie to cassandra . I need to copy data from one columnFamily to another columnFamily in same keyspace in cassandra .Say for ex we have a A1 columnFamily in keyspace K1 , so now i need to create columnFamily A2 in the same keyspace K1 .Here i need to copy data from columnFamily A1 to A2 .A1 and A2 have the same ...
Depending on the cassandra version you can use the copy cql command. To use that you need a cql client like the one that is distributted with cassandra. First you have to copy the columnfamily A1 to a CSV file using: COPY K1.A1 (column1, column2,...) TO 'temp.csv'; And after that copy the file to the new column family...
Cassandra
17,542,239
10
Prior to CQL3 one could insert arbitrary columns such as columns that are named by a date: cqlsh:test>CREATE TABLE seen_ships (day text PRIMARY KEY) WITH comparator=timestamp AND default_validation=text; cqlsh:test>INSERT INTO seen_ships (day, '2013-02-02 00:08:22') VALUES ('Tuesday', 'S...
There's a good blog post over on the Datastax blog about this: http://www.datastax.com/dev/blog/does-cql-support-dynamic-columns-wide-rows The answer is that yes, CQL3 supports dynamic colums, just not the way it worked in earlier versions of CQL. I don't really understand your example, you mix datestamps with strings ...
Cassandra
17,439,179
10
I am using Cassandra 1.2.3 and can execute select query with Limit 10. If I want records from 10 to 20, I cannot do "Limit 10,20". Below query gives me an error. select * from page_view_counts limit 10,20 How can this be achieved? Thanks Nikhil
You can't do skips like this in CQL. You have have to do paging by specifying a start place e.g. select * from page_view_counts where field >= 'x' limit 10; to get the next 10 elements starting from x. I wrote a full example in this answer: Cassandra pagination: How to use get_slice to query a Cassandra 1.2 database ...
Cassandra
17,025,490
10
I want to add columns dynamically to this column family via code using cql. CREATE COLUMN FAMILY blog_entry WITH comparator = UTF8Type AND key_validation_class=UTF8Type AND default_validation_class = UTF8Type; how shall I do it?
This is becoming something of a FAQ, so I wrote an in-depth explanation: http://www.datastax.com/dev/blog/does-cql-support-dynamic-columns-wide-rows
Cassandra
16,938,285
10
IMPORTANT If you are dealing with this problem today, use the new cassandra-driver from datastax (i.e. import cassandra) since it solves most of this common problems and don't use the old cql driver anymore, it is obsolete! This question is old from before the new driver was even in development and we had to use an inc...
I can tell you how to do it in cqlsh. Try this update test set last_sent =1368438171000 where id = 'someid' Equivalent long value for date time 2013-05-13 15:12:51 is 1368438171000
Cassandra
16,532,566
10
I am using following version of cql and cassandra. See below: cqlsh 2.3.0 | Cassandra 1.1.10 | CQL spec 3.0.0 | Thrift protocol 19.33.0 I have all CF and tons of data in it. When I run: cqlsh -2 or cqlsh -3 cql> USE "test_keyspace"; cql:test_keyspace> SELECT * FROM "column_family_name" LIMIT 1; Note: CFs were ...
by default CQL3 is case-insensitive unless enclosed in double quotation marks. Try putting your CFNAME in double quotes. SELECT * FROM "CFNAME" LIMIT 1; Looks like you have forgotten to enable CQL3 from api at the time of table creation
Cassandra
16,153,280
10
As titled. I want to know whether my query is well optimized.
Yes, in Cassandra 1.2 you can turn on request tracing for queries.
Cassandra
15,716,107
10
I am using Cassandra 1.2.2. I am finding it so easy to use Jackson to map my objects to and fro json and java for storing in database. I am actually tempted to do this to all of my data. My question is, Is this a good idea? What are the disadvantages of doing this to my application. My first guess is probably more proc...
One disadvantage is that to modify the data you have to read in the original, deserialize, make your change, serialize and write out the whole object. In Cassandra, writes are much more efficient than reads so it is beneficial to avoid reads before writes if possible. The alternative is to use separate columns for each...
Cassandra
15,500,898
10
Initially I started learning Cassandra because dynamic columns caught my attention. As I started learning more, I learnt that composite primary keys are preferred to dynamic columns and Cassandra is moving to schema based (Schema is optional and not compulsory but recommended). In cql3, it is compulsory though and I re...
Sorry for the confusion here. As it turned out , I didn't understand the basic concepts properly. Here is the answer Dynamic columns are core of Cassandra. They are still supported and is still the core :) Its just that in thrift you do directly and in CQL you do in a different manner(through schema way). But still you...
Cassandra
15,404,280
10
I am using Cassandra to store my data and hive to process my data. I have 5 machines on which i have set up cassandra and 2 machines I use as analytics node(where hive runs) So I want to ask is does hive do map reduce on just two machines(analytics nodes) and brings data there or it moves the process/computation to 5 c...
If you interested to marry Hadoop and Cassandra - the first link should DataStax company which is built around this concept. http://www.datastax.com/ They built and support hadoop with HDFS replaced with cassandra. In best of my understanding - they do have data locality:http://blog.octo.com/en/introduction-to-datastax...
Cassandra
14,827,693
10
So there is a fair amount of documentation on how to scale up a Cassandra, but is there a good resource on how to "unscale" Cassandra and remove nodes from the cluster? Is it as simple as turning off a node, letting the cluster sync up again, and repeating? The reason is for a site that expects high spikes of traffic, ...
If you just shut the nodes down and rebalance cluster, you risk losing some data, that exist only on removed nodes and hasn't replicated yet. Safe cluster shrink can be easily done with nodetool. At first, run: nodetool drain ... on the node removed, to stop accepting writes and flush memtables, then: nodetool decomm...
Cassandra
13,300,709
10
I'm having troubles understanding the replication factor in Cassandra. In the documentation it says that: "The total number of replicas across the cluster is often referred to as the replication factor". On the other hand, in the same documentation, it says that "NetworkTopologyStrategy allows you to specify how many r...
When using the NetworkTopologyStrategy, you specify your replication factor on a per-data-center basis using strategy_options:{data-center-name}={rep-factor-value} rather than the global strategy_options:replication_factor={rep-factor-value}. Here's a concrete example adapted from http://www.datastax.com/docs/1.0/refer...
Cassandra
12,544,844
10
I have a database in postgresql for a software as service with hundreds of customers, currently have a schema of postgresql for each customer, but i like a best solution because the customers rapidly increase. I read about cassandra but i don't wanna lose the integrity of primary,foregin keys and checks. Also read abou...
There are four levels at which you can separate your customers: Run a separate PostgreSQL cluster for each customer. This provides maximum separation; each client is on a separate port with its own set of system tables, transaction log, etc. Put each customer in a separate database in the same cluster. This way they...
Cassandra
10,400,654
10
I have a 3 node Cassandra cluster with replication factor of 2. Because one of the nodes has been replaced with a new one. And I have used "nodetool repair" to repair all the keyspaces. But don't know how to verify that all the keyspaces are synced. Before, Just found this article would help, but a little. Cassandra Da...
First, if you run nodetool repair again and very little data is transferred (assuming all nodes have been up since the last time you ran), you know that the data is almost perfectly in sync. You can look at the logs to see numbers on how much data is transferred during this process. Second, you can verify that all of t...
Cassandra
9,885,281
10
From Cassandra's presentation slides (slide 2) link 1, alternate link: scaling writes to a relational database is virtually impossible I cannot understand this statement. Because when I shard my database, I am scaling writes isn't it? And they seem to claim against that.. does anyone know why isn't sharding a databas...
The slowness of physical disk subsystems is usually the single greatest challenge to overcome when trying to scale a database to service a very large number of concurrent writers. But it is not "virtually impossible" to optimize writes to a relational database. It can be done. Yet there is a trade-off: when you optimiz...
Cassandra
6,668,360
10
How does a Cassandra Secondary-Index work internally? The docs state it is some kind of Hash Index: Given i have the colum username="foobar" (Column username will be scondary index) in a CF User with RandomOrderingPartitioner Is my asumption correct, that cassandra uses a "Distributed Hash Index" (=so the index is not...
Secondary indexes are basically just another column family. They are not directly accessible to users, but you can see statistics via the JMX bean: org.apache.cassandra.db.IndexedColumnFamilies You can consult the statistics here to gauge the effectiveness of your index as you would a normal column family. For more det...
Cassandra
6,418,181
10
I cannot retrieve data from Cassandra after I exit the cli. When I go back to get the data in another session, I get this error: org.apache.cassandra.db.marshal.MarshalException: cannot parse 'jsmith' as hex bytes It seems the column family stays and the keyspace too. I also changed the keys format to ascii (assume Use...
All of the "assume" commands are temporary and limited to a single cli session. For those not sitting in front of the cli right now, we're referring to these: assume <cf> comparator as <type>; assume <cf> sub_comparator as <type>; assume <cf> validator as <type>; assume <cf> keys as <type>; Assume one of the attribute...
Cassandra
6,208,104
10
I created a new Pylons project, and would like to use Cassandra as my database server. I plan on using Pycassa to be able to use cassandra 0.7beta. Unfortunately, I don't know where to instantiate the connection to make it available in my application. The goal would be to : Create a pool when the application is launc...
Well. I worked a little more. In fact, using a connection manager was probably not a good idea as this should be the template context. Additionally, opening a connection for each thread is not really a big deal. Opening a connection per request would be. I ended up with just pycassa.connect_thread_local() in app_global...
Cassandra
3,671,535
10
I'd like to use Cassandra to store a counter. For example how many times a given page has been viewed. The counter will never decrement. The value of the counter does not need to be exact but it should be accurate over time. My first thought was to store the value as a column and just read the current count, increment ...
Counters have been added to Cassandra 0.8 Use the incr method increment the value of a column by 1. [default@app] incr counterCF [ascii('a')][ascii('x')]; Value incremented. [default@app] incr counterCF [ascii('a')][ascii('x')]; Value incremented. Describe here: http://www.jointhegrid.com/highperfcassandra/?p=79 Or it...
Cassandra
3,558,844
10
Heh, I'm using cf.insert(uuid.uuid1().bytes_le, {'column1': 'val1'}) (pycassa) to create a TimeUUID for Cassandra, but getting the error InvalidRequestException: InvalidRequestException(why='UUIDs must be exactly 16 bytes') It doesn't work with uuid.uuid1() uuid.uuid1().bytes str(uuid.uuid1()) either. What's ...
Looks like you are using the uuid as the row key and not the column name. The 'compare_with: TimeUUIDType' attribute specifies that the column names will be compared with using the TimeUUIDType, i.e it tells Cassandra how to sort the columns for slicing operations Have you considered using any of the high level python...
Cassandra
3,240,267
10
I'm fairly new to Apache Cassandra and nosql in general. In SQL I can do aggregate operations like: SELECT country, sum(age) / count(*) AS averageAge FROM people GROUP BY country; This is nice because it is calculated within the DB, rather than having to move every row in the 'people' table into the client layer ...
Cassandra is primarily a mechanism that supports fast writes and look-ups. There is no support for calculations like aggregates in SQL since it is not designed for that. I would suggest reading of popular Cassandra use-cases to get a better insight :) I have bookmarked some articles on my delicious page. Here is the li...
Cassandra
3,052,952
10
If I delete every keys in a ColumnFamily in a Cassandra db using remove(key), then if I use get_range_slices, rows are still there but without columns. How could I remove entire rows?
Why do deleted keys show up during range scans? Because get_range_slice says, "apply this predicate to the range of rows given," meaning, if the predicate result is empty, we have to include an empty result for that row key. It is perfectly valid to perform such a query returning empty column lists for some or all key...
Cassandra
2,981,483
10
I keep reeding those articles from different sources that big sites are switching from memcache to cassandra. Coming from a mySQL background, I'll get a slight headache trying to see the pros/cons when compared to each other. Can you help me out to learn more about this?
It would be silly to replace memcached as a cache with Cassandra in most situations. What companies like Digg are doing is, replacing the database+memcached pair with Cassandra: Cassandra provides both durable storage, and an integrated, high performance cache (the "row cache"). This prevents problems like memcached b...
Cassandra
2,864,970
10
Is there a stable Cassandra library for Erlang? I can't seem to find one
I faced the same issue. After benchmarking most of all Cassandra drivers available I've decided to start a new driver Erlcass based on datastax cpp driver. The datastax cpp driver has incredible performances and it's fully async. From my tests on a cluster where other erlang drivers couldn't reach more than 10k reads/...
Cassandra
2,697,101
10