The SQL Sharding Deployment Tool
The SQL Sharding Deployment Tool is an executable that deploys and manages the xDB Collection database and can be used on its own if you want greater control over parameters, such as the number of shards to deploy. The tool must be run from a local machine. It cannot be uploaded and executed from an Azure environment.
The Sitecore Installation Framework (SIF) and the Sitecore Azure Toolkit (SAT) create two shards by default. This is the recommended number of shards that handles the majority of cases; for better performance, we usually recommend increasing the Azure tier, while increasing the number of shards is a good solution only if the database is huge. To change the number of shards you can either re-deploy the xDB Collection database. For SIF, you can also change the JSON files used during the installation process.
Location
The tool is bundled with the xConnect Collection service and is available in the following web deploy packages (WDP):
Topology name |
Example WDP name |
Tool location |
---|---|---|
XP Single (Developer) - On-Prem |
|
|
XP Single (Developer) - Cloud |
| |
XP Scaled - On-Prem |
| |
XP Scaled - Cloud |
|
Operations
You can use the SQL Sharding Deployment Tool to:
-
Create the xDB Collection shard cluster (
create
). For example:RequestResponseshell./Sitecore.Xdb.Collection.Database.SqlShardingDeploymentTool.exe /operation "create" /connectionstring "Data Source=.;User Id=sa;Password=12345;" /shardMapManagerDatabaseName "Sitecore.Xdb.Collection.Database.Sql.ShardMapManagerDb" /dbedition "Standard" /shardnumber 3 /shardnameprefix "Sitecore.Xdb.Collection.Database.Sql.Shard" /shardnamesuffix "_" /dacpac "C:\PROJECTS\Foundation.Marketing.Xdb.Collection.SqlServer\code\Sitecore.Xdb.Collection.Database.SqlShardingDeploymentTool\bin\Debug\Sitecore.Xdb.Collection.Database.Sql.dacpac"
-
Drop the xDB Collection shard cluster (
drop
). For example:RequestResponseshell.\Sitecore.Xdb.Collection.Database.SqlShardingDeploymentTool.exe /operation drop /connectionstring "user id=sa;password=12345;data source=." /dbedition Standard /shardMapManagerDatabaseName "TestDatabase" /shardMapNames "ContactIdShardMap,DeviceProfileIdShardMap,ContactIdentifiersIndexShardMap"
-
Add a shard to the shard cluster (
addShard
). For example:RequestResponseshell.\Sitecore.Xdb.Collection.Database.SqlShardingDeploymentTool.exe /operation addShard /connectionstring "user id=sa;password=12345;data source=.;" /shardMapManagerDatabaseName "Sitecore.Xdb.Collection.Database.Sql.ShardMapManagerDb" /dbedition "Standard" /shardconnectionstring "user id=sa;password=12345;data source=.;" /shardnameprefix "Sitecore.Xdb.Collection.Database.Sql" /shardnamesuffix "_" /dacpac ".\Sitecore.Xdb.Collection.Database.Sql.dacpac"
NoteThis command is only available with a cloud environment, and not on-prem.
-
Remove a shard from the shard cluster (
deleteShard
). For example:RequestResponseshell.\Sitecore.Xdb.Collection.Database.SqlShardingDeploymentTool.exe /operation deleteShard /connectionstring "user id=sa;password=12345;data source=.\SQL2017;" /shardMapManagerDatabaseName "Sitecore.Xdb.Collection.Database.Sql.ShardMapManagerDb" /shardConnectionString "user id=sa;password=12345;data source=.\SQL2017;" /shardDatabaseName "Sitecore.Xdb.Collection.Database.Sql2_"
-
Print shard map key ranges (
printMapping
). For example:RequestResponseshell.\Sitecore.Xdb.Collection.Database.SqlShardingDeploymentTool.exe /operation printMapping /connectionstring "user id=sa;password=12345;data source=.\SQL2017;" /shardMapManagerDatabaseName "Sitecore.Xdb.Collection.Database.Sql.ShardMapManagerDb"
Using the SQL Sharding Deployment Tool to add or remove shards does not automatically split and merge existing data. You use the SQL Sharding Deployment Tool as part of performing the split/merge operation.
Parameters
The following table describes the parameters used by the SQL Sharding Deployment Tool. Different operations accept a specific set of parameters in a specific order.
Parameter name |
Description |
Values / examples |
---|---|---|
|
Specifies which operation to perform. |
|
|
SQL Server credentials used to create the database. |
|
|
Azure SQL DTU-based service tiers. This value is only used if you are deploying to Azure SQL. |
|
|
The name of the shard map manager database. |
Example: |
|
The number of shards to create. Count starts at 0. |
5 |
|
Format is {Prefix}{Number}{Suffix}. |
Example: |
|
Format is {Prefix}{Number}{Suffix}. Suffix can be left blank. |
Example: |
|
Path to DACPAC file. By default, DACPAC files are in the same folder as the tool. |
|
|
Path to log file. If no log file is specified, output is written to console. | |
|
Used by the | |
|
Used by the |