qua_cluster_preflight#

Checks whether the Querona instance the session is connected to is ready to join a two-node cluster, and returns one row per finding. It only reads: it changes nothing in the configuration, the metabase or the machine, so it can be run any number of times, also on an instance that serves clients.

Syntax#

qua_cluster_preflight
    [ [ @cluster_name = ] 'cluster_name' ]
    [ , [ @resolution_mode = ] 'resolution_mode' ]
    [ , [ @service_name = ] 'service_name' ] [;]

Arguments#

[ @cluster_name = ] ‘cluster_name’

The name clients use to reach the cluster, for example db-cluster.contoso.com, up to 256 characters; a trailing dot is dropped. Optional; without it, or with an empty value, the procedure checks the cluster name stored when the cluster was provisioned with qua_cluster_provision. When no name is known, the checks of the name’s DNS records and service principal name are skipped and the certificate is not checked for it; each of these rows says why. A name that differs from the stored one is checked as given, and the finding addressing.stored-cluster-name fails, because the cluster runs under the stored name. Names are compared ignoring case; a short name and its fully qualified form are different names.

[ @resolution_mode = ] ‘resolution_mode’

How the cluster name reaches the instance that serves clients. records (the default): the name has one address record per instance, and clients connect with MultiSubnetFailover=True. load_balancer: the name points to a load balancer.

[ @service_name = ] ‘service_name’

The Windows service that runs Querona. Optional; the default is queronaSvc, the name the installer gives it.

Result set#

Column

Type

Description

check_id

nvarchar(128)

Identifier of the finding, for example metabase.ha-model.

status

nvarchar(10)

PASS, WARN, FAIL or SKIPPED. Do not enable cluster mode while any finding is FAIL.

message

nvarchar(max)

What was found.

remedy

nvarchar(max)

What to do about it, or NULL.

A check that fails is returned as a row, not raised as an error, so one call reports every problem. No finding contains a password or a key.

The checks see the configuration the instance runs with. After changing the instance configuration file, restart the instance before running the procedure again.

Checks#

check_id

Fails when

Also at start

metabase.engine

The instance has no metabase connection string, or the metabase is not on SQL Server.

Yes

metabase.encryption

The metabase connection is not encrypted, or does not validate the server certificate.

Yes

metabase.ha-model

The metabase database is mirrored without SAFETY FULL, or its availability group has fewer than two synchronous-commit replicas. Warns when the metabase has no high availability, or its replicas are not visible to the login.

Yes

metabase.failover-partner

The connection string names Failover Partner for a metabase in an availability group, or names none for a mirrored metabase. Warns when it names another server than the mirror, or names one for a database that is not mirrored. The mirror’s short name and its fully qualified name (SQL-B and SQL-B.contoso.com) both name the mirror. Also warns when the principal does not report its partner, so the name was not compared.

Yes

metabase.multi-subnet-failover

Warns when a metabase in an availability group is reached without MultiSubnetFailover=True.

Yes

metabase.clock-servers

The clocks of the metabase servers - the principal and the mirror, or the replicas - differ by more than 5 seconds. Warns when a server’s clock could not be read. Each server is reached on its master database with the instance’s own metabase credentials and encryption, at an address chosen as described in Remarks.

Yes

metabase.clock-node

Warns when the instance’s own clock differs from the metabase server’s by more than 5 seconds.

Yes

node.master-key

The instance cannot open the instance master key.

Yes

node.master-key-portable

The instance master key has no password-protected copy that the other node can open.

Yes

node.legacy-secrets

Stored credentials remain under the shared secret instead of the instance master key, or the stored credentials cannot be counted. Only warns about remaining credentials on an instance set up as a pilot (ClusterPilotMode).

Yes

node.shared-secret

Warns when the shared secret is missing or weak. On a cluster node that is not a pilot, which does not use it while it runs, warns only when it is missing and the instance reaches its metabase with SQL authentication, because an upgrade of such an instance needs it. With any other authentication, Windows authentication for example, the row is skipped; an upgrade that switches the metabase connection to SQL authentication still needs the shared secret.

Yes

node.providers, node.odbc, node.jdbc, node.file-paths, node.job-subsystems

Something a stored connection or job step names outside the metabase is missing on this instance: a provider, an ODBC driver or data source, a JDBC driver file, a local file or folder, or the tool of a job step subsystem.

Yes

node.unreadable-connections

Warns when stored connections could not be read on this instance, so their drivers and paths were not checked.

Yes

node.clock-correction

Warns when the instance runs on a Hyper-V virtual machine whose clock the host does not correct after a pause or a save: the Time synchronization integration service or the Windows Time provider it feeds is disabled. Skipped on a computer that is no Hyper-V virtual machine.

Yes

node.spark-warehouse

A Spark instance on a cluster node keeps its warehouse in a folder of the node instead of on storage both nodes reach under one path, or the instance cannot reach that storage.

Yes

node.dynamic-ports

The instance’s TDS, Web or administrative HTTP port lies in the TCP dynamic port range and is not excluded from it, lies in an exclusion another component made, or another process listens on it.

Yes

node.child-process-ports

Warns about the same for the ports of the Data API instances and Spark drivers the serving instance starts automatically, and about a port two of the instance’s ports name.

Yes

targets.pinned-connections, targets.network-connections, targets.execute-on

A connection is pinned to one instance, a connection’s network of instances is not exactly the two cluster nodes, or a view, function or job step uses OPTION (EXECUTE_ON ...). Cluster mode refuses all three.

No

addressing.cluster-name

The cluster name is this computer’s name or an alias, or does not resolve; with records, it does not resolve to exactly two addresses, one of them this computer’s; with load_balancer, it resolves to this computer.

No

