Manages Cassandra replication: replication factors, keyspace strategies, endpoint mapping, and consistency levels.
Agentic Workflow: Read -> Reason -> Act (cassandra-replication)
You are Cassandra Replication (api/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for cassandra-replication
- Domain: Manages Cassandra replication: replication factors, keyspace strategies, endpoint mapping, and consistency levels.
- keyspace-replication: Set and inspect replication configuration. —
cqlsh -e "DESCRIBE KEYSPACE mykeyspace"
- endpoints: Map partition keys to replicas. —
nodetool getendpoints mykeyspace users 42
- consistency: Set and test consistency levels. —
cqlsh -e "CONSISTENCY QUORUM"
- Check
knowledge and prerequisites: cqlsh, nodetool
2. Reason — think for cassandra-replication
- For
keyspace-replication: Set and inspect replication configuration. — decide which checks to run
- For
endpoints: Map partition keys to replicas. — decide which checks to run
- For
consistency: Set and test consistency levels. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with cassandra-replication tools
- Tools:
Glob, Grep, Read, Cqlsh, Nodetool (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
cassandra-replication:b9041e6b
Cassandra Replication
What this skill does
Manages Cassandra replication: setting replication factors per datacenter, mapping partition keys to replicas, and testing consistency levels with tracing.
When to use
- Adding a datacenter or changing RF
- Debugging 'unavailable' errors
- Understanding which nodes hold a partition
Real commands
# Inspect replication
cqlsh -e "DESCRIBE KEYSPACE mykeyspace"
cqlsh -e "SELECT keyspace_name, replication FROM system_schema.keyspaces"
# Change RF
cqlsh -e "ALTER KEYSPACE mykeyspace WITH replication = {'class':'NetworkTopologyStrategy','dc1':3,'dc2':3}"
# Map a key to replicas
nodetool getendpoints mykeyspace users 42
# Test consistency
cqlsh -e "CONSISTENCY QUORUM; SELECT COUNT(*) FROM mykeyspace.users"
cqlsh -e "TRACING ON; SELECT * FROM mykeyspace.users WHERE id=42"
RF and CL math
- QUORUM = (RF/2) + 1 per DC (LOCAL_QUORUM)
- For RF=3: QUORUM needs 2 replicas
- EACH_QUORUM: quorum in every DC
Testing
- getendpoints shows expected replica count = RF
- Trace queries to see contact points and read repair
Best practices
- Use NetworkTopologyStrategy in production
- Run nodetool repair after RF changes
- Prefer LOCAL_QUORUM over QUORUM in multi-DC
Capabilities
keyspace-replication
Set and inspect replication configuration.
Parameters:
keyspace (string): Keyspace name
dc_replication (string): Per-DC RF map
strategy (string): NetworkTopologyStrategy or SimpleStrategy
Commands:
cqlsh -e "DESCRIBE KEYSPACE mykeyspace"
cqlsh -e "ALTER KEYSPACE mykeyspace WITH replication = {'class':'NetworkTopologyStrategy','dc1':3,'dc2':3}"
cqlsh -e "SELECT keyspace_name, replication FROM system_schema.keyspaces"
cqlsh -e "CREATE KEYSPACE mykeyspace WITH replication = {'class':'NetworkTopologyStrategy','dc1':3}"
cqlsh -e "SELECT keyspace_name, replication, durable_writes FROM system_schema.keyspaces WHERE keyspace_name='mykeyspace'"
Examples:
- cqlsh -e "ALTER KEYSPACE mykeyspace WITH replication = {'class':'NetworkTopologyStrategy','dc1':3,'dc2':3}"
- cqlsh -e "SELECT keyspace_name, replication FROM system_schema.keyspaces"
- cqlsh -e "CREATE KEYSPACE app WITH replication = {'class':'SimpleStrategy','replication_factor':2}"
endpoints
Map partition keys to replicas.
Parameters:
keyspace (string): Keyspace
table (string): Table
partition_key (string): Partition key value
Commands:
nodetool getendpoints mykeyspace users 42
nodetool status
nodetool status -r
nodetool gossipinfo
nodetool ring | grep -E 'dc1|dc2'
Examples:
- nodetool getendpoints mykeyspace users 42
- nodetool ring | head -20
- nodetool status -r
consistency
Set and test consistency levels.
Parameters:
consistency (string): Consistency level
trace (boolean): Enable tracing
Commands:
cqlsh -e "CONSISTENCY QUORUM"
cqlsh -e "CONSISTENCY LOCAL_QUORUM"
cqlsh -e "CONSISTENCY ONE; SELECT COUNT(*) FROM mykeyspace.users"
cqlsh -e "TRACING ON; SELECT * FROM mykeyspace.users WHERE id=42"
nodetool tpstats | grep -E 'ReadRepair|Read'
Examples:
- cqlsh -e "CONSISTENCY QUORUM; SELECT * FROM mykeyspace.users WHERE id=42"
- cqlsh -e "TRACING ON; SELECT * FROM mykeyspace.users WHERE id=42"
- cqlsh -e "CONSISTENCY EACH_QUORUM; SELECT COUNT(*) FROM mykeyspace.users"
References
1---2name: "cassandra-replication"3description: "Manages Cassandra replication: replication factors, keyspace strategies, endpoint mapping, and consistency levels. Use when working with keyspace replication, endpoints, consistency, api or when the user mentions keyspace replication, endpoints, consistency, api."4license: "MIT"5compatibility: "Requires cqlsh, nodetool."6metadata:7 source: https://skillmd.com/skills/opknock/cassandra-replication8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(cqlsh:*) Bash(nodetool:*)"12---1314Manages Cassandra replication: replication factors, keyspace strategies, endpoint mapping, and consistency levels.1516## Agentic Workflow: Read -> Reason -> Act (cassandra-replication)1718You are **Cassandra Replication** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `cassandra-replication`21- Domain: Manages Cassandra replication: replication factors, keyspace strategies, endpoint mapping, and consistency levels.22- **keyspace-replication**: Set and inspect replication configuration. — `cqlsh -e "DESCRIBE KEYSPACE mykeyspace"`23- **endpoints**: Map partition keys to replicas. — `nodetool getendpoints mykeyspace users 42`24- **consistency**: Set and test consistency levels. — `cqlsh -e "CONSISTENCY QUORUM"`25- Check `knowledge` and `prerequisites: cqlsh, nodetool`2627### 2. Reason — think for `cassandra-replication`28- For `keyspace-replication`: Set and inspect replication configuration. — decide which checks to run29- For `endpoints`: Map partition keys to replicas. — decide which checks to run30- For `consistency`: Set and test consistency levels. — decide which checks to run31- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3233### 3. Act — execute with `cassandra-replication` tools34- Tools: `Glob`, `Grep`, `Read`, `Cqlsh`, `Nodetool` (see frontmatter `tools`/`allowed-tools`)35- Use `safe_path` for any write; record evidence (paths, checksums)36- Fingerprint: `cassandra-replication:b9041e6b`3738# Cassandra Replication3940## What this skill does4142Manages Cassandra replication: setting replication factors per datacenter, mapping partition keys to replicas, and testing consistency levels with tracing.4344## When to use4546- Adding a datacenter or changing RF47- Debugging 'unavailable' errors48- Understanding which nodes hold a partition4950## Real commands5152```bash53# Inspect replication54cqlsh -e "DESCRIBE KEYSPACE mykeyspace"55cqlsh -e "SELECT keyspace_name, replication FROM system_schema.keyspaces"5657# Change RF58cqlsh -e "ALTER KEYSPACE mykeyspace WITH replication = {'class':'NetworkTopologyStrategy','dc1':3,'dc2':3}"5960# Map a key to replicas61nodetool getendpoints mykeyspace users 426263# Test consistency64cqlsh -e "CONSISTENCY QUORUM; SELECT COUNT(*) FROM mykeyspace.users"65cqlsh -e "TRACING ON; SELECT * FROM mykeyspace.users WHERE id=42"66```6768## RF and CL math6970- QUORUM = (RF/2) + 1 per DC (LOCAL_QUORUM)71- For RF=3: QUORUM needs 2 replicas72- EACH_QUORUM: quorum in every DC7374## Testing7576- getendpoints shows expected replica count = RF77- Trace queries to see contact points and read repair7879## Best practices8081- Use NetworkTopologyStrategy in production82- Run nodetool repair after RF changes83- Prefer LOCAL_QUORUM over QUORUM in multi-DC8485## Capabilities8687### keyspace-replication88Set and inspect replication configuration.8990**Parameters:**91- `keyspace` (string): Keyspace name92- `dc_replication` (string): Per-DC RF map93- `strategy` (string): NetworkTopologyStrategy or SimpleStrategy9495**Commands:**96- `cqlsh -e "DESCRIBE KEYSPACE mykeyspace"`97- `cqlsh -e "ALTER KEYSPACE mykeyspace WITH replication = {'class':'NetworkTopologyStrategy','dc1':3,'dc2':3}"`98- `cqlsh -e "SELECT keyspace_name, replication FROM system_schema.keyspaces"`99- `cqlsh -e "CREATE KEYSPACE mykeyspace WITH replication = {'class':'NetworkTopologyStrategy','dc1':3}"`100- `cqlsh -e "SELECT keyspace_name, replication, durable_writes FROM system_schema.keyspaces WHERE keyspace_name='mykeyspace'"`101102**Examples:**103- cqlsh -e "ALTER KEYSPACE mykeyspace WITH replication = {'class':'NetworkTopologyStrategy','dc1':3,'dc2':3}"104- cqlsh -e "SELECT keyspace_name, replication FROM system_schema.keyspaces"105- cqlsh -e "CREATE KEYSPACE app WITH replication = {'class':'SimpleStrategy','replication_factor':2}"106107### endpoints108Map partition keys to replicas.109110**Parameters:**111- `keyspace` (string): Keyspace112- `table` (string): Table113- `partition_key` (string): Partition key value114115**Commands:**116- `nodetool getendpoints mykeyspace users 42`117- `nodetool status`118- `nodetool status -r`119- `nodetool gossipinfo`120- `nodetool ring | grep -E 'dc1|dc2'`121122**Examples:**123- nodetool getendpoints mykeyspace users 42124- nodetool ring | head -20125- nodetool status -r126127### consistency128Set and test consistency levels.129130**Parameters:**131- `consistency` (string): Consistency level132- `trace` (boolean): Enable tracing133134**Commands:**135- `cqlsh -e "CONSISTENCY QUORUM"`136- `cqlsh -e "CONSISTENCY LOCAL_QUORUM"`137- `cqlsh -e "CONSISTENCY ONE; SELECT COUNT(*) FROM mykeyspace.users"`138- `cqlsh -e "TRACING ON; SELECT * FROM mykeyspace.users WHERE id=42"`139- `nodetool tpstats | grep -E 'ReadRepair|Read'`140141**Examples:**142- cqlsh -e "CONSISTENCY QUORUM; SELECT * FROM mykeyspace.users WHERE id=42"143- cqlsh -e "TRACING ON; SELECT * FROM mykeyspace.users WHERE id=42"144- cqlsh -e "CONSISTENCY EACH_QUORUM; SELECT COUNT(*) FROM mykeyspace.users"145146## References147- [Cassandra Dynamo Architecture](https://cassandra.apache.org/doc/latest/cassandra/architecture/dynamo.html)148- [Cassandra Consistency](https://cassandra.apache.org/doc/latest/cassandra/architecture/guarantees.html)149- [nodetool getendpoints](https://cassandra.apache.org/doc/latest/cassandra/operating/nodetool/)