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
I am doing a research regarding migrating from MySQL to MariaDB and viceversa. As it seems, the first part should be easy and not complicated as stated here: MariaDB versus MySQL - Compatibility It is the "viceversa" part that botters me: MariaDB -> MySQL. I just could not find anything useful about this topic. Can any...
If there is someone who should ever take care of migrating from MariaDB to MySQL, it would be Oracle. As Oracle pretends MariaDB does not exist (company politics-policies) , it also does not provide the possibility to migrate (which does not bother me personally, because being on MariaDB team I'd prefer people to chose...
MariaDB
8,224,145
11
After do a images rm, volumes rm and docker prune i got this error starting mariaDB on with docker-compose This is the db compose part (yml): mariaDB: image: 'mariadb:latest' environment: - MYSQL_ROOT_PASSWORD=root_password The error log: mariaDB_1 | 2022-05-27 20:14:42+00:00 [...
Same problem here with latest docker container of MariaDB and the latest tag. Pinning to 10.8.2 (mariadb:10.8.2) in docker-compose fixes this issue.db: This is my new image line and with 10.8.2 it keeps working. In the mariadb issue tracker is already a discussion going so they are working on this. image: mariadb:10.8....
MariaDB
72,410,663
10
I'm learning SQLAlchemy right now, but I've encountered an error that puzzles me. Yes, there are similar questions here on SO already, but none of them seem to be solved. My goal is to use the ORM mode to query the database. So I create a model: from sqlalchemy import Column, Integer, String, create_engine from sqlalch...
session.execute(select(User)) will return a list of Row instances (tuples), which you need to unpack: for row in session.execute(select(Object)): # print(row[0].name) # or print(row["Object"].name) But I would use the .query which returns instances of Object directly: for row in session.query(Object): pr...
MariaDB
67,623,570
10
Environment: centos7 + mariadb5.5.64. Let me show the installation info on screen when to run mysql_secure_installation. # mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to ...
These scripts wait to receive optional output (timeout -1 means "no timeout") and they can tell apart different responses, as it is required by yum install and mysql_secure_installation. With #!/bin/expect -f as shebang, the scripts can be executed, when they were set to chmod +x. A) To begin with, mariadb_yum.exp (re...
MariaDB
60,097,125
10
I've created a docker container containing an instance of mariadb, but i cannot access to the database from my phisical machine: I've got the ip address from docker inspect and the port from docker ps but Sequel Pro gave me the connection failed message (same thing with Visual Studio Code). Obviously from inside the d...
It's worked for me: Create a new mariadb container docker container run \ --name sql-maria \ -e MYSQL_ROOT_PASSWORD=12345 \ -e MYSQL_USER=username \ -e MYSQL_PASSWORD=12345 \ -e MYSQL_DATABASE=dbname \ -p 3306:3306 \ -d mariadb:10 Watch the logs and wait for m...
MariaDB
59,591,620
10
I'm using Spring data jpa and mariadb latest version, and MariaDB 10.3.16 +--- org.springframework.boot:spring-boot-starter-data-jpa -> 2.1.5.RELEASE ... | +--- org.springframework.boot:spring-boot-starter-jdbc:2.1.5.RELEASE ... | +--- org.hibernate:hibernate-core:5.3.10.Final This is my Entity: @Entity @Data @T...
JPA 2.2 offers support for mapping Java 8 Date/Time API, but only for the following types: java.time.LocalDate java.time.LocalTime java.time.LocalDateTime java.time.OffsetTime java.time.OffsetDateTime However, Hibernate supports also ZonedDateTime, like this. When saving the ZonedDateTime, the following Timestamp is ...
MariaDB
56,647,962
10
We are saving information in a json Column which contain json data in an array. Data structure: [ { "type":"automated_backfill", "title":"Walgreens Sales Ad", "keyword":"Walgreens Sales Ad", "score":4 }, { "type":"automated_backfill", "title":"Nicoderm Coupons...
I understand that you are trying to generate a table structure from the content of your JSON array. You would need to proceed in two steps : first, turn each element in the array into a record ; for this, you can generate an inline table of of numbers and use JSON_EXTRACT() to pull up the relevant JSON object. then, e...
MariaDB
54,617,165
10
I have not used MySQL in a few years and when I created a new table it did something I was not expecting. I am using MariaDB v5.5.60-MariaDB I need to create a table that has both a created column and an updated column. I need the created column to only be set to CURRENT_TIMESTAMP when the row is created and then never...
A table might have automatic initialization of date in only one column in old versions of MySQL. But its behavior fixed in version 5.6.5. It means you have several ways to avoid this error: 1.You can upgrade your MySQL to the latest version; Advantages: native clear implementation of modification dates management in ...
MariaDB
54,350,419
10
I have installed WAMPServer 3.1.7 in my server and working fine. But due to environment restriction I have to remove the database from it. I have both mysql and mariadb installed in server. How can I remove these databases from WAMPServer?
You can deactivate both MySQL and/or mariaDB in WAMPServer if you want to. You simply use the wampmanager icon in the system tray. Start WAMPServer, then RIGHT CLICK the wampmanager -> Wamp Settings You should see something like the below image. NOTE In the image I have already deactivated mariaDB Where you see All...
MariaDB
54,192,715
10
I'm trying to move from from using VirtualBox as my development environment to docker. With VirtualBox, I mainly install PHP-FPM, Nginx and Mariadb but in Docker, I can't replicate the same stack despite trying for some days. Out of all the LEMP/LAMP stack docker guides, only this one chentex/docker-nginx-centos work...
Docker containers are designed to have a single service running within them, not be an entire virtual system (as you might see with virtual box and virtual machines). This means ideally you want a single container for each: Nginx PHP Mariadb Additionally the Centos docker image is designed as a base for others to inh...
MariaDB
52,540,785
10
I installed MariaDB 10.2.10 on CentOS 7 but it stopped running. If I do: If I do: systemctl restart mariadb.service I get: mariadb.service: main process exited, code=killed, status=6/ABRT Failed to start MariaDB 10.2.12 database server. Unit mariadb.service entered failed state. What's weird is that it was running fi...
You can try to force recovery through mysql which should solve the problem if you have no hardware problems on disc. [Note] InnoDB: It is also possible that your operating system has corrupted its own file cache and rebooting your computer removes the error. If the corrupt page is an index page. You can also try t...
MariaDB
50,003,447
10
I am trying to deploy a mariadb image on openshift origin. I am using mariadb:10.2.12 in my docker file. It works ok on local but I get following error when I try to deploy on openshift origin. Initializing database chown: changing ownership of '/var/lib/mysql/': Operation not permitted Cannot change ownership of...
The MariaDB images on DockerHub don't follow good practice of not requiring to be run as root user. You should instead use the MariaDB images provided by OpenShift. Eg: centos/mariadb-102-centos7 See: https://github.com/sclorg/mariadb-container There should be an ability to select MariaDB from the service catalog br...
MariaDB
48,306,277
10
I have XAMPP installed on Windows, and MySQL setup. I was wondering how I could query my database from C#. I can already connect using MySql.Data.MySqlClient.MySqlConnection. I am looking for a string in the database, and if it is there, popup a messagebox saying Found!. How would I do this?
Here is a sample code to make application connect to your Database string m_strMySQLConnectionString; m_strMySQLConnectionString = "server=localhost;userid=root;database=dbname"; Function to get String value from DB private string GetValueFromDBUsing(string strQuery) { string strData = ""; try ...
MariaDB
44,719,432
10
I have a table that contains a list of records. Each iteration, a random set of these must be picked, starting from a specific offset. Each row has a chance to be picked (so e.g. new or not often picked rows are picked more). However, something doesn't work, causing rows to be returned that do not satisfy a condition u...
I think the problem is that HAVING is applied after GROUP BY, but still before the SELECT phase. I realise it's confusing because the HAVING clause references a column from the SELECT statement, but I think it basically just executes whatever is in the SELECT statement twice - once for the having, and then again for th...
MariaDB
44,496,024
10
I have installed MariaDB on Ubuntu LTS 16.04. Then I have run /usr/bin/mysql_secure_installation and set a root password. Accessing the DB via mysql -u root -p works fine. But checking the status with service mysql status opens a log file with this warning: [Warning] 'user' entry 'root@localhost' has both a password a...
It is normal, if by saying "accessing the DB via mysql -u root -p works fine" you mean that you are running it while being a system root (or under sudo). You should not be able to do it as an ordinary user. Packages generated by Ubuntu by default have unix_socket authentication for the local root. To check, run SELECT...
MariaDB
43,439,111
10
Not quite sure how to ask this question so if someone wants to edit to better articulate please. However I want to join on a user table however the row has two FKs from the user table item_tbl id | ownerId | lastModifiedById | itemName ------------------------------------------ 1 | 1 | 2 | "Blog P...
SELECT user_tbl.username Owner, a.username Modifier, item_tbl.itemName FROM item_tbl JOIN user_tbl ON item_tbl.ownerId = user_tbl.id JOIN user_tbl a ON item_tbl.lastModifiedById = a.id; worked for those curious as hinted at by Drew in comments
MariaDB
32,622,252
10
I already use mariadb as a mysql server. However, I'm not sure using a node package designed for mysql is a good idea to use for mariadb. There are actually two node packages: For mscdex/node-mariasql For mysqljs/mysql I currently use mysql, since it seems pretty mature and maintained. It also seems to work well with...
No, it doesn't matter which you use. MariaDB is backwards compatible with MySQL. You could even connect to MySQL with node-mariasql if you wanted.
MariaDB
23,226,334
10
A few days ago I read about wide-column stored type of NoSQL and exclusively Apache-Cassandra. What I understand is that Cassandra consist of: A keyspace(like database in relational databases) and supporting many column families or tables (Same as table in relational databases) and unlimited rows. From Stackoverflow t...
We have to look at more complex example to see the differences :) For start: column family term was used in older Thrift API in newer CQL API, the term table is used Table is defined as "two-dimensional view of a multi-dimensional column family". The term "wide-rows" was related mainly to the Thrift API. In cql it...
Cassandra
36,210,321
24
How does one create the first user in a cassandra database? I tried: CREATE USER username WITH PASSWORD ""; and its says: Bad Request: Only superusers are allowed to perform CREATE USER queries But I have never created a user before this attempt, so how do you create the first user in a cassandra database? This seems...
Once you have enabled Authentication and Authorization, you can log-in (to your local Cassandra instance) as the default Cassandra admin user like this: ./cqlsh localhost -u cassandra -p cassandra If you are running Cassandra on a Windows Server, I believe you need to invoke it with Python: python cqlsh localhost -u c...
Cassandra
22,213,786
24
I would like to create keyspaces and column-families at the start of my Cassandra container. I tried the following in a docker-compose.yml file: # shortened for clarity cassandra: hostname: my-cassandra image: my/cassandra:latest command: "cqlsh -f init-database.cql" The image my/cassandra:latest contains ...
I was also searching for the solution to this question, and here is the way how I accomplished it. Here the second instance of Cassandra has a volume with the schema.cql and runs CQLSH command My Version with healthcheck so we can get rid of sleep command version: '2.2' services: cassandra: image: cassandra:3...
Cassandra
40,443,617
23
I'm having a weir error trying to read data from a Cassandra table. I have a single-node installation, with the default setup. This is the query I'm making: SELECT component_id, reading_1, reading_2, reading_3, date FROM component_readings WHERE park_id=2 AND component_...
You are exceeding the tombstone_failure_threshold. It defaults to 100'000. You can either increase the value in the cassandra.yaml or clean up your tombstones To do the latter alter your table and set the gc_grace_seconds to 0: ALTER TABLE component_readings WITH GC_GRACE_SECONDS = 0; Then trigger a compaction via ...
Cassandra
37,114,455
23
I cant find it in cassandra.yaml, maybe nodetool can get me the configured replication factor of my cluster? What is the default value of the replication factor?
A cluster doesn't have a replication factor, however your keyspaces does. If you want to look at the replication factor of a given keyspace, simply execute SELECT * FROM system_schema.keyspaces; and it will print all replication information you need.
Cassandra
34,859,635
23
How can I write a query to find all records in a table that have a null/empty field? I tried tried the query below, but it doesn't return anything. SELECT * FROM book WHERE author = 'null';
null fields don't exist in Cassandra unless you add them yourself. You might be thinking of the CQL data model, which hides certain implementation details in order to have a more understandable data model. Cassandra is sparse, which means that only data that is used is actually stored. You can visualize this by adding ...
Cassandra
20,981,075
23
I want to experiment with using Cassandra as an event store in an event sourcing application. My requirements for an event store are quite simple. The event 'schema' would be something like this: id: the id of an aggregate root entity data: the serialized event data (e.g. JSON) timestamp: when the event occurred seque...
Your design seem to be well modeled in "cassandra terms". The queries you need are indeed supported in "composite key" tables, you would have something like: query 1: select * from events where id = 'id_event'; query 2: select * from events where id = 'id_event' and seq_num > NUMBER; I do not think the second query i...
Cassandra
19,321,682
23
What is the difference between: a) nodetool rebuild b) nodetool repair [-pr] In other words, what exactly do the respective commands do?
nodetool rebuild: is similar to the bootstrapping process (when you add a new node to the cluster) but for a datacenter. The process here is mainly a streaming from the already live nodes to the new nodes (the new ones are empty). So after defining the key ranges for the nodes which is very fast, the rest can be seen a...
Cassandra
17,602,125
23
Is there an easy way to check if table (column family) is defined in Cassandra using CQL (or API perhaps, using com.datastax.driver)? Right now I am leaning towards executing SELECT 1 FROM table and checking for exception but maybe there is a better way?
As of 1.1 you should be able to query the system keyspace, schema_columnfamilies column family. If you know which keyspace you want to check, this CQL should list all column families in a keyspace: SELECT columnfamily_name FROM schema_columnfamilies WHERE keyspace_name='myKeyspaceName'; The report describing this fun...
Cassandra
16,016,946
23
I have Ubuntu 12.04 with cassandra 1.1.3 (tarball installation), When I try to start cassandra, I get the following: user@ubuntu:~/apache-cassandra-1.1.3/bin$ sudo ./cassandra -f xss = -ea -javaagent:./../lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms4G -Xmx4G -Xmn800M -XX: +HeapDumpOn...
The problem may be caused by using OpenJDK, as described in a Cassandra bug report but, see the comments here for occurrences of this issue on Sun/Oracle and other JVMs: https://issues.apache.org/jira/browse/CASSANDRA-2441 If you cannot install the Oracle JVM, then try changing the stack size in the conf/cassandra-en...
Cassandra
11,901,421
23
Is Cassandra's data stored only in the /var/lib/cassandra folder as mentioned in the cassandra.yaml file? Or is there any other location where Cassandra data is stored?
You can change the data storage location in the cassandra.yaml file, if you don't want data stored in /var/lib. See DataStax's Guide for Configuring Cassandra for a full explanation of the config file. In particular, > commitlog_directory The directory where the commit log will be stored. For optimal write perf...
Cassandra
9,631,591
23
In Cassandra terminology, what is TimeUUID and when is it used?
TimeUUID is a random global unique identifier. 16 bytes. Sample hex presentation: a4a70900-24e1-11df-8924-001ff3591711 See http://en.wikipedia.org/wiki/Universally_Unique_Identifier It may serve as a primary key in terms of relational database or when you need to store a list of values under some key. For example check...
Cassandra
2,614,195
23
In several places it's advised to design our Cassandra tables according to the queries we are going to perform on them. In this article by DataScale they state this: The truth is that having many similar tables with similar data is a good thing in Cassandra. Limit the primary key to exactly what you’ll be searching w...
You can use cqlsh COPY command : To copy your invoices data into csv file use : COPY invoices(id_invoice, year, id_client, type_invoice) TO 'invoices.csv'; And Copy back from csv file to table in your case invoices_yr use : COPY invoices_yr(id_invoice, year, id_client, type_invoice) FROM 'invoices.csv'; If you have ...
Cassandra
41,448,374
22
Maybe it is a stupid question, but I'm not able to determine the size of a table in Cassandra. This is what I tried: select count(*) from articles; It works fine if the table is small but once it fills up, I always run into timeout issues: cqlsh: OperationTimedOut: errors={}, last_host=127.0.0.1 DBeaver: Run 1: 225,...
Here is my current workaround: COPY articles TO '/dev/null'; ... 3568068 rows exported to 1 files in 2 minutes and 16.606 seconds. Background: Cassandra supports to export a table to a text file, for instance: COPY articles TO '/tmp/data.csv'; Output: 3568068 rows exported to 1 files in 2 minutes and 25.559 seconds ...
Cassandra
36,744,210
22
I'm inserting into a Cassandra table with timestamp columns. The data I have comes with microsecond precision, so the time data string looks like this: 2015-02-16T18:00:03.234+00:00 However, in cqlsh when I run a select query the microsecond data is not shown, I can only see time down to second precision. The 234 micro...
In an effort to answer your questions, I did a little digging on this one. Does Cassandra capture microseconds with timestamp data type? Microseconds no, milliseconds yes. If I create your table, insert a row, and try to query it by the truncated time, it doesn't work: aploetz@cqlsh:stackoverflow> INSERT INTO data (...
Cassandra
28,547,616
22
When experimenting with Cassandra I've observed that Cassandra writes to the following files: /.../cassandra/commitlog/CommitLog-<id>.log /.../cassandra/data/Keyspace1/Standard1-1-Data.db /.../cassandra/data/Keyspace1/Standard1-1-Filter.db /.../cassandra/data/Keyspace1/Standard1-1-Index.db /.../cassandra/data/system/Lo...
A write to a Cassandra node first hits the CommitLog (sequential). (Then Cassandra stores values to column-family specific, in-memory data structures called Memtables. The Memtables are flushed to disk whenever one of the configurable thresholds is exceeded. (1, datasize in memtable. 2, # of objects reach certain limit...
Cassandra
2,359,175
22
Very new to Cassandra so apologies if the question is simple. I created a table: create table ApiLog ( LogId uuid, DateCreated timestamp, ClientIpAddress varchar, primary key (LogId, DateCreated)); This work fine: select * from apilog If I try to add a where clause with the DateCreated like this: select * from a...
The partition key LogId determines on which node each partition will be stored. So if you don't specify the partition key, then Cassandra has to filter all the partitions of this table on all the nodes to find matching data. That's why you have to say ALLOW FILTERING, since that operation is very inefficient and is dis...
Cassandra
38,350,656
21
While using the C/C++ driver of Cassandra, I at times see these kind of messages popping up in my console: 1460937092.140 [WARN] (src/response.cpp:51:char* cass::Response::decode_warnings(char*, size_t)): Server-side warning: Aggregation query used without partition key Wondering whether someone knows what...
That warning is telling you that you are doing a select using a user defined aggregate without a partition key. That may be one that is built in like avg, count, min, max or could've one of your own. An example: select avg(temperature) from weather_data; Vs select avg(temperature) from weather_data where id = 1; Th...
Cassandra
36,683,533
21
As stated in this doc to select a range of rows i have to write this: select first 100 col1..colN from table; but when I launch this on cql shell I get this error: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:13 no viable alternative at input '100' (select [first] 100...)"> What's wrong?
According to the Docs, key word first is to limit the number of Columnns, not rows to limit the number of rows , you must just keyword limit. select col1..colN from table limit 100; the default limit is 10000
Cassandra
30,861,162
21
In SQL, I am able to do: select getdate(), getdate() - 7 Which returns the current date as well as current date - 7 days. I want to achieve the same in Cassandra CQL. I tried: select dateof(now()) But that does not work. It works only on insert and not in select. How can I get the same? Any help would be appreciated....
select dateof(now()) On its own, you are correct, that does not work. But if you have a table that you know only has one row (like system.local): aploetz@cqlsh:stackoverflow> SELECT dateof(now()) FROM system.local ; dateof(now()) -------------------------- 2015-03-26 03:18:39-0500 (1 rows) Unfortunately, Cassand...
Cassandra
29,272,691
21
I added a bottle server that uses python's cassandra library, but it exits with this error: Bottle FATAL Exited too quickly (process log may have details) log shows this: File "/usr/local/lib/python2.7/dist-packages/cassandra/cluster.py", line 1765, in _reconnect_internal raise NoHostAvailable("Unable to ...
This is what I use: [program:uwsgi] command=bash -c 'sleep 5 && uwsgi /etc/uwsgi.ini'
Cassandra
26,342,693
21
I'm building a backup and restore process for a Cassandra database so that it's ready when I need it, and so that I understand the details in order to build something that will work for production. I'm following Datastax's instructions here: http://www.datastax.com/documentation/cassandra/2.0/cassandra/operations/ops_b...
Added more details: You can run the snapshot for your particular keyspace using: $ nodetool snapshot <mykeyspace> -t <SnapshotDirectoryName> This will create the snapshot files inside the snapshots directory in data. When you delete your data, make sure you don't delete the snapshots folder or you will not be able to ...
Cassandra
25,465,904
21
There is a great talk here about simulating partition issues in Cassandra with Kingsby's Jesper library. My question is - with Cassandra are you mainly concerned with the Partitioning part of the CAP theorem, or is Consistency a factor you need to manage as well?
Cassandra is typically classified as an AP system, meaning that availability and partition tolerance are generally considered to be more important than consistency. However, real world systems rarely fall neatly into these categories, so it's more helpful to view CAP as a continuum. Most systems will make some effort...
Cassandra
20,205,797
21
How do I write subqueries/nested queries in cassandra. Is this facility is provided in CQL? Example I tried: cqlsh:testdb> select itemname from item where itemid = (select itemid from orders where customerid=1); It just throws the following error - Bad Request: line 1:87 no viable alternative at input ';'
Because of its distributed nature, Cassandra has no support for RDBMS style joins. You have a few options for when you want something like a join. One option perform separate queries and then have your application join the data itself. This makes sense if the data is relatively small and you only have to perform a sma...
Cassandra
16,790,297
21
I'm developing a php platform that will make huge use of images, documents and any file format that will come in my mind so i was wondering if Cassandra is a good choice for my needs. If not, can you tell me how should i store files? I'd like to keep using cassandra because it's fault-tolerant and uses auto-replication...
From the cassandra wiki, Cassandra's public API is based on Thrift, which offers no streaming abilities any value written or fetched has to fit in memory. This is inherent to Thrift's design and is therefore unlikely to change. So adding large object support to Cassandra would need a special API that manually split t...
Cassandra
8,842,837
21
I just spun up a machine on EC2 running Cassandra following the instructions in the link below, but I have no idea what version it is. How do I figure this out? I know I'm missing something incredibly simple, just don't know where to look. http://wiki.apache.org/cassandra/CloudConfig
It might be easier to use nodetools ./nodetool -h localhost version
Cassandra
3,604,857
21
When I try to Insert data in Cassandra using the below query I am getting the below mentioned error cqlsh:assign> insert into tblFiles1(rec_no,clientid,contenttype,datafiles,filename) values(1,2,'gd','dgfsdg','aww'); WriteTimeout: code=1100 [Coordinator node timed out waiting for replica nodes' responses] message=...
Increase the write_request_timeout_in_ms Timeout in the Cassandra Config file (cassandra.yaml) as write_request_timeout_in_ms: 20000 and restart your Server
Cassandra
30,575,125
20
I am just getting start on Cassandra and I was trying to create tables with different partition and clustering keys to see how they can be queried differently. I created a table with primary key of the form - (a),b,c where a is the partition key and b,c are clustering key. When querying I noticed that the following que...
It's not that clustering keys are not treated the same, it's that you can't skip them. This is because Cassandra uses the clustering keys to determine on-disk sort order within a partition. To add to your example, assume PRIMARY KEY ((a),b,c,d). You could run your query (with ALLOW FILTERING) by specifying just b, or...
Cassandra
30,486,916
20
I need to insert a new column into an existing column family via a CQL script. I want to do something like: alter COLUMNFAMILY rules ADD rule_template text IF NOT EXISTS; How can I achieve this purely in CQL script?
There is no optional "if not exists" for altering column families (tables). As a workaround you could just execute the alter command and ignore the error if the column already exists. There shouldn't be any harm in it, other than the error message.
Cassandra
25,728,944
20
I am trying to run the following query SELECT edge_id, b_id FROM booking_by_edge WHERE edge_id IN ? I bind Java list of Long's as a parameter and I get an exception SyntaxError: line 0:-1 mismatched input '<EOF>' expecting ')' (ResultSetFuture.java:242) If I try to use (?) it expects single Long item to be bound, bu...
Tested in Cassandra 2.1.3, the following code snippet works: PreparedStatement prepared = session.prepare("SELECT edge_id, b_id FROM booking_by_edge WHERE edge_id IN ?;"); List<Long> edgeIds = Arrays.asList(1L, 2L, 3L); session.execute(prepared.bind(edgeIds));
Cassandra
16,918,853
20
How do I stop cassandra server running on a single node in my mac os x? Cassandra script doesn't have -stop option. Only way other than restart the mac os x, was to do a "ps" and find the java process which had arguments for cassandra and use kill -9 to kill the process. But trying to restart cassandra after that sti...
If you've installed cassandra via homebrew, use brew info cassandra and it will tell you how to load/unload cassandra using launchctl. This worked better for me than the other answers here. Commands brew info cassandra To see status of cassandra brew services start cassandra To start cassandra brew services stop cassa...
Cassandra
10,877,072
20
Disclaimer: by referential Data, i do not mean referential integrity I am learning nosql and would like to understand how data should be modeled. In a typical relational database for an CMS application, for example, you may have two tables: article and author, where article have an reference to the author. In nosql ...
Your data is clearly relational: an article has an author. You can model your data in a NOSQL store like MongoDB in just the same way as you would in a relational store BUT because there are no joins in the database you have to make two calls to the database so you haven't gained anything. BUT ... what you CAN do with...
Cassandra
7,591,943
20
Can you share your thoughts how would you implement data versioning in Cassandra. Suppose that I need to version records in an simple address book. (Address book records are stored as Rows in a ColumnFamily). I expect that the history: will be used infrequently will be used all at once to present it in a "time machin...
If you can add the assumption that address books typically have fewer than 10,000 entries in them, then using one row per address book time line in a super column family would be a decent approach. A row would look like: {'address_book_18f3a8': {1290635938721704: {'entry1': 'entry1_stuff', 'entry2': 'entry2_stuff'}},...
Cassandra
4,183,945
20
Right now I'm developing the prototype of a web application that aggregates large number of text entries from a large number of users. This data must be frequently displayed back and often updated. At the moment I store the content inside a MySQL database and use NHibernate ORM layer to interact with the DB. I've got a...
The other answers here have focused mainly on the technical aspects, but I think there are important points to be made that focus on the startup company aspect of things: Availabililty of talent. MySQL is very common and you will probably find it easier (and more importantly, cheaper) to find developers for it, compar...
Cassandra
2,839,505
20
I am not using Elasticssearch. I am trying to perform some database operations in cassandra using CQL. I am using threads. While running the code I am always getting the exception in thread after a while : com.datastax.oss.driver.api.core.NoNodeAvailableException: No node was available to execute the query. I have tes...
Change .withLocalDatacenter("us-east-2") to .withLocalDatacenter("datacenter1") and retry.
Cassandra
58,279,546
19
Could you please explain why is Cassandra not linearizable even when quorum based read and writes are used? Linearizability defined as If operation B started after operation A successfully completed, then operation B must see the system in the same state as it was on completion of operation A, or a newer state.
Edit considering Cassandra foreground Read Repair: Writes that fail because only a partial set of replicas are updated could lead to two different readers seeing two different values of data. This is because of the lack of rollbacks in simple quorum-based consistency approaches. This behavior breaks the linearizability...
Cassandra
56,795,239
19
Here is the table I'm creating, this table contains information about players that played the last mundial cup. CREATE TABLE players ( group text, equipt text, number int, position text, name text, day int, month int, year int, club text, liga text, capitan text, PRIMARY key (name, day, month, year)...
Your table definition is incorrect for the query you're trying to run. You've defined a table with partition key "name", clustering columns "day", "month", "year", and various other columns. In Cassandra all SELECT queries must specify a partition key with EQ or IN. You're permitted to include some or all of the cluste...
Cassandra
46,921,455
19
I'm running a single node at the moment. I'm trying to enable password authentication for Cassandra. I'm following this guide: http://cassandra.apache.org/doc/latest/operating/security.html#password-authentication I'll note that I didn't alter system_auth's replication as it's a single node cluster. I edited cassandra...
I managed to solve the problem. I had to run ALTER KEYSPACE system_auth WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; as it was set to {'class': 'NetworkTopologyStrategy', 'DC1': '1', 'DC2': '1'} previously, even though it was a single node cluster. This is why it couldn't achieve a QUORU...
Cassandra
44,883,940
19
I want to transfer data from one Cassandra cluster (reached via 192.168.0.200) to another Cassandra cluster (reached via 127.0.0.1). The data is 523 rows but each row is about 1 MB. I am using the COPY FROM and COPY TO command. I get the following error when I issue the COPY TO command: Error for (8948428671687021382, ...
You may want to increment the request timeout (default: 10 seconds), not the connect timeout. Try: cqlsh --request-timeout=6000 or add: [connection] request_timeout = 6000 to your ~/.cassandra/cqlshrc file.
Cassandra
39,955,968
19
Is there any way to prettify the results of cql commands in the Linux terminal while using the cqlsh utility (cql version of Mongo .pretty())? It becomes quite difficult to read the results when the output is displayed normally, especially when there are nested documents and arrays
Perhaps you are interested in the EXPAND command? Usage: EXPAND ON; From the documentation over at Datastax: This command lists the contents of each row of a table vertically, providing a more convenient way to read long rows of data than the default horizontal format. You scroll down to see more of the row instead of...
Cassandra
28,949,790
19
I have a cassandra node at a machine. When I access cqlsh from the same machne it works properly. But when I tried to connect to it's cqlsh using "192.x.x.x" from another machine, I'm getting an error saying Connection error: ('Unable to connect to any servers', {'192.x.x.x': error(111, "Tried connecting to [('192.x.x....
Probably the remote Cassandra node is not bound to the external network interface but to the loopback one (this is the default configuration). You can ensure this by using "telnet thecassandrahost 9042" from the remote machine, it should not work. In order to bind Cassandra to the external network interface you need to...
Cassandra
27,758,795
19
Recently I've started working on Grails integration with Cassandra using the Java driver for cassandra(cassandra-driver-core-2.0.2). So I was curious to know how we can find out how much size our table is taking to store the data in cassandra DB. I have created a keyspace with name Customkeyspace and a column family ca...
To get statistics regarding column families in Cassandra, you can simply run the command: nodetool cfstats It reports statistics about tables which include the live data size as well as on disk. The documentation about this utility for Cassandra 2.1 is available here.
Cassandra
27,011,886
19
I want to select specific fields of a table in cassandra and insert them into another table. I do this in sql server like this: INSERT INTO Users(name,family) SELECT name,family FROM Users How to to this in cassandra-cli or cqlsh?
COPY keyspace.columnfamily1 (column1, column2,...) TO 'temp.csv'; COPY keyspace.columnfamily2 (column1, column2,...) FROM 'temp.csv'; here give your keyspace(schema-name) and instead of columnfamilyname1 use the table to which you want to copy and in columnfamily2 give the tablename in which you want to copy.. And yes...
Cassandra
21,363,046
19
On a given physical node, rows for a given partition key are stored in the order induced by the clustering keys, making the retrieval of rows in that clustering order particularly efficient. http://cassandra.apache.org/doc/cql3/CQL.html#createTableStmt What kind of ordering is induced by clustering keys?
Suppose your clustering keys are k1 t1, k2 t2, ..., kn tn where ki is the ith key name and ti is the ith key type. Then the order data is stored in is lexicographic ordering where each dimension is compared using the comparator for that type. So (a1, a2, ..., an) < (b1, b2, ..., bn) if a1 < b1 using t1 comparator, or ...
Cassandra
18,635,381
19
I am trying to understand Cassandra and how to structure my column families (CF) but it's quite hard since I am used to relational databases. For example if I create simple users CF and I try to insert new row, how can I make an incremental key like in MySQL? I saw a lot of examples where you would just put the usernam...
Your questions are quite general, but let me take a stab at it. First, you need to model your data in terms of your queries. With an RDBMS, you model your data in some normalized form, then optimize later for your specific queries. You cannot do this with Cassandra; you must write your data the way you intend to rea...
Cassandra
12,709,277
19
We are starting a new java web-project with Cassandra as the database. The team is very well-experienced with RDBMS/JPA/Hibernate/Spring but very new to the world of NoSQL. We want to start the development with as simple setup as possible. Hector seems to be the most preferred and popular choice for connecting to Cassa...
I've tried both and Astyanax is way easier. The API actually makes sense and reflects what your are actually doing. Both Hector or direct Thrift usually results hard to decipher code. There are some issues yet to be solved in Astyanax (a.o. getColumnByName), but I've decided to build my project using it. Oh, I used the...
Cassandra
9,481,578
19
What is the best approach to write unit tests for code that persists data to nosql data store, in our case cassandra? => We are using embedded server approach using a utility from git hub (https://github.com/hector-client/hector/blob/master/test/src/main/java/me/prettyprint/hector/testutils/EmbeddedServerHelper.java). ...
We use an embedded cassandra server, and I think that is the best approach when testing cassandra, mocking the cassandra API is too error prone. EmbeddedServerHelper.cleanup() just removes files rom the file system, but data may still exist in memory. There is a teardown() method in EmbeddedServerHelper, but I a not su...
Cassandra
6,612,104
19
I am looking for an eventually consistent data store and it looks like it may be coming down to Riak or Cassandra. Has anyone got expereinces of a view on this?
As you probably know, they are both architecturally strongly influenced by Dynamo (eventually consistent, no single points of failure, etc). Both also go beyond Dynamo in providing a "richer than pure K/V" data model -- in Cassandra's case, providing a Bigtable-like ColumnFamily mode, in Riak's, a Document-oriented on...
Cassandra
2,123,507
19
I am using datastax java driver 3.1.0 to connect to cassandra cluster and my cassandra cluster version is 2.0.10. I am writing asynchronously with QUORUM consistency. private final ExecutorService executorService = Executors.newFixedThreadPool(10); public void save(String process, int clientid, long deviceid) { ...
Not an authoritative answer but maybe it would be helpful. First you should consider what would you do when query cannot be executed right away. No matter which rate limiting you chose if you get requests at higher rate than you can write to Cassandra eventually you'll get your process clogged with waiting requests. An...
Cassandra
41,049,753
18
I am using Cassandra and, during startup, Netty prints a warning with a stack trace: Found Netty's native epoll transport in the classpath, but epoll is not available. Using NIO instead." The application works normally, but is there a way to fix the warning? Here is the full stack trace: 16:29:46 WARN com.datastax....
If you are running on Linux, you can use the native Linux driver. For instance, if you are using Maven, add a dependency like this: <dependency> <groupId>io.netty</groupId> <artifactId>netty-transport-native-epoll</artifactId> <version>4.0.27.Final</version> <classifier>linux-x86_64</classifier> </dependency> ...
Cassandra
40,746,505
18
How the Cassandra client chooses the coordinator node? is the coordinator node stores the data sent by the client before replicating?
The coordinator is selected by the driver based on the policy you have set. Common policies are DCAwareRoundRobinPolicy and TokenAware Policy. For DCAwareRoundRobinPolicy, the driver selects the coordinator node based on its round robin policy. See more here: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/...
Cassandra
32,867,869
18
I'm trying to run the following example from here CREATE TYPE address ( street text, city text, zip int ); CREATE TABLE user_profiles ( login text PRIMARY KEY, first_name text, last_name text, email text, addresses map<text, address> ); However, w...
I am running 2.1.8 and I get the same error message. To fix this, you need the frozen keyword: CREATE TABLE user_profiles ( login text PRIMARY KEY, first_name text, last_name text, email text, addresses map<text, frozen <address>> ); Frozen is necessary for UDTs (for now) as it serial...
Cassandra
31,953,841
18
One problem with blob for me is, in java, ByteBuffer (which is mapped to blob in cassandra) is not Serializable hence does not work well with EJBs. Considering the json is fairly large what would be the better type for storing json in cassandra. Is it text or blob? Does the size of the json matter when deciding the blo...
I don't think there's any benefit for storing the literal JSON data as a BLOB in Cassandra. At best your storage costs are identical, and in general the API's are less convenient in terms of working with BLOB types as they are for working with strings/text. For instance, if you're using their Java API then in order ...
Cassandra
31,339,150
18
I'm getting this error when starting cassandra after upgrade. Any idea? # cassandra -f xss = -ea -javaagent:/usr/share/cassandra/lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms1920M -Xmx1920M -Xmn200M -XX:+HeapDumpOnOutOfMemoryError -Xss180k The stack size specified is too small, Specif...
I have fixed it by editing file /etc/cassandra/cassandra-env.sh I have changed JVM_OPTS="$JVM_OPTS -Xss180k" to JVM_OPTS="$JVM_OPTS -Xss256k" and it worked. Basically the value of parameter Xss determines stack size. As the error indicates, It is too small. Just by increasing Xss will solve the problem. It was 180K bef...
Cassandra
22,470,628
18
I need to insert 60GB of data into cassandra per day. This breaks down into 100 sets of keys 150,000 keys per set 4KB of data per key In terms of write performance am I better off using 1 row per set with 150,000 keys per row 10 rows per set with 15,000 keys per row 100 rows per set with 1,500 keys per row 1000 rows ...
The answer depends on what your data retrieval pattern is, and how your data is logically grouped. Broadly, here is what I think: Wide row (1 row per set): This could be the best solution as it prevents the request from hitting several nodes at once, and with secondary indexing or composite column names, you can quick...
Cassandra
19,039,123
18
I am trying to remodel a SQL database Cassandra such that, I can find the Cassandra equivalent for the SQL queries. I use CQL 3 and Cassandra v1.2. I modeled the db design in cassandra so that it supports the order by clauses and denormalized tables to support the join operation. However I am at sea when it comes to D...
With Cassandra you solve these kinds of problems by doing more work when you insert your data -- which sounds like it would be slow, but Cassandra is designed for fast writes, and you're probably going to read the data many more times than you write it so it makes sense when you consider the whole system. I can't tell ...
Cassandra
17,342,176
18
I found lazyboy and pycassa - maybe there are others too. I've seen many sites recommending lazyboy. IMHO the project seems dead, see https://www.ohloh.net/p/compare?project_0=pycassa&project_1=lazyboy So what's the best option for a new project? Thanks.
The Cassandra project has been recommending that new projects use CQL for a few versions now, and with the advent of CQL 3 in Cassandra 1.1, I'd definitely recommend going right to that. Advantages include a more familiar syntax if you've used SQL before, and a commonality of interface between the different language CQ...
Cassandra
10,430,417
18
I have a cluster with three nodes and I need to remove one node. How can I make sure the data from the node to be removed will be replicated to the two other nodes before I actually remove it? Is this done using snapshots? How should I proceed?
From the doc You can take a node out of the cluster with nodetool decommission to a live node, or nodetool removenode (to any other machine) to remove a dead one. This will assign the ranges the old node was responsible for to other nodes, and replicate the appropriate data there. If decommission is used, the ...
Cassandra
10,306,021
18
Please excuse any mistakes in terminology. In particular, I am using relational database terms. There are a number of persistent key-value stores, including CouchDB and Cassandra, along with plenty of other projects. A typical argument against them is that they do not generally permit atomic transactions across multip...
If, taking your example, you want to atomically update the value in a single document (row in relational terminology), you can do so in CouchDB. You will get a conflict error when you try to commit the change if an other contending client has updated the same document since you read it. You will then have to read the n...
Cassandra
1,093,115
18
I'm new to Java. While exploring the ways of monitoring Cassandra, I found out(https://cassandra.apache.org/doc/latest/operating/metrics.html) that "Metrics in Cassandra are managed using the Dropwizard Metrics library". However, at several places I've read about Codahale Metrics which has got me confused regarding the...
The Metrics library have changed its package naming with versions as its changed hands in ownership a bit yammer->codahale->dropwizard They are all same library but dropwizard is the more up to date version
Cassandra
49,557,777
17
I have an application where the 'natural' partition key for a Cassandra table seems like it would be 'customer'. This is the primary way we want to query the data, we would get good data distribution, etc. But if there were well over 1 million customers, would that be too many different partitions? Should I choose a ...
But if there were well over 1 million customers, would that be too many different partitions? No. The Murmur3Partitioner can handle something like 2^64 (-2^63 to +2^63) partitions. Cassandra is designed to be very good at storing large amounts of data and retrieving by partition key. There are restrictions on the ...
Cassandra
30,648,479
17
I wonder why nodetools don't know the percentage of the ring handeld by my node... I created this keyspace with CREATE KEYSPACE mykeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true; Someone has a clue?
okay got it. I have to specify a keyspace! nodetool status mykeyspace does the trick
Cassandra
29,921,809
17
Theoretically, Cassandra allows up to 2 billion columns in a wide row. I have heard that in reality up to 50.000 cols/50 MB are fine; 50.000-100.000 cols/100 MB are OK but require some tuning; and that one should never go above 100.000/100 MB columns per row. The reason being that this will put pressure on the heap. I...
In Cassandra, the maximum number of cells (rows x columns) in a single partition is 2 billion. Additionally, a single column value may not be larger than 2GB, but in practice, "single digits of MB" is a more reasonable limit, since there is no streaming or random access of blob values. Partitions greater than 100Mb can...
Cassandra
28,893,365
17
I know we can use Cassandra's virtual node facility so that we can prevent additional overhead of assigning token (start token) to different nodes of cluster. Instead of that we use num_tokens and its default value is 256. In what way are these virtual nodes making difference in partitioning? Is Cassandra setting/assi...
What is virtual nodes? Prior to Cassandra 1.2, each node was assigned to a specific token range. Now each node can support multiple, non-contiguous token ranges. Instead of a node being responsible for one large range of tokens, it is responsible for many smaller ranges. In this way, one physical node is essential...
Cassandra
25,379,457
17
Datastax Java driver (cassandra-driver-core 2.0.2) for Cassandra supports PreparedStatements as well as QueryBuilder API. Any specific advantages using one over the other? Disadvantages? Documentation: http://www.datastax.com/documentation/developer/java-driver/2.0/common/drivers/reference/driverReference_r.html The a...
PreparedStatements gives you a performance boost since what you're executing is already stored server-side (assuming you re-use the statements). You just bind new concrete values and re-execute the statement. The query builder is a fancier way of creating a string statement to be executed as is without requiring any p...
Cassandra
24,924,800
17
Full-Text search in Cassandra; I am fairly new to Cassandra, and wish to understand it more properly. I am attempting to perform a Full-Text search in Cassandra, but after some research I have found that there may not be a "simple" approach for this.. and I say maybe because the first page of Google hasn't said much of...
AFAIK Datastax Enterprise Search is the (commercial) successor of Solandra. Cassandra 2.0 supports so called "custom secondary indexes". Custom secondary indexes are Java code. Your own implementation has to implement the abstract class org.apache.cassandra.db.index.SecondaryIndex (See http://www.datastax.com/documenta...
Cassandra
24,858,141
17
In the earlier beta releases of CQL, there was a command I could use to set the read / write consistency of an individual CQL operation. It looked like this: SELECT * FROM users WHERE state='TX' USING CONSISTENCY QUORUM; I use CQL3 regularly and have a use-case where I need to be able to perform a read with a higher ...
First set the consistency by running command: CONSISTENCY QUORUM; and then then run you query: SELECT * FROM users WHERE state='TX' At any point you can check the consistency using: CONSISTENCY;
Cassandra
21,442,717
17
I am using embedded Cassandra. When I shut down and restart my Cassandra service data is lost. I think decent data are not properly flushed into the disk. So I tried using nodetool to flush data manually and check if data are available. But nodetool doesn't seem to work properly for embedded Cassandra service. I get th...
How are you stopping and starting the Cassandra server? The call to stopServer on the Cassandra daemon should be flushing any outstanding writes to the commit log. The thread will continue to do some processing even after the method returns, so if you're killing the JVM after stopServer() then you might be preventing...
Cassandra
20,520,839
17
I recently started working with Cassandra database. I have installed single node cluster in my local box. And I am working with Cassandra 1.2.3. I was reading the article on the internet and I found this line- Cassandra writes are first written to a commit log (for durability), and then to an in-memory table structu...
You are almost there in your understanding. However, missing some minute details. So explaining things in a structured way, cassandra write operation life cycle is divided in these steps commitlog write memtable write sstable write Cassandra writes are first written to a commit log (for durability), and then to an ...
Cassandra
15,857,779
17
I am looking for a code example to retrieve all rows and all columns of a column family. Something like: SELECT * FROM MyTable I see that this can be done using a RangeSlicesQuery, but you still have to provide a certain range. And I think you have to specify the column names too. Is there a clean and safe way to do t...
Try something like this: public class Dumper { private final Cluster cluster; private final Keyspace keyspace; public Dumper() { this.cluster = HFactory.getOrCreateCluster("Name", "hostname"); this.keyspace = HFactory.createKeyspace("Keyspace", cluster, new QuorumAllConsistencyLevelPolicy()...
Cassandra
8,418,448
17
this question may have been asked many times, but could not find any suitable answer. Is there any ORM on Rails3 for Cassandra. I have searched google and found following. fauna/cassandra - cassandra client for rails carbonfive/active_column - last updated 13-may-2011 winebarrel/activerecord-cassandra-adapter - last u...
Update: February 2013 data-axle/cassandra_object aka gotime-cassandra_object gem brewster/cequel aka cequel gem twitter/cassandra - a ruby client for Cassandra and if you're using Datastax: jasonmk/datastax_rails - aka datastax_rails gem
Cassandra
6,157,760
17
I am trying to develop application using Hive as the Database, and then I also find noSQL solutions as an alternative to it. Now decided to develop using Cassandra, my next problem is about what client should I use? which one is better, Hector -- a pure java solutions, or Kundera with JPA like development? I prefer Hec...
Hector is slowly moving towards CQL integration. The first steps have been made, but because of the experience of an unstable API, the developers seem to have postponed a new release. The CQL API is rather new, as it should be nearly equivalent to a SQL syntax. I made some basic steps with CRUD operations to verify tha...
Cassandra
6,151,078
17
I would like to start using Cassandra with a node.js deployment, but I can't find a Thrift or Cassandra client for Node.js and/or JavaScript. Is there one? Is there a simple means of generating Thrift connections? Update: The short answer to this question turns out to be no, there is no JS client for Thrift that is co...
Someone made one now: https://github.com/wadey/node-thrift Update: Rackspace released a node cassandra api: http://code.google.com/a/apache-extras.org/p/cassandra-node/ Update: They moved it to github: https://github.com/racker/node-cassandra-client Update: There is a CQL driver now too: https://github.com/simplereach/...
Cassandra
2,947,470
17
Anyone out there using Cassandra (http://cassandra.apache.org/) with PHP? What PHP module would you guys recommend to communicate between PHP and Cassandra?
Although this is an old question, thobb's version of PHPCassa has become a nice standard for PHP development with Apache Cassandra. The link referenced in the accepted question is to the hoan version of PHPCassa, which is not as current (last update was 2 years ago) or robust as the forked version that thobbs maintai...
Cassandra
2,508,649
17
We are looking at using Cassandra to store a stream of information coming from various sources. One issue we are facing is the best way to query between two dates. For example we will need to retrieve an object between datetime dt1 and datetime dt2. We are currently considering the created unix timestamp as the key poi...
Cassandra rows can be very large, so consider modeling it as columns in a row rather than rows in a CF; then you can use the column slice operations, which are faster than row slices. If there are no "natural" keys associated with this then you can use daily or hourly keys like "2010/02/08 13:00". Otherwise, yes, usin...
Cassandra
2,212,279
17
I created a keyspace and a table(columnfamily) within it. Let's say "ks.cf" After entering few hundred thousand rows in the columnfamily cf, I saw the disk usage using df -h. Then, I dropped the keyspace using the command DROP KEYSPACE ks from cqlsh. After dropping also, the disk usage remains the same. I also did nod...
Ran into this problem recently. After dropping a table a snapshot is made. This snapshot will allow you to roll this back if this was not intended. If you do however want that harddrive space back you need to run: nodetool -h localhost -p 7199 clearsnapshot on the appropriate nodes. Additionally you can turn snapsh...
Cassandra
33,104,071
16
I am trying to learn Cassandra and always find the best way is to start with creating a very simple and small application. Hence I am creating a basic messaging application which will use Cassandra as the back-end. I would like to do the following: User will create an account with a username, email, and password. The ...
Yes it's always a struggle to adapt to the limitations of Cassandra when coming from a relational database background. Since we don't yet have the luxury of doing joins in Cassandra, you often want to cram as much as you can into a single table. In your case that would be the users_by_username table. There are a few ...
Cassandra
32,447,699
16
I'm new with cassandra and I met a problem. I created a keyspace demodb and a table users. This table got 3 columns: id (int and primary key), firstname (varchar), name (varchar). this request send me the good result: SELECT * FROM demodb.users WHERE id = 3; but this one: SELECT * FROM demodb.users WHERE firstname = '...
This request also doesn't work: That's because you are mis-understanding how sort order works in Cassandra. Instead of using a secondary index on firstname, create a table specifically for this query, like this: CREATE TABLE usersByFirstName ( id int, firstname text, lastname text, PRIMARY KEY (firstname,id)...
Cassandra
29,793,438
16
I have recently lowered gc_grace_seconds for a CQL table. I am running LeveledCompactionStrategy. Is it possible for me to force purging of old tombstones from my SSTables?
TL;DR Your tombstones will disappear on their own through compaction bit make sure you are running repair or they may come back from the dead. http://www.datastax.com/documentation/cassandra/2.0/cassandra/dml/dml_about_deletes_c.html Adding some more details: Tombstones are not immediately available for deletion until ...
Cassandra
27,566,615
16
I understand that this is not possible using an UPDATE. What I would like to do instead, is migrate all rows with say PK=0 to new rows where PK=1. Are there any simple ways of achieving this?
For a relatively simple way, you could always do a quick COPY TO/FROM in cqlsh. Let's say that I have a column family (table) called "emp" for employees. CREATE TABLE stackoverflow.emp ( id int PRIMARY KEY, fname text, lname text, role text ) And for the purposes of this example, I have one row in it. ...
Cassandra
27,022,325
16
When importing a record with a large field inside (longer than 124214 characters) I am getting the error "field larger than field limit (131072)" I saw form other posts how to solve this on Python but I don't know if it is possible on CQLSH. Thanks
Take a look at this answer: _csv.Error: field larger than field limit (131072) You will need to add this solution to the top of the cqlsh file. So after: import csv import getpass csv.field_size_limit(sys.maxsize)
Cassandra
24,168,235
16
I have a Cassandra question. Do you know how Cassandra does updates/increments of counters? I want to use a storm bolt (CassandraCounterBatchingBolt from storm-contrib repo on github) which writes into cassandra. However, I'm not sure how some of the implementation of the incrementCounterColumn() method works .. and th...
Counters in C* have a complex internal representation that avoids most (but not all) problems of counting things in a leaderless distributed system. I like to think of them as sharded counters. A counter consists of a number of sub-counters identified by host ID and a version number. The host that receives the counter ...
Cassandra
20,953,821
16
I have below table in CQL- create table test ( employee_id text, employee_name text, value text, last_modified_date timeuuid, primary key (employee_id) ); I inserted couple of records in the above table like this which I will be inserting in our actual use case scenario- insert into test (emplo...
The general rule is simple: "you can only query by columns that are part of the key". As an explanation all other queries would require a complete scan of the tables which might mean a lot of data sifting. There are things that can modify this rule: use secondary indexes for columns with low cardinality (more details ...
Cassandra
19,756,368
16