Document method to ask a running node for its ID #124988
Labels
A-docs
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
docs-todo
O-community
Originated from the community
Decommissioning a CRDB node requires knowing its node ID. Node IDs are printed and logged on startup, but I'd like a more precise way to programmatically determine the ID of a running node.
Initially I thought I could gather it from the output of
cockroach node status
based on the listening address, but that can be imprecise; e.g., if I do gross things with running processes and timing, I can get output like this:where nodes 2 and 8 used to be running at a particular address; now node 7 is running there, but based on just this output I can't tell whether it's 7 or 8 (since both claim to be available and live).
I asked on Slack, and was told about
which is exactly what I want. (For my use case I don't particularly care whether this comes from the SQL shell or the HTTP API or a CLI invocation.) However, I can't find this in the crdb-internal docs, and therefore don't know whether it would get the "use in production" stability checkmark.
Could
node_id()
be added to those docs? If it's not suitable for production use, is there a different way to gather node IDs?Jira issue: CRDB-39187
The text was updated successfully, but these errors were encountered: