Cluster requirements#

A cluster needs a highly available metabase, two Windows servers that can run each other’s workload, one service account for both, and a few network and certificate settings. The procedure qua_cluster_preflight checks most of them on each node; the check that verifies a requirement is named next to it.

The metabase#

The metabase is the only thing the two nodes share, and the lease that decides which node serves lives in it. Its availability is the availability of the cluster: without the metabase, the serving node stops serving after 20 seconds even when both nodes are healthy.

Requirement

Details

SQL Server

The metabase is a SQL Server database. A node in cluster mode does not start on any other metabase - SQLite, PostgreSQL or MySQL. Preflight: metabase.engine.

Synchronous high availability

The metabase database is protected by one of:

  • an availability group in synchronous-commit mode, on SQL Server instances in a Windows Server Failover Clustering cluster - at least two synchronous-commit replicas;

  • database mirroring in high-safety mode (SAFETY FULL);

  • a SQL Server failover cluster instance, which keeps one copy of the database on shared storage. Its failover restarts SQL Server on another server, so it usually takes longer than the lease budget, and the serving node stops serving during it (see Metabase failover and the lease timings).

An asynchronous failover can lose the last change of the lease and the last metadata changes, so asynchronous replicas do not count. Preflight: metabase.ha-model (it warns when the metabase has no high availability at all).

One connection string per model

Each node’s MetadataConnectionString matches the metabase’s high availability model, and both nodes use the same kind (see Metabase connection strings). Preflight: metabase.failover-partner and metabase.multi-subnet-failover.

Encryption

The connection to the metabase is encrypted and validates the server certificate: Encrypt=True without TrustServerCertificate=True. See Protect stored credentials for hardening the metabase connection. Preflight: metabase.encryption.

Each metabase server’s certificate names every address a node dials it by: the availability group listener (or, for mirroring, the name in Data Source or Failover Partner) and the server’s own fully qualified name, which metabase.clock-servers dials to read its clock - unless the connection string names one name every server carries in HostNameInCertificate. So that the check can find the server’s name, name the database mirroring endpoints by the servers’ fully qualified names - ENDPOINT_URL = 'TCP://SQL-B.contoso.com:5022' for an availability group replica, SET PARTNER = 'TCP://SQL-B.contoso.com:5022' for a mirror - or keep the servers in the DNS domain of the name in Data Source.

Synchronized clocks

The clocks of the metabase servers - the principal and the mirror, or every replica - agree within 5 seconds, for example through the Windows Time service. The lease is timed by the metabase server’s clock, and after a metabase failover the time comes from the other server. Preflight: metabase.clock-servers; it also warns when the node’s own clock is off (metabase.clock-node).

Failover time within the lease budget

A metabase failover the clients should not notice finishes within the outage the serving node rides out: about 15 seconds with the default lease timings. A longer one - a failover cluster instance’s, usually - makes the serving node stop serving until a node takes the lease again (see Metabase failover and the lease timings).

The same rights for both nodes

Either node may become the serving node, so both nodes’ metabase logins have the same rights. To recognize the other node, a node reads the metabase server’s session list, which needs VIEW SERVER STATE or, from SQL Server 2022 on, VIEW SERVER PERFORMANCE STATE for the metabase login; without it the node starts with a warning that it could not check.

For the SQL Server side, see Microsoft’s documentation of availability groups and of database mirroring.

Metabase connection strings#

For an availability group or database mirroring, use one of the two forms below, never both. The two keywords do not mix: Failover Partner against an availability group works only until the first failover of the metabase, and then every connection fails with an error about database mirroring. For a SQL Server failover cluster instance, connect to the instance’s network name and use neither keyword.

For an availability group, connect to its listener with MultiSubnetFailover=True:

Server=tcp:metabase-listener.contoso.com,1433;Database=Querona;Integrated Security=True;
Encrypt=True;MultiSubnetFailover=True;Application Name=Querona

For database mirroring, name the principal and the mirror with Failover Partner:

Server=tcp:sql-a.contoso.com,1433;Failover Partner=sql-b.contoso.com;Database=Querona;
Integrated Security=True;Encrypt=True;Application Name=Querona

The value is one line in instance.config. The installer does not write either keyword: add it by hand on both nodes. An upgrade keeps it as long as the metabase server stays the same; see Upgrade Querona. Give both nodes the same Application Name, as the installer does: a node recognizes the other node’s sessions in the metabase by it.

Metabase failover and the lease timings#

With the default timings the serving node renews the lease every 5 seconds and stops serving 20 seconds after the start of its last successful renewal. It therefore rides out a metabase outage of about 15 seconds. A metabase failover that takes longer makes the serving node stop serving, and a node takes the lease again once it has expired.

Measure the failover of your metabase before production, both a planned one and one after a failure. The node management page of the serving node shows the last metabase outage the node saw, with when it began and ended and how long it lasted. For orientation:

  • database mirroring notices a principal that hangs or cannot be reached only after its partner timeout, 10 seconds by default;

  • an availability group in a Windows Server Failover Clustering cluster notices it after its lease timeout (20 seconds by default) or its health check timeout (30 seconds by default);

  • a SQL Server failover cluster instance moves the whole SQL Server instance and starts it on another server, which recovers the databases before it accepts connections. Its failover has not been measured with Querona; it usually takes longer than the lease budget, so the serving node stops serving during it, and a node takes the lease again once the instance is back and the lease has expired.

When the measured failover does not fit, lengthen the timings with qua_cluster_set_timings - for example a self-demote deadline of 35 seconds and a lease time to live of 45 seconds. The serving node then rides out such a failover, and a takeover after a node failure takes 15 seconds longer. Do not shorten the timings below their defaults: they would not survive any metabase failover.

The nodes#

Requirement

Details

Two Windows servers

