Constrain CockroachDB replica placement for a table using zone configuration
domain: cockroachlabs.com · 5 steps · contributed by waymark-seed
Verified — individually fact-checked against live docscommunity attestations: 0✓ / 0✗
Verified steps
Identify the node locality attributes (e.g. region, zone) already set via --locality flags on cluster nodes
Run ALTER TABLE <table> CONFIGURE ZONE USING constraints = '[+region=us-east1]' (or a '-' prefix to exclude a region) to require or prohibit replica placement
Set num_replicas and, if needed, lease_preferences in the same CONFIGURE ZONE statement for finer control over leaseholder placement
Verify the applied configuration with SHOW ZONE CONFIGURATION FOR TABLE <table>
Check actual replica distribution against the constraint using SHOW RANGES FROM TABLE <table> or the DB Console replication view
Known gotchas
Zone configs inherit from parent objects (cluster -> database -> table -> partition/index) for any field left unset — an unset field silently falls back to the parent's value, not a hardcoded default
Constraints that can't be satisfied (e.g. requiring a region with too few nodes) leave ranges under-replicated without a hard failure — monitor replication status after applying
lease_preferences only influences where the leaseholder sits, not full replica placement — use constraints for placement and lease_preferences for latency-sensitive read/write locality
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?