Kingbase Banner

Deploy On-Premises Enterprise Knowledge Base Database

Technical tools arranged on linen for enterprise database architecture tutorial

Deploying an on-premises enterprise knowledge base database requires balancing data sovereignty with the performance demands of Retrieval-Augmented Generation (RAG) pipelines. This guide outlines the architecture, configuration, and validation steps for KingbaseES, ensuring low-latency hybrid search and strict access control without cloud dependency.

Prerequisites

Before deploying KingbaseES for an on-premises enterprise knowledge base, verify the following:

  • Software Identity: KingbaseES is commercial database software. Ensure appropriate licensing is in place.
  • Version and OS: Verify the specific KingbaseES version and supported operating systems (e.g., enterprise Linux distributions) with the vendor documentation.
  • Hardware: Ensure sufficient CPU and RAM for concurrent metadata filtering and vector indexing. Vector operations are memory-intensive; allocate dedicated memory pools for index caching.
  • Network: Configure firewalls to restrict inbound traffic to authorized application servers and administrative IPs.
  • Storage: Use high-IOPS SSDs for the database data directory. Separate the Write-Ahead Log (WAL) directory onto a distinct physical disk to prevent I/O contention.

Architecting Hybrid RAG: Metadata vs. Vector Layers

Enterprise data architects often face a bottleneck when combining structured metadata filtering with vector similarity search. A common anti-pattern is overloading the primary transactional database with vector operations, which degrades query response times for both search and business logic. The robust solution involves a decoupled architecture where the relational database manages the "System of Record" (metadata, user profiles, security) while a dedicated layer handles the "Retrieval Layer" (vector similarity).

However, infrastructure consolidation offers significant operational advantages. When workloads do not demand specialized vector infrastructure, traditional databases can effectively handle hybrid search workloads, log collection, and query analytics simultaneously. KingbaseES supports a multi-model architecture capable of handling relational, document, spatial, time series, text, vector embeddings, key-value, and property graph data within a single system. This allows enterprises to store structured metadata and vector embeddings in one instance, reducing the complexity of managing multiple specialized databases.

The key to performance is distinguishing between the transactional system of record and the retrieval layer. For example, a product documentation knowledge base with 10 million embedded documents processing 500 queries per second (QPS) requires hybrid search. A multi-model database can handle this workload effectively while also managing full-text search and query analytics. This approach prevents the latency spikes associated with specialized vector databases when they are forced to handle transactional metadata updates.

Security Configuration

  • Encryption at Rest: Enable transparent data encryption (TDE) for all data files.
  • Encryption in Transit: Enforce TLS 1.2 or higher for all client connections. Configure the connection configuration file (e.g., kingbase.conf) to reject unencrypted connections.
  • Identity Integration: Integrate with on-premises Identity Providers (LDAP/Active Directory) for centralized user management. This ensures that access control policies are managed outside the database, simplifying audits.

Multi-Model Schema for Knowledge Base Data

Designing a schema for an on-premises enterprise knowledge base database requires storing structured metadata, vector embeddings, and unstructured text efficiently. KingbaseES supports a multi-model architecture, allowing you to use relational tables and vector types within a single instance.

Schema Design Steps

  1. Create the Metadata Table: Store document attributes such as title, author, date, and jurisdiction. Use standard relational data types for fast filtering.

    CREATE TABLE knowledge_documents (
        doc_id BIGINT PRIMARY KEY,
        title VARCHAR(255) NOT NULL,
        author VARCHAR(100),
        publish_date DATE,
        jurisdiction VARCHAR(50),
        content_type VARCHAR(20)
    );
    
  2. Store Vector Embeddings: Use a dedicated vector data type to store embeddings. If your KingbaseES version supports native vector types, use them directly. If JSONB is used for hybrid storage, ensure you index the relevant keys for metadata filtering.

    -- Example using JSONB for vector storage (verify specific vector type support in your version)
    ALTER TABLE knowledge_documents ADD COLUMN embedding JSONB;
    
  3. Create Indexes for Hybrid Search:

    • Metadata Indexes: B-tree or GiST indexes on columns used in WHERE clauses (e.g., publish_date, jurisdiction).
    • Vector Indexes: If using a vector extension, create an HNSW or IVFFlat index on the embedding column. For JSONB, consider GIN indexes if you are filtering within the JSON structure.
    CREATE INDEX idx_knowledge_date ON knowledge_documents (publish_date);
    CREATE INDEX idx_knowledge_jurisdiction ON knowledge_documents (jurisdiction);
    -- Vector index creation depends on the specific extension enabled
    -- CREATE INDEX idx_knowledge_embedding ON knowledge_documents USING hnsw (embedding vector_cosine_ops);
    
  4. Optimize Query Planning: Use EXPLAIN ANALYZE to verify that the query planner uses the correct indexes for hybrid queries. Ensure that metadata filters are applied before vector similarity calculations to reduce the search space.

