liveBook · Manning

Keyspace

As explained in Spring in Action, Sixth Edition

A Cassandra keyspace is a namespace that groups tables and defines replication-related settings for them.

A keyspace is Cassandra’s namespace for grouping tables. It also defines how Cassandra replicates the data stored in those tables, so Spring Data Cassandra needs a keyspace name before repositories can operate. section 4.1.1

A keyspace setup provides several practical decisions:

  • Name the keyspace that repositories will use, such as tacocloud. section 4.1.1 section 13.3
  • Choose a replication strategy and factor. SimpleStrategy with a factor of 1 keeps one copy of each row and suits a single-data-center demonstration. section 4.1.1
  • Create the keyspace before connecting the application, usually through Cassandra’s CQL shell. section 4.1.1 section 13.3

Creating the Taco Cloud keyspace

Run the CQL shell against the Cassandra cluster, then create a keyspace with simple replication and durable writes: create keyspace tacocloud with replication={'class':'SimpleStrategy', 'replication_factor':1} and durable_writes=true. Point Spring Data Cassandra at tacocloud using the cassandra.keyspace-name setting. section 4.1.1 section 13.3

cqlsh> create keyspace tacocloud
   ... with replication={'class':'SimpleStrategy', 'replication_factor':1}
   ... and durable_writes=true;

Inspect the complete CQL statement for creating a single-node development keyspace. section 4.1.1

How Spring in Action, Sixth Edition covers it

How deep it goes
Defines table grouping, creation, replication choices, and application configuration, but stops short of detailed cluster topology.
Examples
Uses the tacocloud keyspace, CQL shell creation, SimpleStrategy, replication factor 1, and Spring YAML configuration.
What it assumes
Assumes a running Cassandra cluster and introduces keyspace creation through Docker, CQL, and Spring configuration.
What you can do after
Operate/configure a Cassandra keyspace for Spring Data Cassandra applications using CQL and application YAML.
How it connects
Connects Cassandra tables, replication strategies, CQL, Spring Data Cassandra, repositories, and application configuration.

Also explained in

Compare how 2 books explain keyspace →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.