liveBook · Manning

Replication strategy

As explained in ScyllaDB in Action

A replication strategy is a database configuration algorithm that determines which nodes store replicas of each partition.

A replication strategy determines which nodes store replicas of each partition. NetworkTopologyStrategy accounts for datacenters and racks, placing replicas across failure domains instead of treating the cluster as a flat ring. section 5.2.2

NetworkTopologyStrategy places replicas by following this process:

  • Assign each datacenter a replication factor. section 5.2.2
  • Locate the partition on the ring and identify its owning node in each datacenter. section 5.2.2
  • Select the next node in the same datacenter but a different rack, then continue until the datacenter’s replication factor is satisfied. section 5.2.2

Creating a topology-aware keyspace

This configuration gives datacenter1 three replicas for each partition: CREATE KEYSPACE reviews WITH replication = { 'class': 'NetworkTopologyStrategy', 'datacenter1': '3'};. With three racks, the placement can tolerate an entire rack failure; quorum-based consistency can continue serving traffic. section 5.2.2

Listing 5.1 Creating your keyspace
cqlsh> CREATE KEYSPACE reviews WITH replication = {
    'class': 'NetworkTopologyStrategy', 'datacenter1': '3'};

Use the runnable CQL listing to configure a keyspace with NetworkTopologyStrategy. section 5.2.2

How ScyllaDB in Action covers it

How deep it goes
Explains rack-aware replica selection and datacenter replication, while deferring consistency options and topology configuration details.
Examples
Uses a two-datacenter, three-rack topology and a CQL keyspace configured with three replicas in datacenter1.
What it assumes
Assumes familiarity with partitions and nodes, while introducing datacenter- and rack-aware replica placement.
What you can do after
Operate/configure a ScyllaDB keyspace with NetworkTopologyStrategy and choose datacenter replication factors.
How it connects
Connects replication factor with partitions, datacenters, racks, keyspaces, and consistency levels.

Related concepts

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