Skip to main content

How to enable the Vector Knowledge Base

Note

The Vector Knowledge Base is an extension module of this product. It provides vector retrieval and semantic search capabilities for worksheets. You can enable it as needed.

⚠️ Note: The Vector Knowledge Base feature requires a "Super Search" license. Without this license, you still cannot create a knowledge base after deployment.

Environment Requirements

Before enabling this feature, make sure the server meets the following requirements (dedicated deployment is strongly recommended):

Milvus standalone mode includes three components: Milvus, MinIO, and etcd. Total memory usage is about 6-8 GB. Do not enable this feature on servers with less than 8 GB available memory.

ComponentMinimum RequirementRecommended
Docker20.10.16 or later-
CPU4 cores (supports SSE4.2 / AVX)4+ cores
Available Memory8 GB16 GB+
DiskSATA SSDNVMe SSD

Deploy Milvus

Milvus can be deployed on a dedicated server or merged into the HAP deployment, depending on server resources and operations requirements.

Option 1: Milvus Dedicated Server Deployment

Use this option when you have a dedicated server or want to maintain the vector database separately from the HAP main service.

Install Docker and Docker Compose

  1. Install Docker

    Install Docker by referring to the official Linux installation guide or the Docker installation section in the deployment example.

  2. Download the Docker Compose binary

    wget https://pdpublic.mingdao.com/private-deployment/offline/common/docker-compose-linux-x86_64
  3. Move the binary to the executable path

    mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
  4. Add executable permission

    chmod +x /usr/local/bin/docker-compose

Deploy Milvus

  1. Pull images (Offline package download)

    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-etcd:v3.5.25
    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2025-04-22T22-12-26Z
    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-milvus:v2.6.14
  2. Create data directories

    Define the Milvus deployment path. The following example uses /data/mingdao/script.

    mkdir -p /data/mingdao/script

    Create the required data mount directories under the deployment path.

    cd /data/mingdao/script
    mkdir -p ./volume/data/milvus/{etcd,minio,data}
  3. Create milvus.yaml under the deployment path

    version: "3.5"

    services:
    etcd:
    container_name: milvus-etcd
    restart: always
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-etcd:v3.5.25
    environment:
    - ETCD_AUTO_COMPACTION_MODE=revision
    - ETCD_AUTO_COMPACTION_RETENTION=1000
    - ETCD_QUOTA_BACKEND_BYTES=4294967296
    - ETCD_SNAPSHOT_COUNT=50000
    volumes:
    - ./volume/data/milvus/etcd:/etcd
    command: etcd -advertise-client-urls=http://etcd:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd

    minio:
    container_name: milvus-minio
    restart: always
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2025-04-22T22-12-26Z
    environment:
    MINIO_ROOT_USER: minioadmin
    MINIO_ROOT_PASSWORD: minioadmin
    volumes:
    - ./volume/data/milvus/minio:/minio_data
    command: minio server /minio_data --console-address ":9001"

    milvus:
    container_name: milvus-standalone
    restart: always
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-milvus:v2.6.14
    command: ["milvus", "run", "standalone"]
    security_opt:
    - seccomp:unconfined
    environment:
    ETCD_ENDPOINTS: etcd:2379
    MINIO_ADDRESS: minio:9000
    MINIO_ACCESS_KEY_ID: minioadmin
    MINIO_SECRET_ACCESS_KEY: minioadmin
    MINIO_BUCKET_NAME: mdmilvus
    COMMON_SECURITY_AUTHORIZATIONENABLED: "true"
    MQ_TYPE: woodpecker
    volumes:
    - ./volume/data/milvus/data:/var/lib/milvus
    ports:
    - 19530:19530
    depends_on:
    - etcd
    - minio

    Reuse an existing MinIO service (optional)

    If a MinIO service already exists in this product deployment, Milvus can reuse it without deploying another MinIO service:

    1. Remove the minio service definition from docker-compose.yaml
    2. Remove - minio from depends_on in the milvus service
    3. Update the following environment variables in the milvus service:
      • MINIO_ADDRESS: change it to the existing MinIO service address, for example 192.168.1.100:9000
      • MINIO_ACCESS_KEY_ID: change it to the existing MinIO Access Key
      • MINIO_SECRET_ACCESS_KEY: change it to the existing MinIO Secret Key
      • MINIO_BUCKET_NAME: it is recommended to keep mdmilvus; Milvus will create it automatically
  4. Start services

    docker-compose -f milvus.yaml up -d

    To stop the Milvus service later, run:

    docker-compose -f milvus.yaml down
  5. Change the default Milvus password (required)

    Default Milvus account:

    • Username: root
    • Password: Milvus

    You must change the default password after the first startup. When running the following command, replace your_password with the actual password and keep it safe.

    docker exec -it milvus-standalone bash

    TOKEN=$(echo -n 'root:Milvus' | base64 -w0)

    curl -s -X POST 'http://localhost:19530/v2/vectordb/users/update_password' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Basic $TOKEN" \
    -d '{"userName": "root", "password": "Milvus", "newPassword": "your_password"}'

    A response of {"code":0,"data":{}} indicates success.

