Skip to content

Managing sharding databases

Jon P Smith edited this page Aug 14, 2023 · 15 revisions

Since AuthP version 6 when you set the AuthPermissionsOptions's TenantType and added SetupMultiTenantSharding method to register that the multi-tenant is using sharding, then to make sharding to work the app needs to holds information to link a tenant to a database - known as sharding entries. How this works can be found in How AuthP handles sharding but this document covers how you can use the IGetSetShardingEntries to read / change the sharding entries.

The typical things you might to do are:

  • Managing sharding entries
  • Reading the connection string names

Managing sharding entries

The GetAllShardingEntries method reads the information in the sharding entries. This is used internally but is also useful for the admin user to see what the sharding entries. The screenshot below comes from Example6.MvcWebApp.Sharding web application. If you log in as an application admin user and click the Auth Admin -> List database info.

List sharding entries

The code for these can be found in the ShardingController class of Example6 and Example7

b) Methods to add, update, and remove a sharding entry

These are simple to understand. They alter the sharding entries containing all the sharding entries.

  • AddNewShardingEntry(info) - Adds a new sharding entry to the sharding entries.
  • UpdateShardingEntry(info) - Updates the sharding entry with the given Name.
  • RemoveShardingEntry(name) - Removes the sharding entry with the given Name.

Reading the connection string names

???????????????????????????????????????????????????????????

Additional resources

Articles / Videos

Concepts

Setup

Usage

Admin

SupportCode

Clone this wiki locally