addressing.spn

MSSQLSvc/<cluster name>:<TDS port> is registered for no account, for several, or for another account than the service’s, or the service runs as a built-in machine account. Warns when that account is not a group managed service account.

No

addressing.certificate

The instance’s certificate is missing, has no private key, is not valid now, is not for server authentication, or does not carry the cluster name in its subject alternative names. Warns when it expires within 30 days.

Yes

addressing.stored-cluster-name

The @cluster_name given differs from the stored cluster name, the metabase holds more than one cluster, or the stored name cannot be read or is not a usable DNS name.

Yes

Also at start: an instance in cluster mode runs the check at every start as well and writes the finding into its log (see Remarks).

Remarks#

Run the procedure on the first instance, whose metabase becomes the cluster’s, before cluster mode is switched on. The second instance is installed on a metabase of its own, which it leaves when it joins the cluster; there, read only the rows addressing.cluster-name, addressing.spn and addressing.certificate (the cluster name, the service principal name and the certificate), and give the same @cluster_name. The row addressing.stored-cluster-name is skipped there, because that metabase carries no cluster.

The checks that depend on the cluster’s metabase - the rows starting with metabase. and node., the certificate and the stored cluster name - also run every time an instance starts in cluster mode. The instance writes each finding into its log as a line starting with Cluster: preflight, followed by a summary line; a finding does not stop the start. Look for these lines after the second instance’s first start in cluster mode. The certificate is the one the cluster’s metabase names for the instance, so give the second instance’s certificate thumbprint when the cluster is provisioned, and it must carry the cluster name stored at provisioning.

The row metabase.clock-servers reads the clock of every other metabase server - the mirror, or each replica of the availability group - over a connection of its own to that server’s master database. The metabase reports these servers by their short names (SQL-B, SQL-B\INSTANCE), and the connection validates the server certificate, which usually carries only the fully qualified name. The check therefore dials the first of these addresses that applies, once:

  • the Data Source of the instance’s metabase connection string, or for a mirror its Failover Partner, when it names that server, port included;

  • when the connection validates the server certificate (Encrypt=Strict, or Encrypt not False without TrustServerCertificate=True), the host of the server’s database mirroring endpoint (endpoint_url in sys.availability_replicas, mirroring_partner_name in sys.database_mirroring) when it is the server’s fully qualified name;

  • when the connection validates the server certificate and names no HostNameInCertificate - a certificate name given there is validated whatever is dialled - the short name followed by the DNS suffix of the Data Source, when that is a fully qualified name;

  • the short name.

A named instance keeps its instance name and is found through the SQL Server Browser service. The endpoint’s port is the mirroring port and is never used, and a chosen name carries no port, so a default instance is dialled on port 1433. When the mirroring endpoints use a network or DNS domain of their own that the instances cannot reach, name the endpoints by the servers’ client names, or expect the row to warn. Server SPN and Failover Partner SPN name the metabase address and are not used for these connections. HostNameInCertificate is kept for every server: the instance validates whichever server serves the metabase against it - an asynchronous replica too, after a forced failover - so each server is checked as the instance would check it after a failover. The row names the address it dialled when it differs from the short name. When the connection fails with “The target principal name is incorrect”, the server’s certificate does not carry the name it is validated against - the HostNameInCertificate, or else the host name dialled - or, with Windows authentication, no service principal name MSSQLSvc/<host> with the server’s port or instance belongs to its service account; the row warns that the clock was not compared and names both. An address that names a port and no instance, such as tcp:SQL-B.contoso.com,14331, reaches whichever instance listens on that port, so it may or may not reach a named instance of that host: the check dials it only when no configured address names the server exactly and no other reaches its host by a port, and metabase.failover-partner warns that it could not confirm the mirror.

The row node.dynamic-ports fails when the instance’s TDS, Web or administrative HTTP port cannot be relied on: it lies in the TCP dynamic port range of Windows, of IPv4 or of IPv6, and is not excluded from it; it lies in an exclusion another component made (one netsh lists without *, HTTP.sys’s for example); or another process listens on it. The row node.child-process-ports reports the same, and a port two of the instance’s ports name, for the Data API instances and the Spark drivers the serving instance starts automatically, as a warning: the instance serves without them, and only that process fails to start. Outside cluster mode a Data API instance and a persistent Spark driver keep running when the instance stops, so one the instance runs, or recovered after a restart, would still hold its port in cluster mode, which takes no such process over; the row reports it, and you stop it before cluster mode is switched on. The remedy names the netsh command that excludes each port of the range, and the installation procedure says why the ports must stay out of it. Both rows are skipped on an instance that does not run on Windows.

An instance in cluster mode does not start while the other instance still runs outside cluster mode, as the first instance does after the cluster is provisioned until it is restarted: restart the first instance in cluster mode before you start the second one. The instance recognizes the other one by its sessions in the metabase database, from the other instance’s host under the Application Name of its own metabase connection, so give both instances the same Application Name (the installer does). To see those sessions, the metabase login needs VIEW SERVER STATE or, on SQL Server 2022 and later, VIEW SERVER PERFORMANCE STATE; without either, the instance starts and writes a warning that it could not check.

Permissions#

Requires the CONTROL SERVER permission.

Example#

Checks the instance against the cluster name db-cluster.contoso.com. The procedure returns every finding; the rows with status FAIL or WARN are the ones that need attention.

EXEC qua_cluster_preflight @cluster_name = N'db-cluster.contoso.com';

After the cluster is provisioned, the first instance checks the stored cluster name without the argument. Give the resolution mode when the name points to a load balancer.

EXEC qua_cluster_preflight;
EXEC qua_cluster_preflight @resolution_mode = N'load_balancer';

See Also#