【问题标题】:Retrieve all the columnfamily / tables of thrift and CQL from the keyspace in cassandra从 cassandra 的键空间中检索 thrift 和 CQL 的所有列族/表
【发布时间】:2015-10-26 14:14:33
【问题描述】:

我使用 hector 来操作 2.1.8 版的 cassandra,并希望从应用程序的某个键空间中检索所有表。我使用“KeyspaceDefinition.getCfDefs()”来检索键空间中的列族列表。

但是,我发现 getCfDefs() 函数只能检索由 thrift api 创建的列族,例如“me.prettyprint.hector.api.Cluster.updateColumnFamily”,但不能检索由 CQL 创建的表,例如 cqlsh 客户端。

那么,如何使用 hector 从某个 keyspace 中检索所有的表呢?

【问题讨论】:

标签: cassandra hector nosql


【解决方案1】:

您可以使用系统元数据表以编程方式检查键空间的所有表元数据:

select * from system.schema_columnfamilies where keyspace_name='ks';
select * from system.schema_columns where keyspace_name='ks';

您需要自己聚合这些列和表。

或者,如果您未绑定到此客户端,您可以使用 cqlsh 来“描述”有问题的键空间,或使用带有元数据 API 的 DataStax 驱动程序之一(javapython)。

【讨论】:

  • 谢谢亚当。我和其他人讨论过,发现一个 thrift 客户端看不到通过 CQL 创建的表。我正在考虑使用 CQL 而不是 hector。
猜你喜欢
  • 2016-09-16
  • 2015-03-15
  • 1970-01-01
  • 1970-01-01
  • 2012-01-15
  • 2013-08-27
  • 2014-04-18
  • 2013-03-23
  • 2013-01-05
相关资源
最近更新 更多