Ends in:
2 DAYS
4 HRS
37 MIN
31 SEC
Ends in:
2 D
4 H
37 M
31 S
Open Closed

Tenant-Based Dynamic Database Connection Management and Separate Servers for Read/Write Operations #8426


User avatar
0
BeytullahBB created

I am developing a Tenant Management system using the ABP Framework. The project does not include Commercial modules. However, I would like to design a system with the following features. I am requesting guidance and support for implementing dynamic connection management and using separate database servers for read/write operations.

Requirements:

  1. Tenant-Based Module Management The system will have modules like bank, cash, and orders, which will be structured using a microservice architecture. The following database connection scenarios will be applied for each tenant: Bank Module: Connects with a tenant-specific connection string. Cash and Order Modules: Each uses a separate connection string. Other Modules (e.g., user management): Operates on a default database connection.
  2. Separate Database Servers for Read and Write Operations GET (read) operations will use a dedicated database server (X Server). CREATE, UPDATE, DELETE (write) operations will use a separate database server (Y Server). The replication and synchronization between X Server and Y Server will be managed by the database administration team. In summary: X Server should be used for GET operations. Y Server should be used for CREATE, UPDATE, DELETE operations.
  3. Angular Frontend Integration The Angular-based frontend should implement a system to manage module connections based on the tenant information. When a user opens any module (e.g., bank module): If a tenant-specific connection string exists, it should be used. If no tenant-specific connection string is defined, a default database connection should be used. Example Scenario: Connection Strings for Tenant1 Bank Module

GET operations: Server=banka-server-get;Database=tenant1_banka_db;User Id=...;Password=...; UPDATE, CREATE, DELETE operations: Server=banka-server-other;Database=tenant1_banka_db;User Id=...;Password=...; Cash Module

GET operations: Server=kasa-server-get;Database=tenant1_kasa_db;User Id=...;Password=...; UPDATE, CREATE, DELETE operations: Server=kasa-server-other;Database=tenant1_kasa_db;User Id=...;Password=...; Order Module

GET operations: Server=siparis-server-get;Database=tenant1_siparis_db;User Id=...;Password=...; UPDATE, CREATE, DELETE operations: Server=siparis-server-other;Database=tenant1_siparis_db;User Id=...;Password=...; Other Modules

GET operations: Server=default-server-get;Database=common_db;User Id=...;Password=...; UPDATE, CREATE, DELETE operations: Server=default-server-other;Database=common_db;User Id=...;Password=...; Expected Solution:

  1. Dynamic Connection Management with ABP Framework A proposal for managing tenant-based dynamic database connections using the ABP Framework. An example approach for configuring separate database connections for read and write operations.
  2. Domain and Application Layer Development Suggestions Examples of required development for tenant-based connection string management in the domain or application layer.
  3. Angular Frontend Integration Suggestions for implementing module-based API calls using tenant information on the frontend. Goal: To establish a flexible infrastructure for tenant-based connection management and utilize separate servers for read/write operations. I aim to achieve the above requirements using the ABP Framework's existing capabilities. However, I could not find a direct example addressing this scenario in the ABP Framework documentation. I would appreciate your guidance and recommendations.

Thank you!

  • ABP Framework version: v7.1.1
  • UI Type: Angular
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can get the source code of the SaaS module to see the management connection strings for different tenants or microservices. This is the best way to learn how to implement Tenant-Based Dynamic Database Connection Management and Separate Servers

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35