簡體   English   中英

從cassandra的鍵空間中檢索節儉和CQL的所有columnfamily /表

[英]Retrieve all the columnfamily / tables of thrift and CQL from the keyspace in cassandra

我使用hector來操縱2.1.8版的cassandra,並希望從應用程序中的某些鍵空間中檢索所有表。 我使用“ KeyspaceDefinition.getCfDefs()”來檢索鍵空間中的columnfamily列表。

但是,我發現getCfDefs()函數只能檢索由thrift api創建的columnfamily,例如“ me.prettyprint.hector.api.Cluster.updateColumnFamily”,而不能檢索由CQL創建的表,例如cqlsh客戶端。

然后,如何使用hector從某個鍵空間中檢索所有表?

您可以使用系統元數據表以編程方式檢查所有表元數據中的鍵空間:

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

您需要自己匯總這些列和表。

另外,如果您不依賴於此客戶端,則可以使用cqlsh來“描述”所討論的鍵空間,或者使用具有元數據API的DataStax驅動程序之一( javapython )。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM