Skip to main content

KingbaseES Database Integration Guide

HAP Server uses MySQL as its default relational database. Since v4.8.0, it also supports KingbaseES. For environments with domestic technology requirements, you can use this database instead of MySQL.

Follow these integration steps:

  1. Deploy KingbaseES in single-node or primary-replica cluster mode (Professional or Enterprise Edition).

    For HAP standalone deployments or simplified clusters, choose single-node mode. For standard or professional clusters, choose primary-replica cluster mode.

  2. Note these two requirements when deploying KingbaseES:

    • Select Oracle mode.

    • Use case-insensitive mode.

  3. After deploying KingbaseES, download the HAP database initialization scripts and upload them to the KingbaseES environment.

  4. Initialize the data

    Connect to KingbaseES using ksql. See the ksql User Guide. ksql is located under ES/V9/Server/bin/ in the installation directory.

    Run the initialization scripts (adjust the IP address, port, username and SQL file paths for your environment). Enter the password when prompted.

    ./ksql -h 127.0.0.1 -p 54321 -U system -d test -f /usr/local/init_kes/1_Database.sql
    ./ksql -h 127.0.0.1 -p 54321 -U system -d test -f /usr/local/init_kes/2_MDProject.sql
    ./ksql -h 127.0.0.1 -p 54321 -U system -d test -f /usr/local/init_kes/3_MDStructure.sql
    ./ksql -h 127.0.0.1 -p 54321 -U system -d test -f /usr/local/init_kes/4_MDApplication.sql
    ./ksql -h 127.0.0.1 -p 54321 -U system -d test -f /usr/local/init_kes/5_MDCalendar.sql
    ./ksql -h 127.0.0.1 -p 54321 -U system -d test -f /usr/local/init_kes/6_MDLog.sql
    ./ksql -h 127.0.0.1 -p 54321 -U system -d test -f /usr/local/init_kes/7_Data_MDProject.sql
    ./ksql -h 127.0.0.1 -p 54321 -U system -d test -f /usr/local/init_kes/8_Data_MDApplication.sql
  5. Initialize HAP services

    Before initializing services, add the following environment variables (replace connection parameter values with actual values):

    ENV_RDB_TYPE: "4"
    ENV_RDB_URI_MDPROJECT: "Server=127.0.0.1;User Id=system;Password=******;Database=MDProject;Port=54321"
    ENV_RDB_URI_MDLOG: "Server=127.0.0.1;User Id=system;Password=******;Database=MDLog;Port=54321"
    ENV_RDB_URI_MDSTRUCTURE: "Server=127.0.0.1;User Id=system;Password=******;Database=MDStructure;Port=54321"
    ENV_RDB_URI_MDCALENDAR: "Server=127.0.0.1;User Id=system;Password=******;Database=MDCalendar;Port=54321"
    ENV_RDB_URI_MDAPPLICATION: "Server=127.0.0.1;User Id=system;Password=******;Database=MDApplication;Port=54321"
    ENV_STANDALONE_DISABLE_SERVICES: "mysql"
  6. Complete the remaining system initialization steps.