I am trying to get some time series data from Kassandra. Data is placed there by an external application, and it uses KairosDB to write data (based on OpenTSDB). I have no way to put the KairosDB libraries in the application I'm developing, but the Datastax Cassandra libraries are already available to me.
How do I write basic queries to extract information directly from Kassandra in a convenient way? Queries in which I can specify start and end times and additional tags for row row indexes. Some of these may be basic Cassandra knowledge that I don’t see, but there are problems specific to the circuit, such as the fact that the sample time is stored as relative values from the absolute timestamp in row_key_index or the fact that the data can be divided into several row_key_index columns depending on the data storage and the requested period of time.
If I request data directly from column families, I get something like this:
cqlsh:kairosdb> select * from string_index;
key | column1 | value
----------------------------+--------------------------------------------+-------
0x7461675f76616c756573 | all | 0x
0x7461675f76616c756573 | data_points | 0x
0x7461675f76616c756573 | eui.3765353036366237 | 0x
0x7461675f76616c756573 | row_key_index | 0x
0x7461675f76616c756573 | string_index | 0x
0x6d65747269635f6e616d6573 | kairosdb.datastore.queries_waiting | 0x
0x6d65747269635f6e616d6573 | kairosdb.datastore.query_time | 0x
0x6d65747269635f6e616d6573 | kairosdb.datastore.write_size | 0x
if I make a query in the row_key_index table, the data is all stored as blob. Performing a blob-> ascii conversion yields:
cqlsh:kairosdb> select blobAsAscii(key) from row_key_index;
blobAsAscii(key)
------------------------------------
kairosdb.datastore.write_size
kairosdb.datastore.write_size
kairosdb.datastore.write_size
kairosdb.datastore.write_size
kairosdb.datastore.write_size
The same conversion in column1 gives:
cqlsh:kairosdb> select blobAsAscii(column1) from row_key_index;
blobAsAscii(column1)
----------------------------------------------------------------------------------------
kairosdb.datastore.write_size\x00\x00\x00\x01A\x0fw\xa0\x00buffer=data_points:host=JMOROSKI-DEV:
kairosdb.datastore.write_size\x00\x00\x00\x01A\x0fw\xa0\x00buffer=row_key_index:host=JMOROSKI-DEV:
kairosdb.datastore.write_size\x00\x00\x00\x01A\x0fw\xa0\x00buffer=string_index:host=JMOROSKI-DEV:
kairosdb.datastore.write_size\x00\x00\x00\x01A{\x9d,\x00buffer=data_points:host=JMOROSKI-DEV:
kairosdb.datastore.write_size\x00\x00\x00\x01A{\x9d,\x00buffer=row_key_index:host=JMOROSKI-DEV:
:
cqlsh:kairosdb> select blobAsAscii(column1) from data_points limit 10;
blobAsAscii(column1)
----------------------
\x00\x00\x00\x00
\x00\x00\x9c@
\x00\x018\x80
\x00\x01\xd4\xc0
\x00\x02q\x00
\x00\x03\r@
\x00\x03\xa9\x80
\x00\x04E\xc0
\x00\x04\xe2\x00
\x00\x05~@
. row_key_index data_points. . , , , row_key_index.column1, LIKE cql.