Option 2: Merge Milvus into HAP Deployment

Note

This option deploys Milvus-related components on the same server as HAP. Make sure the server has enough free resources. If you use this option, the minimum recommended server specification is 16C 64G, and the data disk must be an SSD.

Deploy Milvus

  1. Pull images (Offline package download)

    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-etcd:v3.5.25
    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2025-04-22T22-12-26Z
    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-milvus:v2.6.14
  2. Create data mount directories

    mkdir -p /data/mingdao/script/volume/data/milvus/{etcd,minio,data}
  3. Run the following command and check whether the output contains a line with the keyword start minio

    docker logs $(docker ps | grep mingdaoyun-sc | awk '{print $1}') | grep minio

    Edit the HAP service docker-compose.yaml file. The default path is /data/mingdao/script/docker-compose.yaml. Add the following services:

      etcd:
    container_name: milvus-etcd
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-etcd:v3.5.25
    environment:
    - ETCD_AUTO_COMPACTION_MODE=revision
    - ETCD_AUTO_COMPACTION_RETENTION=1000
    - ETCD_QUOTA_BACKEND_BYTES=4294967296
    - ETCD_SNAPSHOT_COUNT=50000
    volumes:
    - ./volume/data/milvus/etcd:/etcd
    command: etcd -advertise-client-urls=http://etcd:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd

    milvus:
    container_name: milvus-standalone
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-milvus:v2.6.14
    command: ["milvus", "run", "standalone"]
    security_opt:
    - seccomp:unconfined
    environment:
    ETCD_ENDPOINTS: etcd:2379
    MINIO_ADDRESS: sc:9010
    MINIO_ACCESS_KEY_ID: mdstorage
    MINIO_SECRET_ACCESS_KEY: eBxExGQJNhGosgv5FQJiVNqH
    MINIO_BUCKET_NAME: mdmilvus
    COMMON_SECURITY_AUTHORIZATIONENABLED: "true"
    MQ_TYPE: woodpecker
    volumes:
    - ./volume/data/milvus/data:/var/lib/milvus
    depends_on:
    - etcd
  4. Restart HAP services

    bash ./service.sh restartall
  5. Change the default Milvus password (required)

    Default Milvus account:

    • Username: root
    • Password: Milvus

    You must change the default password after the first startup. When running the following command, replace your_password with the actual password and keep it safe.

    docker exec -it milvus-standalone bash

    TOKEN=$(echo -n 'root:Milvus' | base64 -w0)

    curl -s -X POST 'http://localhost:19530/v2/vectordb/users/update_password' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Basic $TOKEN" \
    -d '{"userName": "root", "password": "Milvus", "newPassword": "your_password"}'

    A response of {"code":0,"data":{}} indicates success.

Integrate with the HAP Main Service

After completing either Milvus deployment option, integrate the RAG service with the HAP main service.

  1. Pull the RAG service image on the HAP server (Offline package download)

    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-rag:1.0.0
  2. Add the RAG service

    Append the following to the HAP main service docker-compose.yaml:

      rag:
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-rag:1.0.0
    environment:
    <<: *app-environment
  3. Add environment variables

    Add the following environment variables under the app service in the HAP main service docker-compose.yaml. Select the configuration based on the Milvus deployment option:

      app:
    environment:
    ENV_RAG_ENABLE: "true"
    ENV_MILVUS_URL: "http://{Milvus internal IP}:19530"
    ENV_MILVUS_DATABASE: "default"
    ENV_MILVUS_USERNAME: "root"
    ENV_MILVUS_PASSWORD: "your_password"

    Change the ENV_MILVUS_PASSWORD environment variable to the custom Milvus password configured earlier.

  4. Run bash ./service.sh restartall in the manager root directory to restart services, and wait until the command completes.