cqlsh

cassandra, select via a non primary key

六眼飞鱼酱① 提交于 2019-12-18 12:18:20
问题 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 = 'francois'; doesn't work and I get the following error message: InvalidRequest: code=2200 [Invalid query] message="No secondary indexes on the restricted columns support the

Aggregation in Cassandra across partitions

Deadly 提交于 2019-12-18 09:38:35
问题 I have a Data model like below, CREATE TABLE appstat.nodedata ( nodeip text, timestamp timestamp, flashmode text, physicalusage int, readbw int, readiops int, totalcapacity int, writebw int, writeiops int, writelatency int, PRIMARY KEY (nodeip, timestamp) ) WITH CLUSTERING ORDER BY (timestamp DESC) where, nodeip - primary key and timestamp - clustering key (Sorted by descinding oder to get the latest), Sample data in this table, SELECT * from nodedata WHERE nodeip = '172.30.56.60' LIMIT 2;

Cassandra UPDATE primary key value

萝らか妹 提交于 2019-12-18 03:15:27
问题 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? 回答1: 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

Cassandra partition key for time series data

馋奶兔 提交于 2019-12-17 20:01:04
问题 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,tagid,timestamp)); In the Primary key, I set deviceid as the partition key which mean all data with same device id will write into one node (does it mean one machine or one partition. Each

Why does cqlsh right-align strings?

a 夏天 提交于 2019-12-14 03:53:54
问题 I find that string-values displayed using cqlsh are right-aligned. Is there a reason for this? And is there a way to left-align strings? cqlsh:test> create table test (id int, a ascii, t text, primary key(id)); cqlsh:test> insert into test (id, a, t) values (1, 'ascii', 'text'); cqlsh:test> insert into test (id, a, t) values (2, 'a', 't'); cqlsh:test> select * from test; id | a | t ----+-------+------ 1 | ascii | text 2 | a | t (2 rows) 回答1: I think this is mostly done for aesthetic reasons,

copy one table to another in cassandra

不问归期 提交于 2019-12-14 00:14:46
问题 i want to copy data from standardevents to standardeventstemp.. below steps i am doing COPY events.standardevents (uuid, data, name, time, tracker, type, userid) TO 'temp.csv'; truncate standardevents; COPY event.standardeventstemp (uuid, data, name, time, tracker, type, userid) FROM 'temp.csv'; but i am getting below error after 3rd step Bad Request: Invalid STRING constant (3a1ccec0-ef77-11e3-9e56-22000ae3163a) for name of type uuid aborting import at column #0, previously inserted values

Cassandra Range Search on Secondary Index with Allow Filtering

↘锁芯ラ 提交于 2019-12-13 20:05:59
问题 I'm playing with Cassandra 3. I added a secondary index on a column of integer, then I want to do a range query. First it threw an error: InvalidRequest: code=2200 [Invalid query] message="No supported secondary index found for the non primary key columns restrictions" So I added 'Allow Filtering' cqlsh:mykeyspace> SELECT * FROM test ; id | id2 | age | extra ----+-----+-----+------- 1 | 1 | 1 | 1 2 | 2 | 2 | 2 (2 rows) cqlsh:mykeyspace > CREATE INDEX test_age on test (extra) ; cqlsh

Cassandra read_request_timeout_in_ms set up for external(Client) request

雨燕双飞 提交于 2019-12-13 03:01:50
问题 As per Documentation and given knowledge on the internet. It seems that the below-given properties - request_timeout_in_ms - write_request_timeout_in_ms - read_request_timeout_in_ms Works only for internal(server side) Cassandra requests. I was even convinced to this fact when I set these parameters in cassandra.yaml file to 80000 but still got the Timeout error against my Select query to a bit bigger record by following two ways: 1) when I tried to connect to Cassandra via cqlsh without

Cassandra system.hints table is empty even when the one of the node is down

我是研究僧i 提交于 2019-12-13 01:43:26
问题 I am learning Cassandra from academy.datastax.com. I am trying the Replication and Consistency demo on local machine. RF = 3 and Consistency = 1. When my Node3 is down and I am updating my table using update command, the SYSTEM.HINTS table is expected to store hint for node3 but it is always empty. Do I need to make any configurational changes for hints to work or the defaults are ok? surjanrawat$ ccm node1 nodetool getendpoints mykeyspace mytable 1 127.0.0.3 127.0.0.4 127.0.0.5 surjanrawat$

Cassandra status changing from active(running) to active(exited) without any errors

左心房为你撑大大i 提交于 2019-12-12 14:27:12
问题 Cassandra does not show any error while running sudo service cassandra start but when sudo service cassandra status is checked, it shows active(exited). Tried stopping the service and starting again but encountered with the same error. Any suggestions or solutions are welcome. Cassandra version : 2.2.5 cqlsh version : 5.0.1 回答1: Have you looked in the system.log file and see if any errors are being written? (/var/log/cassandra/system.log). If so can you post them? 回答2: Thank you for your help