Skip to content

KINGBASEES · CLI DIAGNOSTICS

kbdiag A verdict, the evidence, the next step

Command-line diagnostics for KingbaseES. One static binary runs a single read-only look at a live instance and tells you what it found, why, and which command to run next.

START WITH A QUESTION

What is this instance? Is anything stuck?

Command examples, not captured output. Build the binary and copy it to the database host first.

What is this instance? Is anything stuck?
# 1. What is this instance, and are connections running out?
~/kbdiag status

# 2. Is anyone waiting for a lock, and who blocks them?
~/kbdiag locks

# 3. Follow the verify line of a finding
~/kbdiag session <pid>

FIND YOUR STARTING POINT

Seven commands, six questions

Instance

Version, role, uptime, database sizes; WARN/FAIL when connections near the limit.

Instance

Sessions

Who is connected, who sits idle in transaction, and what one session is doing.

Sessions

Locks

Who waits for a lock and which session directly blocks them.

Locks

Transactions

Old open transactions and forgotten prepared (2PC) ones.

Transactions

Waits

Sessions grouped by wait event and state.

Waits

LOOK · QUERY · FOLLOW

Every finding tells you where to look next

01 / LOOK

Start with the facts

  • Is the instance reachable? What is its role? Are connections running out?
  • The exit code carries the verdict: 0 OK, 1 WARN, 2 FAIL, 3 UNKNOWN.
kbdiag
~/kbdiag status
echo $?

02 / QUERY

Look at one dimension

  • Sessions, locks, transactions, waits and slots each have their own command.
  • Every row is judged, even when –limit shortens what is shown.
kbdiag
~/kbdiag sessions
~/kbdiag locks
~/kbdiag txn

03 / FOLLOW

Follow the verify line

  • Each finding prints the next command to run, such as the blocker’s session.
  • Suggested fixes are printed, never run.
kbdiag
verify: kbdiag session 435308

Before you start

What do I need on the database host?

Only the binary. It speaks the wire protocol itself, so it does not need ksql or any runtime; connect over the local socket as the kingbase OS user.

Can it change my database?

No. Every connection is a read-only transaction with a lock_timeout. Suggested fixes such as ROLLBACK PREPARED are printed for you to review, never executed.

What about the old shell toolkit?

kbdiag 2.0 is a Go rewrite; this first release covers sessions, locks, transactions, waits, instance status and replication slots. The shell toolkit (v1.x) is frozen; use release v1.0.0 if you need its other commands.

Run your first checkBuild the static binary, copy it to a KingbaseES V8R6 host, and start with status and sessions.