Node management page#

Each node of a two-node cluster serves a small page about itself: its role, the lease, its contact with the metabase, how far its metadata lags and the most recent cluster lines of its log. The page runs on the node whatever the other node does, so it shows the state of a standby, and of a node that cannot serve, when no node serves clients and the Administrative Portal is unreachable.

The page shows the node and changes one thing only: on a standby it takes the serving role over when the serving node is down (see Taking the serving role over). The state of both nodes, read from the metabase, is on the Cluster page of the node that serves clients.

Opening the page#

The page answers only connections that come over the loopback interface of the node’s computer. Sign in to the node’s host, for example over Remote Desktop, and open:

http://localhost:<administrative port>/

The administrative port is the one chosen in the installer for a cluster node, 8080 by default. Address the node as localhost, 127.0.0.1 or [::1]. Even on the node itself, the machine’s name or network address reaches the port through a network interface and gets 404, and another name that resolves to the loopback address gets 400.

From any other computer the page cannot be reached: the administrative port answers 404 to every path but the two anonymous health endpoints, /health/live and /health/ready (see Health endpoints), whatever the request says about its origin. To use the page or the script below from another computer, connect to the node’s host over Remote Desktop or PowerShell remoting (Invoke-Command), which bring their own authentication and encryption.

Signing in#

The page signs in by the same rules as TDS and the Administrative Portal, so a login that is locked out, disabled or restricted to trusted networks is refused here as it is there, and every sign-in is recorded in the logon tracking and the audit like any other.

  • A login and its password. For a login that requires multi-factor authentication, type the six-digit code from the authenticator app first and the password right after it, in the same field. A login that has not set up its authenticator after its grace period is refused here, because the page cannot set one up; sign in to the Administrative Portal to do it.

  • A Windows account. Sign in with my Windows account signs in the Windows user the browser runs as, through Negotiate, when that user has a Windows login in Querona, directly or through a Windows group.

Viewing the page requires the VIEW SERVER STATE permission. A login without it is told VIEW SERVER STATE permission was denied on object ‘server’, database ‘master’.

The sign-in lasts until Sign out, 15 minutes without a request, 8 hours in any case, a restart of the node, or until the login is dropped or disabled. It is kept in a cookie that carries no credential.

Signing in when no login works#

The Windows group login BUILTIN\Administrators, which every installation has and which holds the administrator role, lets an administrator of the node’s computer sign in when no other login can. Whether it admits an administrator depends on how that account is an administrator of the computer:

  • An account that is itself a member of the local Administrators group, or a member of a domain or local group that is itself a member of it, signs in with Sign in with my Windows account without elevation.

  • An account that is an administrator only through a group that User Account Control filters out of a non-elevated session, such as Domain Admins, is refused by the page: a browser always sends the filtered identity, even when it is started with Run as administrator. Such an administrator reads the node’s state with the script below from an elevated PowerShell session.

  • The members of the local Administrators group are read when Querona starts, so an account added to the group later is admitted only after the Querona service restarts.

User Account Control is not a security boundary for this sign-in: a program that runs as such an administrator can sign in without elevation.

The page#

Section

What it shows

Node

The state of the node’s coordinator, since when and why it entered it (Last transition reason), the coordinator’s generation (a counter that grows by one whenever the node starts a period of holding the lease and by one whenever it stops renewing - also at a fault or a shutdown without a lease; it is not a count of failovers), its role and operational state in the words SQL Server uses for an availability replica, the instance id, the cluster id, the incarnation (the identifier of the node’s current process), the fencing token the node holds and how long it may still act on it, whether the node runs as a pilot cluster node, and whether it can use the instance master key.

Metabase

Whether the metabase answered a test query within five seconds, how long it took or why it did not answer, when the node last wrote its state to the metabase, when the node’s coordinator last reached the metabase, when an outage still in progress began, and when the last outage the node saw began and ended and how long it lasted. An outage is any time the node could not reach the metabase, whether the metabase server failed over, the network failed or the server stopped.

Lease

The failover mode, the node that holds the lease, whether the lease was released, its fencing token, the number of role changes, its deadline by the metabase clock, whether it is still live and for how long, the end of the period in which an automatic takeover waits, and a planned failover in progress. When the metabase does not answer, the lease is not read; the section then shows the lease as the node last read it, with when it read it, how long ago and the coordinator state and generation at that read, under Live at the read and Valid for at the read, because every value is that of the read. When the metabase answers and the lease is missing, no earlier reading is shown. Both views also show when the holder acquired the lease, how long it had held it and the last automatic takeover.

Planned failover

Shown once the node has begun a planned failover: its operation id, the target instance, the login that asked for it, when it began and how long ago, the step it reached and since when, how many sessions still had work in flight - a running statement or an open transaction - when the drain ended, and why it failed or was cancelled.

Takeover

On the standby, the form that authorizes a takeover (see Taking the serving role over); on a node in any other state, a note that names the state.

Metadata

The metadata version the node loaded and when, the version in the metabase, and, while the node does not serve, how far it lags: Current, Behind with the number of changes, EarlierEpoch when it loaded a version from before the last change of the lease holder, or Unknown.

Client ports

