Skip to main content

Dameng Database Integration Guide

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

Follow these integration steps:

  1. Deploy Dameng DM8 in single-node or primary-replica cluster mode (Enterprise or Security 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 three requirements when deploying Dameng:

    • Use case-insensitive mode.

    • Edit dm.ini in the data directory to exclude reserved keywords.

      EXCLUDE_RESERVED_WORDS=status,type,interval
    • Use a separate user for each database (HAP requires five databases).

  3. After deploying Dameng, download the HAP database initialization scripts and upload them to the Dameng environment (inside the container for container deployments).

    1_Tablespace.sql contains database storage paths and initial passwords. Modify them as needed.
  4. Initialize the data

    Connect to Dameng using disql. See the SQL Interactive Query Tool. Adjust the username, password, IP address and port for your environment.

    /opt/dmdbms/bin/disql SYSDBA/SYSDBA001@127.0.0.1:5236

    Set the encoding

    SET CHAR_CODE UTF8

    Run the initialization scripts (adjust the /usr/local/init_dameng/ path for your environment).

    start /usr/local/init_dameng/1_Tablespace.sql
    start /usr/local/init_dameng/2_MDProject.sql
    start /usr/local/init_dameng/3_MDStructure.sql
    start /usr/local/init_dameng/4_MDApplication.sql
    start /usr/local/init_dameng/5_MDCalendar.sql
    start /usr/local/init_dameng/6_MDLog.sql
    start /usr/local/init_dameng/7_Data_MDProject.sql
    start /usr/local/init_dameng/8_Data_MDApplication.sql
  5. Initialize HAP services

    Before initializing services, add the following environment variables to connect to Dameng (replace connection parameter values with actual values).

    ENV_RDB_TYPE: "3"
    ENV_RDB_URI_MDPROJECT: "Server=127.0.0.1:5236;UserId=MDPROJECT;PWD=******;Database=MDPROJECT"
    ENV_RDB_URI_MDLOG: "Server=127.0.0.1:5236;UserId=MDLOG;PWD=******;Database=MDLOG"
    ENV_RDB_URI_MDSTRUCTURE: "Server=127.0.0.1:5236;UserId=MDSTRUCTURE;PWD=******;Database=MDSTRUCTURE"
    ENV_RDB_URI_MDCALENDAR: "Server=127.0.0.1:5236;UserId=MDCALENDAR;PWD=******;Database=MDCALENDAR"
    ENV_RDB_URI_MDAPPLICATION: "Server=127.0.0.1:5236;UserId=MDAPPLICATION;PWD=******;Database=MDAPPLICATION"
    ENV_STANDALONE_DISABLE_SERVICES: "mysql"
  6. Complete the remaining system initialization steps.