-
Notifications
You must be signed in to change notification settings - Fork 165
Configuring sharding
The SetupMultiTenantSharding extension method optionally takes in a ShardingEntryOptions class via its defaultShardingEntry property. The ShardingEntryOptions class has a boolean property called hybridMode in its construction that allows you select Hybrid mode via a true, or Sharding-Only mode if false.
If the SetupMultiTenantSharding,s defaultShardingEntry is null, then it create a sets the hybridMode to false, thus selecting sharding-only mode (See Example7's Program class. If you want to select hybrid mode, then you need to provide a new ShardingEntryOptions with the hybridMode to true in the constructor.
Here is a list of what they do, and want is the result of being in each mode.
- The "DefaultConnection" connection string, which provides the database use by AuthP's to hold its data, is shown in the list of connection strings available to add sharing tenants.
- On the first deployment of your multi-tenant application to a new web server, then a default sharding entry (see the How AuthP handles sharding document on sharding entries are) is added to the sharding entries and linked to the "DefaultConnection" connection string. This default sharding entry allows you immediately add sharing tenants to the database defined by the "DefaultConnection" connection string.
When in hybrid mode the first deployment the application sets up connection strings and a sharding entry that allows a new shared tenant without need to manually set up a sharding entry. This also me to create a example of using sharding in the AuthP repo called Example6, which you can run to try it out, including demo users and tenants via AuthP's Bulk load feature.
- The "DefaultConnection" connection string is not listed in the connection strings available to add sharing tenants, unless the "DefaultConnection" connection string is the only connection string. This useful because:
- If you add connection strings linked to different servers, they are shown and the "DefaultConnection" connection string isn't (see Example7's appsettings.json file.
- But only want one server, found by the "DefaultConnection" connection string, then this will work without providing any other connection strings.
- On the first deployment of your multi-tenant application to a new web server the list of sharding entries is empty.
Because you have sharding-only tenants and the Service for shard-only tenants code its very easy to create / delete tenants. Therefore its better to NOT have pre-configured like the hybrid mode and on first deployment the application. This means you application starts there will no tenants orsharding entries (see the How AuthP handles sharding document for sharding entries), but it is very simple to add a new tenant.
- Intro to multi-tenants (ASP.NET video)
- Articles in date order:
- 0. Improved Roles/Permissions
- 1. Setting up the database
- 2. Admin: adding users and tenants
- 3. Versioning your app
- 4. Hierarchical multi-tenant
- 5. Advanced technique with claims
- 6. Sharding multi-tenant setup
- 7. Three ways to add new users
- 8. The design of the sharding data
- 9. Down for maintenance article
- 10: Three ways to refresh claims
- 11. Features of Multilingual service
- 12. Custom databases - Part1
- Videos (old)
- Authentication explained
- Permissions explained
- Roles explained
- AuthUser explained
- Multi tenant explained
- Sharding explained
- How AuthP handles sharding
- How AuthP handles errors
- Languages & cultures explained
- JWT Token refresh explained
- Setup Permissions
- Setup Authentication
- Startup code
- Setup the custom database feature
- JWT Token configuration
- Multi tenant configuration
- Using Permissions
- Using JWT Tokens
- Creating a multi-tenant app
- Supporting multiple languages
- Unit Test your AuthP app