Whether the TDS port and the cluster web port accept connections - they do only on the node that serves - and the last time the node closed a port with sessions: when, in which coordinator state, how many sessions it ended and how many were still closing.

Background tasks

The role the node last applied to its background tasks (None, Standby or Primary) and, for each task, where it may run, whether it is suspended or running, its last start and end, the error type and time of its last failure and how many runs in a row failed. The error message is not shown, because it can carry a secret; the log has it.

Recent Cluster: lines

The most recent lines of the node’s log that start with Cluster:, newest first, as the log file shows them - the role changes, the lease, the metabase connection, the ports, and a status line every five minutes. The page keeps the last 200 lines of the running process, at the level the log is configured to write; the log file keeps all of them.

Times are in UTC. Refresh reads the state again.

Reading the state from a script#

GET /node/state on the same port answers the same state as JSON, for a script that runs on the node’s computer. The script authenticates every request itself, either with its Windows account through Negotiate or with a login and its password through HTTP Basic, and needs VIEW SERVER STATE. Every request is a sign-in of its own, recorded and audited as one; a login that requires multi-factor authentication would need a new code in front of its password for every request, so a script uses a login that does not require it, or Negotiate. Because every request adds a logon and an audit event, a script that polls the state should do so at most once a minute; a load balancer or monitoring that only needs to know whether the node serves uses /health/ready instead, which needs no sign-in. A request without credentials, or with credentials that are refused, gets 401; a login without the permission gets 403; the body of both says why. The password crosses only the loopback interface of the node.

With the Windows account of the PowerShell session, elevated when the account is an administrator only through a filtered group:

Invoke-RestMethod -Uri http://localhost:8080/node/state -UseDefaultCredentials

With a login and its password (PowerShell 7):

$credential = Get-Credential
Invoke-RestMethod -Uri http://localhost:8080/node/state -Authentication Basic -Credential $credential `
    -AllowUnencryptedAuthentication

From another computer, run the same command on the node over PowerShell remoting:

Invoke-Command -ComputerName node-b.example.com -ScriptBlock {
    Invoke-RestMethod -Uri http://localhost:8080/node/state -UseDefaultCredentials
}

The answer carries readAtUtc, metabaseReachable, metabaseResponseTimeMilliseconds and metabaseError; isMasterKeyUsable, whether the node can use the instance master key; cluster, with the node’s own state and the lease under the names the health details use (see Health endpoints); metadataLag and metadataChangesBehind; and recentClusterLines, each with its timestamp, level and message.

Taking the serving role over#

In manual failover mode (see qua_cluster_set_failover_mode) a standby does not take the role over by itself when the serving node stops. Once you have checked that the serving node is really down, open the page on the standby, tick I have checked that the serving node is down. and choose Authorize the takeover. The takeover requires the CONTROL SERVER permission.

The node then tries to take the lease at once and at every attempt after that, and the page shows the authorization’s identifier, the time until which it acts, on the metabase server’s clock, and its status:

  • Pending - the node waits for the serving node’s lease to expire, at most the lease time to live (30 seconds by default), and then takes the role;

  • Acquired - the node took the role; it loads the metadata and opens its client ports;

  • Lost - the node did not take the role, because the serving node renewed its lease, released it, gave it up after a failure or another node took it since the authorization was first presented, or because its time passed.

An authorization acts only against the lease it first found, so it never takes the role from a serving node that is alive: authorize the takeover again after you have checked the serving node once more. A serving node that was stopped cleanly has released its lease; in manual mode it does not fail over by itself, and a takeover authorized after that stop takes the role. While one authorization is pending, authorizing again answers the same one. A takeover is refused on a node that is not waiting as the standby, and the page shows the form only there. Each authorization and its outcome write a line starting with Cluster: takeover into the node’s log. A planned move of the role, while both nodes run, is qua_cluster_failover on the serving node instead.

A node that cannot use the instance master key never takes the serving role by itself, in either failover mode and even when no node holds the lease: it would serve without being able to read any stored password or credential. It waits as the standby, and its log says the instance master key is not usable on this node. A standby accepts no client connection, so give it the key with the master key passphrase file and restart it (see Protect stored credentials); it then takes the role when it is allowed to. Authorizing a takeover on such a node makes it serve without the key; the page warns about it above the takeover form, and the script’s answer carries the warning. Authorize it only when a serving node without its stored secrets is better than no serving node.

A script authorizes a takeover with POST /node/takeover. The request must carry the header X-Querona-Takeover (any value), which a web page of another site cannot send, and authenticates itself as for the state read; it needs CONTROL SERVER. The answer carries operationId, notAfterUtc, isNew, status, isMasterKeyUsable and warning - the warning for a node that cannot use the instance master key, otherwise null. GET /node/takeover/<operationId> answers the authorization’s status - Pending, Acquired, Lost, NotFound or NotRead when the metabase cannot be read - and needs VIEW SERVER STATE. A refused takeover answers 409 with the reason.

$takeover = Invoke-RestMethod -Method Post -Uri http://localhost:8080/node/takeover -UseDefaultCredentials `
    -Headers @{ 'X-Querona-Takeover' = '1' }
Invoke-RestMethod -Uri "http://localhost:8080/node/takeover/$($takeover.operationId)" -UseDefaultCredentials

See also#