Configuring Enterprise Access Control

Strict access control is critical for enterprise knowledge bases. KingbaseES supports Role-Based Access Control (RBAC) and Row-Level Security (RLS) to enforce granular permissions.

RBAC Configuration

  1. Create Roles: Define roles based on job functions (e.g., admin, editor, viewer).

    CREATE ROLE editor WITH LOGIN PASSWORD 'secure_password';
    CREATE ROLE viewer WITH LOGIN PASSWORD 'secure_password';
    
  2. Grant Privileges: Assign specific privileges to each role.

    GRANT SELECT, INSERT, UPDATE ON knowledge_documents TO editor;
    GRANT SELECT ON knowledge_documents TO viewer;
    

Row-Level Security (RLS)

RLS ensures that users can only access rows relevant to their department or project.

  1. Enable RLS: Enable RLS on the target table. Consult KingbaseES documentation for specific syntax.

    -- Syntax may vary; verify with KingbaseES documentation
    ALTER TABLE knowledge_documents ENABLE ROW LEVEL SECURITY;
    
  2. Create Policies: Define policies based on user attributes. Consult KingbaseES documentation for specific function calls (e.g., current_setting).

    -- Syntax may vary; verify with KingbaseES documentation
    CREATE POLICY department_policy ON knowledge_documents
        FOR SELECT
        USING (jurisdiction = current_setting('app.jurisdiction'));
    
  3. Set Session Variables: Application code must set the session variables before querying.

    SET app.jurisdiction = 'US';
    

Verification

  • Test access by logging in as different roles.
  • Verify that viewer users cannot insert or update records.
  • Confirm that RLS policies correctly filter rows based on the session context.

Validating Hybrid Search Performance

Validating the performance of hybrid queries in an air-gapped environment requires benchmarking both metadata filtering and vector similarity search. Use a production-like dataset to ensure accurate results.

Benchmarking Strategy

  1. Dataset Preparation: Load a representative subset of your knowledge base (e.g., 1 million documents with embeddings).
  2. Query Mix: Create a mix of queries that emphasize metadata filtering, vector similarity, and hybrid search.
  3. Execution: Run queries using sysbench or a custom script to simulate concurrent user load.
  4. Metrics: Measure P95 and P99 latency, throughput (QPS), and CPU/memory usage.

Case Study: Legal Document RAG System

A benchmark on a production-grade legal document RAG system demonstrated the effectiveness of this approach. The system processed a corpus of 47 million chunks across 2.3 million legal documents. It utilized OpenAI text-embedding-3-large (3072 dimensions) and handled hybrid search workloads involving vector similarity and structured filters by date, type, and jurisdiction. The results showed that a multi-model database could handle these workloads effectively while maintaining low latency for structured filters.

Troubleshooting Performance Issues

  • High Latency on Metadata Filters: Check if the query planner is using the correct index. Use EXPLAIN to verify index usage.
  • Vector Search Degradation: Ensure the vector index is up-to-date. Rebuild the index if the data volume has changed significantly.
  • Resource Contention: Monitor CPU and I/O usage. If vector operations are causing I/O bottlenecks, consider offloading vector search to a dedicated node or using a separate vector store.

Migration Strategy from Legacy Systems

Migrating an existing knowledge base from legacy systems like MySQL, Oracle, or SQL Server to KingbaseES requires a structured approach to ensure data integrity and minimal downtime. KingbaseES offers a migration tool named KDMS for migrating from DB2, Oracle, SQL Server, and MySQL.

Migration Steps

  1. Assessment: Use KDMS to analyze the source database schema, data types, and stored procedures. Generate a migration assessment report.
  2. Schema Conversion: KDMS automatically generates SQL/PLSQL scripts for schema conversion. Review and adjust the scripts to ensure compatibility with KingbaseES.
  3. Data Migration: Execute the migration scripts to transfer data. Use KDMS to monitor the progress and handle any errors.
  4. Validation: Compare the data in the source and target databases to ensure accuracy. Verify that all records have been migrated successfully.
  5. Application Update: Update the application connection strings and drivers to point to the KingbaseES instance. Test all critical queries and transactions.

Case Study: China FAW Group

