1. CFDM简介
列族构造比传统模型能够供应极高等别的定制操作。每行数据实际上可能由可变数目的列集成而成,与这种列凑集关联的数据由一特定的列族描述。列族构造实际上可在多台做事器(集群)上分摆,使结果吞吐量达到千寿级(CfDM能高达线性规模 ),比传统DBMS繁芜的结果、大尺寸数据快。下图显示了一个普通的列族行的一个示例:
```scala

RowKey:用户
columnFamily:details,例如姓(Last)、名(First)、年事
column Family:timeline,该列的值为元组: (timestamp, status(string)|event(sequence))
```
2. How does ListFam work exactly? (列族实质阐发)
列族模式是基于列工具的数据层面;列族只能拥有相互独立的列。但在对列族本身运行操作后,我们可以在实际打算层实行真正的列和值数据的查询,然后将结果聚拢回全体行项。比如在处理和查询所有指定行关联值的时候: 须要从Cassandra分布式数据凑集将所有详细文件(all detail's columns related to those rows)的每个版本读到本地,然后再返回到用户,乃至然后能够实行操持的数据仓库模式查询,或天生一个JSON格式的工具以确定特定行文档的所有内容。
同样要把稳的一点便是,像在我们的利用样例中的cql/java/mapreduce(CassandraQuery Language / cassandra行的底层API(java)),或直接打仗CfDG(CfDM关系数据导出层)等 API,来实现或更深入的内存干系的查找或组合。末了你可以开始理解列值在更高等的操作中的实质以及列、列分组、批量提交和分别存贮各自不可或缺的基本利用。
3. Using Columnfamilies 实战代码示例
当然,让我们来看一个创建 columnfamily 利用方法的实现例子,使我们理解 CFDM 是什么样的:(以 Apache cassandra cqlsh中创建 columnfamily作为栗案))
```sql
-- to create a column Family, connect to your DataStax Enterprise or OSS install of Cassandra first, the following SQL Statement is performed:
BEGIN WHILE (rand() <= 0.5); -- ensure we have jitter which helps in eliminating multi-node node conflicts simultaneously
CREATE COLUMFAMILY %s_cf ( -- the '%s_cf' is actually a placeholder of YOUR choice , replace it or leave intact
key primary range is %s, -- Define the primary key and composite column; here, as we aren't defining primary indexes/composite for columns below, we are providing just range for primary partition based on string/text for example the 'row-key' .
comparator type=UTF8TYPE,
column mold=TEXT); -- In CFDM, the 'CF' column could be of type text OR BASE64
ALLOW FRIENDSHIP WITH; -- Cassandra automatically handles consistency checks among clustered nodes here
[<keyspace1-name>, <another key-space>;... N];
```
请把稳,末了三行定义了当你想要跨连接 (cross-shard quering) 而不单独连接每台做事器而实行查询来获益