CockroachDB Monitoring Basics
CockroachDB exposes a node health endpoint:
GET https://node:8080/health?ready=1
Returns 200 when ready, 503 when not. Monitor each node with Vigilmon.
Application Query Tracking
const { Pool } = require('pg');
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
async function query(sql, params) {
const start = Date.now();
const client = await pool.connect();
try {
const result = await client.query(sql, params);
if (Date.now() - start > 100) console.warn('slow query: ' + (Date.now() - start) + 'ms');
return result;
} finally {
client.release();
}
}
Key Prometheus Metrics
From each node at /_status/vars:
-
ranges_underreplicated- alert if above 0 -
liveness_livenodes- should match cluster size
Monitor with Vigilmon for instant alerts on node failures.
Top comments (0)