Each node is a Windows server of its own, with its own host name. The nodes are bound to their host names when the cluster is provisioned, and a node refuses to start on another computer.

The same build

Both nodes run the same Querona build. The Cluster page warns when they differ, and a planned failover refuses a target that runs another build.

The same drivers and files

Everything a connection or a job step names outside the metabase exists on both nodes, at the same paths: providers and their client libraries, ODBC drivers and data sources, JDBC driver files, local files and folders, and the tools job steps run. Preflight: node.providers, node.odbc, node.jdbc, node.file-paths and node.job-subsystems.

Access to the data sources

Both nodes reach the data sources the connections name, because either may serve.

A wall clock corrected after a pause

On a virtual machine, the host corrects the node’s clock when a paused or saved machine resumes. A node notices that it was paused for longer than its lease only from the corrected clock, and then serves nothing until it has confirmed the lease with the metabase. On Hyper-V, keep the Time synchronization integration service enabled for both virtual machines. Preflight: node.clock-correction.

The instance master key

Both nodes can open the instance master key, and the key has a password-protected copy before the second node joins. See Set up a cluster. Preflight: node.master-key, node.master-key-portable and node.legacy-secrets.

A shared Spark warehouse

A Spark instance that runs on a cluster node keeps its warehouse (spark.sql.warehouse.dir) on storage both nodes reach under one path, for example a UNC share, because after a failover the other node’s Spark instance reads the tables the first one wrote. The service account needs read and write access to the share. Move data already in a local warehouse before cluster mode is switched on. Preflight: node.spark-warehouse.

No pinned execution targets

No connection is pinned to one instance, every network of instances holds exactly the two nodes, and no view, function or job step uses OPTION (EXECUTE_ON ...). Preflight: targets.pinned-connections, targets.network-connections and targets.execute-on.

The service account#

The Querona service runs under one domain account on both nodes: a group managed service account (gMSA). Clients that sign in with Windows authentication ask for a Kerberos ticket for the cluster name, and that service principal name can belong to only one account, so both nodes must run under the same one. A group managed service account has no password to keep in step on two servers: the domain manages it.

Before you install, a domain administrator creates the account and allows both nodes to retrieve its password, and the account is installed on both nodes. In the installer of each node, enter the account as DOMAIN\name$ - its domain and its name with the trailing $ - and no password; the installer accepts it only when it is installed on that computer. See Group managed service account.

The account needs what any Querona service account needs (see Requirements and compatibility), and in addition read and write access to the shared Spark warehouse. NetworkService and LocalService are machine accounts, which each node has for itself, so they cannot hold the cluster’s service principal name: the preflight check addressing.spn fails for them.

A cluster node needs the group managed service account. A standalone managed service account (sMSA) belongs to one computer, while the cluster name’s service principal name belongs to one account, so the two nodes cannot share it and addressing.spn fails on the node whose account does not hold the name. The installer accepts an sMSA, but only for a single node outside a cluster.

A domain user account whose name ends with $ cannot be the service account, on a cluster node or on any other node: the installer reads a name with the trailing $ as a managed service account and refuses a user account under it as not a managed service account.

Ports and firewall#

Port

Default

Where it is open

TDS port

1433

Only on the serving node. Both nodes use the same port number, because clients reach both under one name.

Web port of the Administrative Portal and the API

443

Only on the serving node, with the same port number on both nodes.

Administrative HTTP port

8080

On both nodes, in every role. It serves the anonymous health probes /health/live and /health/ready to the network, and the node management page to connections from the node itself. It must differ from the TDS and web ports.

The installer creates inbound Windows Firewall rules for the TDS port (Querona - TDS Incoming), the web port (Querona - Web Incoming) and, on a cluster node, the administrative port (Querona - Administrative HTTP Incoming). Install both nodes with the same ports, so that both get the same rules. Where another firewall protects the servers, open the same ports on both nodes there.

The inter-node port of an instance (Public cluster port in the instance configuration) is not used in cluster mode: the nodes never connect to each other, and nothing listens on that port.

Both nodes also connect out to the metabase server and, for the clock check of the preflight, to the mirror or the other replicas.

Keep the TDS, web and administrative ports outside the TCP dynamic port range of Windows (49152-65535 by default), or exclude each of them from it, on both nodes. The standby node keeps the TDS and web ports free until it takes over, and an outgoing connection that took one of them as its local port in the meantime makes the takeover fail. The same holds for the ports of the Data API instances and Spark instances that start automatically. The installation procedure gives the netsh command; see Install Querona, step 7. Preflight: node.dynamic-ports and node.child-process-ports.

Certificates#

Each node has a certificate of its own for the TDS and web ports, and both certificates carry the cluster name in their subject alternative names: clients validate the certificate against the name they dial, which is the cluster name whichever node serves. The certificate is for server authentication and has its private key on the node. The administrative HTTP port is plain HTTP and needs no certificate.

Give the second node’s certificate thumbprint when the cluster is provisioned (see Set up a cluster): the second node’s settings are otherwise copied from the first node. Preflight: addressing.certificate.

Service principal name#

For Windows authentication over Kerberos, register the service principal name of the cluster name and the TDS port on the group managed service account, with the fully qualified cluster name, the form a client builds for a TCP connection:

setspn -S MSSQLSvc/db-cluster.contoso.com:1433 CONTOSO\querona-gmsa$

The administrative HTTP port needs none. Preflight: addressing.spn, which fails when the name is held by no account, by several, or by another account than the service’s. See Microsoft’s setspn reference and Register a service principal name for Kerberos connections.

DNS#

The cluster name is a DNS name of its own, never a computer’s name and never an alias (CNAME). How it is set up - two address records or a load balancer - is described in Client connections to a cluster. Preflight: addressing.cluster-name.

See also#