{"id":1444,"date":"2026-10-02T16:03:49","date_gmt":"2026-10-02T16:03:49","guid":{"rendered":"https:\/\/www.kingbaseglobal.com\/blog\/tech-blog\/architecting-an-enterprise-active-active-database-cluster\/"},"modified":"2026-10-02T16:03:49","modified_gmt":"2026-10-02T16:03:49","slug":"architecting-an-enterprise-active-active-database-cluster","status":"publish","type":"post","link":"https:\/\/www.kingbaseglobal.com\/blog\/tech-blog\/architecting-an-enterprise-active-active-database-cluster\/","title":{"rendered":"Architecting an Enterprise Active-Active Database Cluster"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/kingbase-bbs.oss-cn-beijing.aliyuncs.com\/qywx\/blogImage\/bfb7bcc4-8b38-45f9-b401-18248f4be768.webp\" alt=\"Precision tools arranged on a workshop surface illustrating technical configuration steps\" \/><\/p>\n<h2>Architecting a High-Availability Primary-Standby Database Cluster with KingbaseES<\/h2>\n<p>Designing a multi-site database architecture that guarantees zero data loss (RPO=0) requires balancing local performance with cross-site consistency. In a Primary-Standby synchronous replication model, the primary node waits for the standby to confirm writes to stable storage before committing. This ensures data durability but introduces sensitivity to network latency. If the round-trip time between sites exceeds the transaction commit timeout, writes will fail.<\/p>\n<p>This tutorial focuses on implementing a robust high-availability architecture using <strong>KingbaseES<\/strong> as the transactional engine. KingbaseES is a commercial database software developed by China Electronics Technology Kingbase (Beijing) Technologies Inc. It provides verified support for synchronous and asynchronous replication control between primary and standby databases. This guide details the verified synchronous replication setup for RPO=0, addresses architectural prerequisites, and provides specific verification steps for KingbaseES components like the control file.<\/p>\n<h3>Prerequisites: Environment, Network Topology, and Architecture Selection<\/h3>\n<p>Before configuring high-availability features, you must establish a stable environment and define network constraints. Synchronous replication is highly sensitive to network latency.<\/p>\n<p><strong>Checklist for Deployment Readiness:<\/strong><\/p>\n<ul>\n<li>\n<p><strong>Environment Variables:<\/strong> Ensure the following variables are correctly set for the KingbaseES installation and runtime. Incorrect paths can lead to configuration errors or startup failures.<\/p>\n<pre><code class=\"language-bash\">export KINGBASE_HOME=\/opt\/Kingbase\/ES\/V9\/kingbase\nexport PATH=$KINGBASE_HOME\/Server\/bin:$PATH\nexport PATH=$KINGBASE_HOME\/ClientTools\/bin:$KINGBASE_HOME\/ClientTools\/guitools\/KStudio:$PATH\nexport KINGBASE_DATA=\/opt\/Kingbase\/ES\/V9\/data\nexport KINGBASE_PORT=54321\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Network Latency Thresholds:<\/strong> Define a maximum acceptable latency for synchronous commits. If latency spikes, the cluster must have a fallback mechanism or alerting system. Consult network engineering to define appropriate thresholds based on your infrastructure.<\/p>\n<\/li>\n<li>\n<p><strong>OS and Hardware:<\/strong> Ensure the operating system meets KingbaseES requirements for high I\/O throughput, as synchronous replication writes to disk before acknowledging the client.<\/p>\n<\/li>\n<li>\n<p><strong>Architecture Selection:<\/strong><\/p>\n<ul>\n<li><em>Primary-Standby Synchronous:<\/em> Verified KingbaseES feature. One node accepts writes, synchronously replicates to standby. High consistency, but single-write point.<\/li>\n<li><em>Multi-Active with External Consensus:<\/em> Requires an external proxy or application-layer logic to handle write routing and conflict resolution, using KingbaseES for data persistence. KingbaseES core does not natively handle multi-site active-active consensus without external mechanisms.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>Architectural Strategy: Decoupling Local Writes from Cross-Site Consensus<\/h3>\n<p>In a true active-active setup, write-write conflicts occur when two sites modify the same data simultaneously. Without a unified consensus layer, these conflicts result in data divergence or corruption.<\/p>\n<p><strong>The Hybrid Consensus Model<\/strong><\/p>\n<p>To achieve RPO=0 while maintaining availability, the architecture should decouple local transaction processing from cross-site consistency.<\/p>\n<ol>\n<li><strong>Local Transaction Processing:<\/strong> Each site processes local transactions independently to minimize latency. This requires a conflict resolution strategy for data that might be modified at another site.<\/li>\n<li><strong>Synchronous Cross-Site Replication:<\/strong> KingbaseES supports synchronous replication control. In a primary-standby model, the primary node waits for the standby to confirm the write to stable storage before committing. This guarantees RPO=0.<\/li>\n<li><strong>Split-Brain Prevention:<\/strong> In multi-site setups, network partitions can cause two nodes to believe they are the primary. Specific consensus algorithms (like Raft) for split-brain prevention are not explicitly documented for KingbaseES active-active modes. Therefore, split-brain prevention often relies on:\n<ul>\n<li><em>Quorum-based Voting:<\/em> Requiring a majority of nodes to agree on the primary.<\/li>\n<li><em>Fencing:<\/em> Using external hardware or software fencing to isolate the partitioned node.<\/li>\n<li><em>Application-Layer Locking:<\/em> Ensuring only one site can write to specific data partitions at a time.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>KingbaseES Role:<\/strong> KingbaseES serves as the commercial transactional engine providing the foundational consistency guarantees and replication infrastructure. It does not inherently solve split-brain without external consensus mechanisms or specific configuration.<\/p>\n<h3>Step-by-Step: Configuring Synchronous Replication for Zero RPO<\/h3>\n<p>To achieve RPO=0, you must configure synchronous replication. This ensures that no data is lost if the primary node fails, as the standby holds the latest committed transactions.<\/p>\n<p><strong>Procedure:<\/strong><\/p>\n<ol>\n<li>\n<p><strong>Initialize the Standby Database:<\/strong><br \/>\nUse KingbaseES tools to create a standby instance. Ensure the <code>KINGBASE_DATA<\/code> directory is correctly configured.<\/p>\n<pre><code class=\"language-bash\"># Example command structure (verify specific syntax in official documentation)\n[INIT_COMMAND] -D \/path\/to\/standby_data\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Configure Synchronous Replication Parameters:<\/strong><br \/>\nEdit <code>kingbase.conf<\/code> on the primary and standby nodes.<\/p>\n<ul>\n<li>Set <code>synchronous_standby_names<\/code> to specify the standby node(s).<\/li>\n<li>Set <code>synchronous_commit<\/code> to <code>on<\/code> or <code>remote_write<\/code> depending on the durability requirement.<\/li>\n<li><em>Note:<\/em> Specific parameters for quorum settings are not documented in the provided evidence; use the standard synchronous replication parameters provided by KingbaseES.<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Start the Standby Service:<\/strong><\/p>\n<pre><code class=\"language-bash\"># Start the standby database (verify command in official documentation)\n[START_COMMAND] -D \/path\/to\/standby_data\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Verify Synchronous Status:<\/strong><br \/>\nCheck the replication status to ensure the standby is in sync.<\/p>\n<pre><code class=\"language-sql\">-- Query on primary (verify view name in KingbaseES documentation)\nSELECT * FROM [REPLICATION_STATUS_VIEW];\n<\/code><\/pre>\n<p>Look for <code>sync_state<\/code> as &#8216;sync&#8217; or &#8216;quorum&#8217;.<\/p>\n<\/li>\n<\/ol>\n<p><strong>Expected Output:<\/strong><br \/>\nThe replication view should show the standby node with a <code>sync_state<\/code> of &#8216;sync&#8217;, indicating that writes are confirmed by the standby before commit.<\/p>\n<h3>Critical Pre-Flight: Verifying Control File Integrity and Oracle Mode Compatibility<\/h3>\n<p>The KingbaseES control file is critical for database startup and consistency. If corrupted, the database will crash and fail to start.<\/p>\n<p><strong>Verification Steps:<\/strong><\/p>\n<ol>\n<li>\n<p><strong>Locate the Control File:<\/strong><br \/>\nThe control file is logically stored in the <code>sys_global<\/code> tablespace and physically located at:<\/p>\n<pre><code>$KINGBASE_DATA\/global\/sys_control\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Check File Integrity:<\/strong><br \/>\nEnsure the file is not corrupted and has the correct permissions.<\/p>\n<pre><code class=\"language-bash\"># Check file existence and permissions\nls -l $KINGBASE_DATA\/global\/sys_control\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Verify Oracle Mode Compatibility:<\/strong><br \/>\nKingbaseES supports an &#8216;ORACLE&#8217; initialization mode for syntax compatibility. Ensure that enabling this mode does not disable high-availability features.<\/p>\n<ul>\n<li>During initialization, if Oracle syntax compatibility is required, select the &#8216;ORACLE&#8217; mode.<\/li>\n<li>Verify that HA features (like synchronous replication) are still functional in this mode.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>Risk:<\/strong><br \/>\nCorruption of <code>$KINGBASE_DATA\/global\/sys_control<\/code> will cause the database to crash. Regular backups of this file are essential.<\/p>\n<h3>Validation: Confirming Data Consistency and Cluster Health<\/h3>\n<p>After configuration, validate that the cluster is healthy and data is consistent.<\/p>\n<p><strong>Validation Checklist:<\/strong><\/p>\n<ul>\n<li>\n<p><strong>Replication Lag:<\/strong> Confirm that replication lag is zero or near-zero.<\/p>\n<pre><code class=\"language-sql\">-- Check replication lag (verify view name in KingbaseES documentation)\nSELECT * FROM [REPLICATION_STATUS_VIEW];\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Control File Health:<\/strong> Verify that the control file is accessible and not corrupted.<\/p>\n<\/li>\n<li>\n<p><strong>Write-Acknowledgment Test:<\/strong> Perform a write operation and verify that it is committed only after the standby acknowledges.<\/p>\n<\/li>\n<li>\n<p><strong>Failover Simulation:<\/strong> Simulate a primary node failure and verify that the standby takes over without data loss (if using synchronous replication).<\/p>\n<\/li>\n<\/ul>\n<p><strong>KingbaseES High-Availability Testing Solution:<\/strong><br \/>\nKingbaseES provides a high-availability testing solution designed to verify system availability across different deployment architectures. Use this tool to assist in verifying use cases for fault transparency and O&amp;M cost optimization.<\/p>\n<h3>Troubleshooting: Handling Latency Spikes and Split-Brain Risks<\/h3>\n<p>Network latency spikes can cause synchronous replication to fail, leading to write timeouts. Split-brain risks arise from network partitions.<\/p>\n<p><strong>Latency-Induced Failures:<\/strong><\/p>\n<ul>\n<li><strong>Symptom:<\/strong> Writes time out with &quot;synchronous replication timeout&quot; errors.<\/li>\n<li><strong>Cause:<\/strong> Network latency between sites exceeds the commit timeout.<\/li>\n<li><strong>Mitigation:<\/strong>\n<ul>\n<li>Increase <code>synchronous_commit<\/code> timeout if acceptable.<\/li>\n<li>Switch to asynchronous replication temporarily (with data loss risk).<\/li>\n<li>Optimize network path or use dedicated lines.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Split-Brain Risks:<\/strong><\/p>\n<ul>\n<li><strong>Symptom:<\/strong> Two nodes accept writes independently, leading to data divergence.<\/li>\n<li><strong>Cause:<\/strong> Network partition prevents nodes from communicating.<\/li>\n<li><strong>Mitigation:<\/strong>\n<ul>\n<li>Implement quorum-based consensus (if supported by external tools).<\/li>\n<li>Use fencing mechanisms to isolate partitioned nodes.<\/li>\n<li>Monitor network health proactively.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Control File Corruption:<\/strong><br \/>\nIf the control file is corrupted, the database will crash. Recovery requires restoring from a backup of the control file and replaying WAL logs.<\/p>\n<h3>Rollback and Recovery: Reverting Configuration Changes<\/h3>\n<p>If the synchronous replication configuration causes instability, you must be able to roll back.<\/p>\n<p><strong>Rollback Procedure:<\/strong><\/p>\n<ol>\n<li>\n<p><strong>Stop the Standby Service:<\/strong><\/p>\n<pre><code class=\"language-bash\"># Stop the standby database (verify command in official documentation)\n[STOP_COMMAND] -D \/path\/to\/standby_data\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Revert Configuration Files:<\/strong><br \/>\nRestore <code>kingbase.conf<\/code> and <code>recovery.conf<\/code> (or equivalent) to their previous state.<\/p>\n<\/li>\n<li>\n<p><strong>Restart the Primary Database:<\/strong><\/p>\n<pre><code class=\"language-bash\"># Start the primary database (verify command in official documentation)\n[START_COMMAND] -D \/path\/to\/primary_data\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Verify Data Consistency:<\/strong><br \/>\nCheck that the primary database is operational and data is consistent.<\/p>\n<\/li>\n<li>\n<p><strong>Re-establish Replication (if needed):<\/strong><br \/>\nIf the standby was lost, re-initialize it from the primary.<\/p>\n<\/li>\n<\/ol>\n<h2>FAQ<\/h2>\n<h3>How to verify data integrity after a failover event in a KingbaseES cluster?<\/h3>\n<p>Use the KingbaseES high-availability testing solution to assist in verifying system availability. Manually check the replication status view for lag and compare data counts between primary and standby.<\/p>\n<h3>What are the prerequisites for implementing high-availability database clusters in enterprise environments?<\/h3>\n<p>Stable network with low latency, correct environment variables (<code>KINGBASE_HOME<\/code>, <code>KINGBASE_DATA<\/code>), and proper configuration of synchronous replication parameters.<\/p>\n<h3>What are the primary risks of split-brain scenarios in geographically distributed databases?<\/h3>\n<p>Data divergence and corruption due to multiple nodes accepting conflicting writes. Prevention requires quorum-based consensus or fencing mechanisms, as specific consensus algorithms are not documented for KingbaseES active-active modes.<\/p>\n<h3>How to ensure zero RPO while maintaining low-latency writes in active-active setups?<\/h3>\n<p>Decouple local writes from cross-site consensus. Use synchronous replication for critical data to ensure RPO=0, while managing latency through network optimization and conflict resolution strategies.<\/p>\n<hr \/>\n<p><strong>\ud83d\udca1 More Resources<\/strong><\/p>\n<p>If you would like to dive deeper into KingbaseES and its application practices across various industries, we have compiled the following official resources to help you get started quickly and develop and operate with efficiency:<\/p>\n<ul>\n<li><a href=\"https:\/\/bbs.kingbase.com.cn\/\">Kingbase Community<\/a>: A one-stop interactive platform for technical exchanges, Q&amp;A, and experience sharing\u2014join forces with fellow DBAs and developers.<\/li>\n<li><a href=\"https:\/\/www.kingbaseglobal.com\/Solution-Oracle.html\">Kingbase Solutions<\/a>: One-stop full-stack database migration and cloud-native solutions, supporting smooth migration of multi-source heterogeneous data, ensuring high availability, real-time integration, and sustained high performance.<\/li>\n<li><a href=\"https:\/\/www.kingbaseglobal.com\/Customers.html\">Kingbase Case Studies<\/a>: Real-world user scenarios and implementation outcomes, showcasing KingbaseES&#8217;s outstanding capabilities in high availability, high performance, and IT adaptation.<\/li>\n<li><a href=\"https:\/\/docs.kingbase.com.cn\/en\">Kingbase Documentation<\/a>: Authoritative and comprehensive product manuals and technical guides, covering the entire lifecycle from installation and deployment to development, programming, and operations management.<\/li>\n<li><a href=\"https:\/\/www.kingbaseglobal.com\/Download.html\">Free Download<\/a>: Get the latest installation packages, drivers, tools, and patches, supporting multiple platforms and domestic chip architectures.<\/li>\n<li><a href=\"https:\/\/www.kingbaseglobal.com\/blog\/\">Digital Construction Encyclopedia<\/a>: Covers digital strategy planning, data integration, metrics management, database visualization applications, and more to empower enterprise digital transformation.<\/li>\n<\/ul>\n<p><strong>Open Source Resources:<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/hgsandy\/Kingbase-docs\">GitHub &#8211; Kingbase-docs<\/a>: Kingbase documentation open-source repository\u2014Stars and contributions are welcome.<\/li>\n<li><a href=\"https:\/\/gitee.com\/hgsandy\/kingbase-docs\">Gitee &#8211; Kingbase-docs<\/a>: Domestic mirror repository for Kingbase documentation for faster access.<\/li>\n<\/ul>\n<p>Welcome to explore the resources above and begin your Kingbase journey!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Architecting a High-Availability Primary-Standby Database Cluster with KingbaseES Designing a multi-site database architecture that guarantees zero data loss (RPO=0) requires balancing local performance with cross-site consistency. In a Primary-Standby synchronous&#8230;<\/p>\n","protected":false},"author":651,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"meta_description":"","_kingbase_seo_description":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1444","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.kingbaseglobal.com\/blog\/wp-json\/wp\/v2\/posts\/1444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kingbaseglobal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kingbaseglobal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kingbaseglobal.com\/blog\/wp-json\/wp\/v2\/users\/651"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kingbaseglobal.com\/blog\/wp-json\/wp\/v2\/comments?post=1444"}],"version-history":[{"count":0,"href":"https:\/\/www.kingbaseglobal.com\/blog\/wp-json\/wp\/v2\/posts\/1444\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kingbaseglobal.com\/blog\/wp-json\/wp\/v2\/media?parent=1444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kingbaseglobal.com\/blog\/wp-json\/wp\/v2\/categories?post=1444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kingbaseglobal.com\/blog\/wp-json\/wp\/v2\/tags?post=1444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}