A case study by Zhang Junyu, a platform engineer at China FAW Group, demonstrated the migration from MySQL to KingbaseES. The focus was on compatibility, timeliness, system stability, and data security within a localized innovation framework. The migration highlighted the importance of using a dedicated tool like KDMS to ensure a smooth transition.

Ensuring High Availability in Production

High availability is critical for enterprise knowledge bases. KingbaseES provides a high availability test solution to verify availability across different deployment architectures. This solution helps you quickly complete use case verification under different scenario architectures, systematically accept the overall availability of the product, and ultimately achieve the goals of fault-free perception, optimized operation and maintenance costs, and large-scale efficient management.

High Availability Checklist

  • Deployment Architecture: Choose a supported HA architecture (e.g., primary-standby, shared-storage, or distributed).
  • Failover Testing: Simulate primary node failures to verify that the standby node takes over automatically.
  • Data Consistency: Ensure that data is replicated synchronously or asynchronously based on your RPO (Recovery Point Objective) requirements.
  • Monitoring: Set up monitoring for replication lag, node health, and query performance.
  • Backup and Recovery: Test regular backups and point-in-time recovery procedures.

Verification Steps

  1. Simulate Failure: Shut down the primary node.
  2. Observe Failover: Verify that the standby node becomes the new primary within the expected time frame.
  3. Check Data Integrity: Ensure that no data was lost during the failover.
  4. Resume Operations: Restart the failed node and verify that it rejoins the cluster as a standby.

Rollback Strategies for Index Updates

Vector index maintenance can cause latency spikes or configuration errors. Having a rollback strategy is essential to minimize downtime and data loss.

Rollback Plan

  1. Backup Index: Before rebuilding or updating the vector index, take a backup of the current index state.
  2. Test in Staging: Perform the index update in a staging environment first. Verify the performance and correctness of queries.
  3. Execute in Maintenance Window: Perform the index update during a scheduled maintenance window to minimize user impact.
  4. Monitor Performance: Monitor query latency and system resources during and after the update.
  5. Rollback Procedure: If performance degrades or errors occur, revert to the previous index version using the backup. Restore the database to the pre-update state if necessary.

Troubleshooting Index Updates

  • Index Corruption: If the index becomes corrupted, rebuild it from scratch. Use the REINDEX command.
  • Performance Degradation: If the new index performs worse than the old one, revert to the previous index. Analyze the query patterns to determine if the index parameters need adjustment.
  • Configuration Errors: If the index update was due to a configuration error, correct the configuration and reapply the index.

FAQ

What are the trade-offs between specialized vector databases and general-purpose relational databases for on-premises knowledge management?

Specialized vector databases excel at vector search but require separate infrastructure for metadata and transactional data, increasing operational complexity. General-purpose relational databases, especially multi-model ones like KingbaseES, can handle hybrid search workloads effectively while also managing logs, analytics, and transactional integrity. The trade-off is that specialized databases may offer slightly better vector search performance, but multi-model databases offer significant advantages in infrastructure consolidation and reduced maintenance overhead.

How to verify vendor SLA and commercial support for on-premises deployments?

Engage the vendor’s global or regional support team to define SLA terms for on-premises deployments. Verify that the vendor provides remote troubleshooting capabilities that comply with your air-gapped security policies. If remote access is prohibited, arrange for on-site engineer visits. Ensure that the support contract includes clear definitions of response times, resolution targets, and escalation paths.

What are the common failure modes and rollback strategies for on-premises vector index updates?

Common failure modes include index corruption, performance degradation due to suboptimal index parameters, and configuration errors. Rollback strategies include maintaining backups of the previous index state, testing updates in a staging environment, and executing updates during maintenance windows. If a failure occurs, revert to the previous index version using the backup. Analyze the failure to determine if the index parameters need adjustment or if the query patterns have changed.

Related reading


💡 More Resources

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:

  • Kingbase Community: A one-stop interactive platform for technical exchanges, Q&A, and experience sharing—join forces with fellow DBAs and developers.
  • Kingbase Solutions: 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.
  • Kingbase Case Studies: Real-world user scenarios and implementation outcomes, showcasing KingbaseES’s outstanding capabilities in high availability, high performance, and IT adaptation.
  • Kingbase Documentation: Authoritative and comprehensive product manuals and technical guides, covering the entire lifecycle from installation and deployment to development, programming, and operations management.
  • Free Download: Get the latest installation packages, drivers, tools, and patches, supporting multiple platforms and domestic chip architectures.
  • Digital Construction Encyclopedia: Covers digital strategy planning, data integration, metrics management, database visualization applications, and more to empower enterprise digital transformation.

Open Source Resources:

Welcome to explore the resources above and begin your Kingbase journey!