Hi!
I am having trouble understanding the "column" terminology Cassandra
uses. I am developing in Ruby. I need to store data for vehicles which
will come in at different times and retrieve data for a specific
vehicle for specific slices of time. So each record could look like:
vehicle_id, { time => { 'sensor1' => 1000, 'sensor2' => 2000 } }
The actual insert:
@cas.insert(:ReportData, vehicle_id.to_s, { UUID.new.to_s => {
'sensor1' => 1000, 'sensor' => 2000 }})
The model:
<Keyspace Name="SensorMonitor">
<ColumnFamily Name="SensorData" CompareWith="TimeUUIDType"
CompareSubcolumnsWith="UTF8Type" ColumnType="Super"></ColumnFamily>
<ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
<ReplicationFactor>1</ReplicationFactor>
<EndPointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndPointSnitch>
</Keyspace>
I am trying to store this with a supercolumn. Can someone tell me:
1. Are "sensor1" and "sensor2" columns?
2. Is "time" a supercolumn?
3. Where is the "subcolumn"?
4. Which item would "CompareWith" refer to?
5. Which item would "CompareSubcolumnsWith" refer to?
Also, about time:
1. To store "time", must I use UUID.new.to_s as above?
2. Isn't a time key redundant? Can Cassandra return slices based on
the time it keeps for each record?
3. How do I get a time slice for a vehicle? I get various generic
"application" errors when trying to use get_range to get time ranges.
4. Any advice on this data model?
|