cockroachdb-operator-patterns

A set of operating procedures for CockroachDB, a distributed SQL database that runs across multiple servers. It covers routine maintenance, monitoring, troubleshooting, backups, upgrades, and emergency response.

In plain words
What is it for?
Use it to prepare a cluster for production, monitor its health, investigate performance or hardware issues, manage backups and changefeeds, plan capacity, and handle upgrades or emergencies.
Why use it?
It gives operators practical checks and runbooks for keeping a database cluster reliable and diagnosing problems such as contention, hardware failures, or capacity limits.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/cockroachdb/cursor-plugin/cockroachdb-operator-patterns
Clone the repo
git clone --depth 1 https://github.com/cockroachdb/cursor-plugin
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 4,333 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.04333
Opus 5 $0.00000 $0.02167
Sonnet 5 $0.00000 $0.00867
Haiku 4.5 $0.00000 $0.00433

Measured yesterday against content hash 566e39923aca, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

cockroachdb-operator-patterns scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

2. Remove the store directory: `rm -rf <store-path>`
rules/cockroachdb-operator-patterns.mdc · 500 lines

How it starts

The opening of the file, as written. The whole thing — 500 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CockroachDB Operator & SRE Patterns

Operational procedures from the CockroachDB Runbook Template, Query Parallelism, and cockroachdb-best-practices-demo.


1. Day-1 Operational Readiness

Before operating a CockroachDB cluster, verify this checklist:

Check Requirement
Clock sync NTP configured on all nodes, --max-offset set (default 500ms)
Load balancer HAProxy or cloud LB in front of all nodes
Connection pooling Configured per app (4 x vCPUs pool size)
Replication factor 3 for zone survival, 5 for region survival
Storage Dedicated SSDs for CockroachDB store directory
One node per OS/container Never run multiple cockroach processes on same host
DBA role Custom role with appropriate grants (never use root in production)
TLS certificates Generated and distributed; sslmode=verify-full enforced
Backup schedule Automated via CREATE SCHEDULE FOR BACKUP
Monitoring Metrics exported to Prometheus/Datadog/Grafana
Alerting Alert rules configured per Section 4 thresholds

Key terms:

  • Node = one cockroach server process (NOT the VM/container)
  • Cluster = set of connected CockroachDB nodes forming one system
  • Range = ~512MB chunk of data, the unit of replication and distribution

2. Pre-Check Before Any Maintenance

✅ ALWAYS: Run these before ANY maintenance operation

-- Verify all nodes are live and available
SELECT node_id, is_live, is_available FROM crdb_internal.gossip_nodes;

-- Check for running jobs that might conflict
SELECT job_id, job_type, description, status, fraction_completed
FROM crdb_internal.jobs WHERE status = 'running';

-- Verify range health
SELECT count(*) AS total_ranges,
       count(*) FILTER (WHERE array_length(replicas, 1) < 3) AS under_replicated
FROM crdb_internal.ranges;

Read the full file on GitHub · 500 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 500 lines · 0 tokens per session scan C 566e39923aca

Subscribe to this mod's changes

cockroachdb-operator-patterns is a cursor rule published in the GitHub repository cockroachdb/cursor-plugin (1 stars, last pushed 1mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 4,333 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.