apache/cassandra · warning
Your replication factor {} for keyspace {} is higher than th
Error message
Your replication factor {} for keyspace {} is higher than the number of nodes {} for datacenter {} What it means
NetworkTopologyStrategy.maybeWarnOnOptions (via shouldWarnOnHigherReplicationFactorThanNodesInDC) warns when a keyspace's NetworkTopologyStrategy replication_factor for a datacenter exceeds the number of nodes actually present in that DC. The message goes both to the client (ClientWarn) and the server log. Extra replicas beyond node count silently cap at node count, so the warning points out configuration that does not do what the user expects.
Source
Thrown at src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java:409
Multimap<String, InetAddressAndPort> dcsNodes = directory.allDatacenterEndpoints();
for (Entry<String, String> e : this.configOptions.entrySet())
{
String dc = e.getKey();
ReplicationFactor rf = getReplicationFactor(dc);
Guardrails.minimumReplicationFactor.guard(rf.fullReplicas, keyspaceName, false, state);
Guardrails.maximumReplicationFactor.guard(rf.fullReplicas, keyspaceName, false, state);
int nodeCount = dcsNodes.containsKey(dc) ? dcsNodes.get(dc).size() : 0;
// nodeCount==0 on many tests
if (rf.fullReplicas > nodeCount && nodeCount != 0)
{
String msg = "Your replication factor " + rf.fullReplicas
+ " for keyspace "
+ keyspaceName
+ " is higher than the number of nodes "
+ nodeCount
+ " for datacenter "
+ dc;
ClientWarn.instance.warn(msg);
logger.warn(msg);
}
}
}
}
@Override
public boolean hasSameSettings(AbstractReplicationStrategy other)
{
return super.hasSameSettings(other) && ((NetworkTopologyStrategy) other).datacenters.equals(datacenters);
}
}
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Lower RF to the current node count, or bootstrap the planned nodes first.
- ALTER KEYSPACE ... WITH replication = {'class':'NetworkTopologyStrategy','dc1':'1'} then run a full repair to converge.
- Check nodetool status per DC to confirm actual node counts and DC names match the strategy keys.
- If nodes are planned, bootstrap them; the warning clears once nodeCount >= RF.
- Run repair after RF changes so data is fully replicated on the intended nodes.
Example fix
// before
ALTER KEYSPACE myks WITH replication = {'class':'NetworkTopologyStrategy','dc1':'3'}; -- dc1 has 1 node
// after
ALTER KEYSPACE myks WITH replication = {'class':'NetworkTopologyStrategy','dc1':'1'};
-- then: nodetool repair -full myks Defensive patterns
Strategy: validation
Validate before calling
// before ALTER KEYSPACE, verify RF fits the DC
Map<String,Integer> nodesPerDc = nodetoolStatusPerDc();
for (var e : requestedRfByDc.entrySet()) {
int have = nodesPerDc.getOrDefault(e.getKey(), 0);
if (e.getValue() > have)
throw new IllegalArgumentException("RF " + e.getValue() + " > " + have + " nodes in DC " + e.getKey());
} Prevention
- Run nodetool status and compare per-DC counts against strategy RF before schema changes.
- Check for client warnings (ClientWarn) when applying schema via drivers/cqlsh.
- Use dev/staging RF values distinct from prod; template them per environment.
- Verify DC name spelling in replication options matches cassandra-rackdc.properties.
When it happens
Trigger: CREATE/ALTER KEYSPACE WITH replication = {'class':'NetworkTopologyStrategy','dc1':'3'} when dc1 currently has fewer than 3 nodes; evaluated when strategy options are validated during schema operations.
Common situations: Bootstrap in progress: RF set for planned capacity before nodes arrive; typo'd DC name mapping RF onto a near-empty DC; copied prod schema with RF=3 applied to a 1-node dev/staging DC.
Related errors
- Cannot alter RF while some endpoints are not in normal state
- Missing replication strategy class
- Following datacenters have active nodes and must be present
- default_keyspace_rf (%d) cannot be less than minimum_replica
- default_keyspace_rf cannot be less than 1
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/f5883cecd8f994ad.
Report an issue: GitHub.