WSO2 API Manager中WSO2CARBON_DB与SHARED_DB脚本一致却需单独配置的原因咨询
Great question—this is a common point of confusion since their initial schema looks identical, but the separation is intentional and tied to WSO2's architecture for scalability, modularity, and cluster resilience. Let’s break down the reasons:
Clear Separation of Responsibilities
Even though their table structures match initially, these two databases serve distinct purposes:WSO2CARBON_DBacts as the node-local core database for each individual API Manager instance. It stores node-specific runtime state, local configuration overrides, scheduled tasks tied to that node, and cache-related metadata that doesn’t need to be shared across the cluster.SHARED_DBis the cluster-wide shared repository that holds global, cross-node data: user/role/tenant details, shared API metadata, registry content, and other data that must be consistent across all nodes in a clustered deployment.
This split ensures each database only handles the data it’s designed for, avoiding mixing local and global state.
Cluster Deployment Resilience & Performance
In a clustered setup, using separate databases prevents performance bottlenecks and reduces risk:- If all nodes shared a single database, every local node operation (like updating its own task state) would compete with global operations (like user updates) for database resources, slowing down the entire system.
- Isolating
WSO2CARBON_DBper node means a failure or maintenance on one node’s local database won’t impact the rest of the cluster, whileSHARED_DBcan be optimized for high availability (e.g., using Oracle RAC) to support global access.
Future-Proofing for Schema Evolution
The identical initial schema is just a starting point. WSO2’s design reserves the flexibility to evolve the schemas independently as needed. For example, future versions might add tables specific to node-local operations inWSO2CARBON_DBor introduce global-only features that require changes toSHARED_DB, without breaking existing functionality.Configuration Flexibility
Separating the databases lets admins tailor resource allocation to each’s needs:SHARED_DBcan be deployed on a high-performance, clustered database instance to handle heavy cross-node read/write traffic.WSO2CARBON_DBcan use a lighter, local database (or a dedicated instance) optimized for low-latency, node-specific operations, reducing infrastructure costs and complexity.
内容的提问来源于stack exchange,提问作者Tohid Makari

