...

/

Illustration: Partitioning

Illustration: Partitioning

Get a hands-on demonstration of partitioning by creating a keyspace and table, inserting data, and observing how the records are distributed across the nodes in the cluster.

Illustration

To demonstrate partitioning, let’s create a simple table and insert some rows to see how they are distributed around the cluster.

Creating container keyspace for the table

A keyspace holds a related set of tables and defines the number of nodes that store copies of each row.

Press + to interact
Creating a keyspace titled testkeyspace with replication factor 2
Creating a keyspace titled testkeyspace with replication factor 2

A replication_factor of 2 means each row of each table in this keyspace will be stored twice in the cluster—on two different nodes.

The USE <KEYSPACE> command selects the keyspace for all subsequent queries. Notice that cqlsh:>testkeyspace ...