Get started with Elastic Database tools

3 min to read Contributors

This document introduces you to the developer experience by running the sample app. The sample creates a simple sharded application and explores key capabilities of elastic database tools. The sample demonstrates functions of the elastic database client library

To install the library, go to Microsoft.Azure.SqlDatabase.ElasticScale.Client. The library is installed with the sample app described below.

Prerequisites

  1. Visual Studio 2012 or higher with C# is required. Download a free version at Visual Studio Downloads.
  2. NuGet 2.7 or higher. To get the latest version, see Installing NuGet

Download and run the sample app

The Elastic Database with Azure SQL— Getting Started sample application illustrates the most important aspects of the development experience for sharded applications using Azure SQL elastic database tools. It focuses on key use cases for shard map management, data-dependent routing and multi-shard querying. To download and run the sample, follow these steps:

  1. Open Visual Studio and select File -> New -> Project.
  2. In the dialog, click Online.

    New Project>Online

  3. Then click Visual C# under Samples.

    Click Visual C#

  4. In the search box, type elastic db to search for the sample. The title Elastic DB Tools for Azure SQL - Getting Started appears.

    Search Box

  5. Select the sample, choose a name and a location for the new project and press OK to create the project.
  6. Open the app.config file in the solution for the sample project and follow the instructions in the file to add your Azure SQL database server name and your login information (user name and password).
  7. Build and run the application. When asked, please allow Visual Studio to restore the NuGet packages of the solution. This will download the latest version of the elastic database client library from NuGet.
  8. Play with the different options to learn more about the client library capabilities. Note the steps the application takes in the console output and feel free to explore the code behind the scenes.

    progress

Congratulations – you have successfully built and run your first sharded application using elastic database tools on Azure SQL Database. Take a quick look at the shards that the sample created by connecting with Visual Studio or SQL Server Management Studio to your Azure DB Server. You will notice new sample shard databases and a shard map manager database that the sample has created.

Important

It is recommended that you always use the latest version of Management Studio to remain synchronized with updates to Microsoft Azure and SQL Database. Update SQL Server Management Studio.

Key pieces of the code sample

  1. Managing Shards and Shard Maps: The code illustrates how to work with shards, ranges, and mappings in file ShardMapManagerSample.cs. You can find more information about this topic here: Shard Map Management.
  2. Data Dependent Routing: Routing of transactions to the right shard is shown in DataDependentRoutingSample.cs. For more details, see Data Dependent Routing.
  3. Querying over Multiple Shards: Querying across shards is illustrated in the file MultiShardQuerySample.cs. For more details, see Multi-Shard Querying.
  4. Adding empty shards: The iterative adding of new empty shards is performed by the code in file AddNewShardsSample.cs. Details of this topic are covered here: Shard Map Management.

Other elastic scale operations

  1. Splitting an existing shard: The capability to split shards is provided through the split-merge tool. You can find more information on this tool here: split-merge tool overview.
  2. Merging existing shards: Shard merges are also performed using the split-merge tool. For more information, refer to: split-merge tool overview.

Cost

The elastic database tools are free of charge. Elastic database tools does not impose additional charges on top of the cost for your Azure usage.

For example, the sample application creates new databases. The cost depends on the Azure SQL DB database edition you choose and the Azure usage of your application.

For pricing information see SQL Database Pricing Details.

Next steps

For more information about the elastic database tools, see: