使用hector
从cassandra cli中的列族中获取所有rowkeyval query=HFactory.createRangesliceQuery(keyspace,le,se,se)
query.setColumnFamily("myInfo").setKeys(Integer.MIN_VALUE,Integer.MAX_Value).execute()
OR
val query=HFactory.createRangesliceQuery(keyspace,le,se,se)
query.setColumnFamily("myInfo").setKeys(Integer.MIN_VALUE,Integer.MAX_Value).setRange("","",true,10).execute()
答案 0 :(得分:3)
这将有助于你
val rangeSlice = HFactory.createRangeSlicesQuery(keyspace, se, se, se)
rangeSlice.setColumnFamily("myInfo")
rangeSlice.setKeys(null, null)
rangeSlice.setRange(null, null, true, Int.MaxValue)
val bIterator = rangeSlice.execute().get.iterator()
while (bIterator.hasNext()) {
val myRow = bIterator.next()
val myKey = myRow.getKey()
println(myKey+"<<<this is key")
}
答案 1 :(得分:0)
val rangeSlice = HFactory.createRangeSlicesQuery(keyspace, se, se, se)
rangeSlice.setColumnFamily("myTable")
rangeSlice.setReturnKeysOnly();
val bIterator = rangeSlice.execute().get.iterator()
while (bIterator.hasNext()) {
val myKey =bIterator.next().getKey()
println(myKey+"<<<this is key")
}
它也会起作用