qua_cluster_provision#
Provisions a two-node cluster in the metabase of the Querona instance the session is connected to, with that instance as the first node, and returns the settings each node’s instance configuration file needs. Run it on the first node before cluster mode is enabled there, after qua_cluster_preflight reports no failure.
Syntax#
qua_cluster_provision
[ @cluster_name = ] 'cluster_name'
, [ @node2_host_name = ] 'node2_host_name'
[ , [ @node2_instance_name = ] 'node2_instance_name' ]
[ , [ @node1_host_name = ] 'node1_host_name' ]
[ , [ @node2_ssl_thumbprint = ] 'node2_ssl_thumbprint' ]
[ , [ @administrative_http_port = ] administrative_http_port ]
[ , [ @dry_run = ] dry_run ] [;]
Arguments#
[ @cluster_name = ] ‘cluster_name’
The DNS name clients connect to the cluster by, short (QUERONA) or fully qualified (querona.contoso.com), up to
253 characters. Required. Each dot-separated part consists of letters, digits and hyphens, is 1 to 63 characters long
and neither starts nor ends with a hyphen; an IP address is refused, and so are localhost and every name in its
domain, such as db.localhost, which each computer resolves to itself. Create this name in DNS with the address of each
node. Give it exactly as clients dial it and as both nodes’ certificates carry it: every start in cluster mode checks
the certificate against the stored name, and a short name and its fully qualified form are different names. The
cluster name must not name either node’s computer: a name whose first part is a node’s computer name is refused, in
any domain - for the computer NODE-A, node-a and node-a.contoso.com are refused, node-a-cluster is not.
When the first node is the computer the procedure runs on, its DNS name is compared the same way, which matters for
a computer name longer than 15 characters. Clients that dial a computer’s name reach that computer, whichever node
serves. The name is checked in a dry run too. The second node’s DNS name is not known here: run
qua_cluster_preflight with @cluster_name on the second node, which fails when the name is that computer’s.
[ @node2_host_name = ] ‘node2_host_name’
The computer name of the second node, without a domain, up to 255 characters - the name
SERVERPROPERTY('ComputerNamePhysicalNetBIOS') reports there. Required. The second node refuses to start on any
other computer. A name with a dot is refused.
[ @node2_instance_name = ] ‘node2_instance_name’
The name of the second node’s instance, up to 128 characters. Optional; the default is the second node’s computer name. It must differ from the first node’s instance name.
[ @node1_host_name = ] ‘node1_host_name’
The computer name of the first node. Optional; the default is the name of the computer the instance runs on.
[ @node2_ssl_thumbprint = ] ‘node2_ssl_thumbprint’
The thumbprint of the second node’s TLS certificate, up to 128 characters. Required when the first node has a
certificate thumbprint configured: each node has a certificate of its own, so the first node’s is never copied
silently. When both nodes share one certificate, pass the first node’s thumbprint. Every other setting of
the second node - its ports among them - is copied from the first node, because clients reach both nodes under one
name. The one exception is DataApiCertificateSubject, the subject by which a Data API instance finds the node’s
certificate: when the first node’s value names the first node’s computer, the second node gets an empty value, so
that its Data API instances serve the second node’s own web certificate; any other value is copied.
[ @administrative_http_port = ] administrative_http_port
The administrative HTTP port both nodes are given, between 1 and 65535. Optional; the default is the
AdministrativeHttpPort the first node’s instance configuration file already contains. When that file contains
none, or a value outside 1-65535, the argument is required.
[ @dry_run = ] dry_run
1 reports what the procedure would do and changes nothing. Optional; the default is 0.
Result set#
Column |
Type |
Description |
|---|---|---|
cluster_id |
uniqueidentifier |
The identifier of the cluster. |
cluster_name |
nvarchar(253) |
The cluster name as the metabase holds it - check it in a dry run before provisioning, because a later rename needs a restart of both nodes. |
outcome |
nvarchar(16) |
|
instance_id |
int |
The node’s instance identifier; NULL for the second node in a dry run that would create it. |
host_name |
nvarchar(255) |
The computer the node is bound to. |
setting_name |
nvarchar(128) |
A key of the node’s instance configuration file. |
setting_value |
nvarchar(max) |
The value to give it. |
is_dry_run |
bit |
1 when nothing was changed because |
Each node gets InstanceId, InstanceName, ClusterModeEnabled, AdministrativeHttpPort and
MetabaseEngineType; the second node also gets MetadataConnectionString. That value is empty when the first
node’s connection string contains a password or names the metabase server as localhost, ., (local), a
loopback address or a local pipe; type the second node’s connection string yourself. No row contains a password or a
key.
Running the procedure again with the same arguments changes nothing. With other arguments against a provisioned
cluster - another cluster name among them - or while the cluster runs, it is refused: it never changes an existing
cluster. To rename a provisioned cluster, use qua_cluster_set_name. A cluster provisioned before the cluster name existed gets the name when the procedure runs again on the first
node before that node is restarted in cluster mode; the outcome is then COMPLETED.
Remarks#
The procedure is refused on an instance that already runs in cluster mode, on one whose instance configuration has no
instance identifier or metabase connection string, and on a metabase that is not on Microsoft SQL Server. A missing
@cluster_name or @node2_host_name, and a missing @administrative_http_port on a first node without one,
raise error 201.
The first node keeps serving outside cluster mode until it is restarted. Apply its settings and restart it in cluster mode before you start the second node; otherwise both serve at the same time. After provisioning, the first node no longer starts outside cluster mode.
To give a cluster a new identifier after its metabase was restored from a backup, stop both nodes, wait until the
lease has expired, and run EXEC dbo.ClusterReset on the metabase database itself. The cluster keeps its name. The
reset is refused with error
50103 while the lease has not expired, 50104 while a node has contacted the metabase recently, and 50105 while a
Querona session is connected to the metabase. Seeing other sessions requires VIEW SERVER PERFORMANCE STATE (VIEW
SERVER STATE before SQL Server 2022); without it the session check is skipped and the result column
IsSessionCheckSkipped is 1.
Permissions#
Requires the CONTROL SERVER permission.
Example#
Shows what would be provisioned for the cluster querona.contoso.com with a second node on the computer NODE-B with its own certificate, then provisions it.
EXEC qua_cluster_provision @cluster_name = N'querona.contoso.com', @node2_host_name = N'NODE-B',
@node2_ssl_thumbprint = N'0123456789ABCDEF0123456789ABCDEF01234567', @dry_run = 1;
EXEC qua_cluster_provision @cluster_name = N'querona.contoso.com', @node2_host_name = N'NODE-B',
@node2_ssl_thumbprint = N'0123456789ABCDEF0123456789ABCDEF01234567';