🚀 免費嘗試 Zilliz Cloud,完全托管的 Milvus,體驗速度提升 10 倍!立即嘗試

milvus-logo
LFAI
主頁
  • 工具
  • Home
  • Docs
  • 工具

  • Milvus CDC

  • 部署 CDC 伺服器

部署 CDC 伺服器

本指南提供部署 Milvus-CDC 伺服器的逐步過程。

先決條件

在部署 Milvus-CDC 伺服器之前,確保符合下列條件:

  • Milvus Instances:源 Milvus 和至少一個目標 Milvus 都應已部署並運作。

    • 源和目標 Milvus 版本都必須是 2.3.2 或更高,最好是 2.4.x。我們建議使用相同版本的源和目標 Milvus 以確保兼容性。

    • 將目標 Milvus 的common.ttMsgEnabled 設定為false

    • 使用不同的元和訊息儲存設定來設定來源和目標 Milvus,以防止衝突。例如,避免在多個 Milvus 實體中使用相同的 etcd 和 rootPath 設定,以及相同的 Pulsar 服務和chanNamePrefix

  • 元端儲存:為 Milvus-CDC 元資料庫準備好 etcd 或 MySQL 資料庫。

步驟

取得 Milvus-CDC 的設定檔

克隆Milvus-CDC 倉庫,並導航至milvus-cdc/server/configs 目錄,以存取cdc.yaml 配置檔案。

git clone https://github.com/zilliztech/milvus-cdc.git

cd milvus-cdc/server/configs

編輯設定檔

milvus-cdc/server/configs 目錄中,修改cdc.yaml 檔案,以自訂與 Milvus-CDC 元端程式庫及來源 Milvus 連線細節相關的設定。

  • 元端儲存配置

    • metaStoreConfig.storeType:Milvus-CDC 的 metastore 類型。可能的值是etcdmysql

    • metaStoreConfig.etcdEndpoints:連線至 Milvus-CDC 的 etcd 位址。如果storeType 設為etcd 則必須。

    • metaStoreConfig.mysqlSourceUrl:Milvus-CDC 伺服器 MySQL 資料庫的連線位址。如果storeType 設為mysql 則需要。

    • metaStoreConfig.rootPath:Milvus-CDC 元庫的根目錄。此設定可實現多租戶功能,允許多個 CDC 服務使用相同的 etcd 或 MySQL 實例,同時透過不同的根目錄實現隔離。

    配置範例:

    # cdc meta data config
    metaStoreConfig:
      # the metastore type, available value: etcd, mysql
      storeType: etcd
      # etcd address
      etcdEndpoints:
        - localhost:2379
      # mysql connection address
      # mysqlSourceUrl: root:root@tcp(127.0.0.1:3306)/milvus-cdc?charset=utf8
      # meta data prefix, if multiple cdc services use the same store service, you can set different rootPaths to achieve multi-tenancy
      rootPath: cdc
    
  • 源 Milvus 配置:

    指定來源 Milvus 的連線細節,包括 etcd 和訊息儲存,以建立 Milvus-CDC 伺服器與來源 Milvus 的連線。

    • sourceConfig.etcdAddress:連接來源 Milvus 的 etcd 位址。如需詳細資訊,請參閱etcd 相關的設定

    • sourceConfig.etcdRootPath:來源 Milvus 在 etcd 中儲存資料的 key 的 Root 前綴。根據 Milvus 實例的部署方法,其值可能會有所不同:

      • HelmDocker Compose:預設為by-dev

      • 操作員:Defaults to<release_name>.

    • replicateChan:milvus 複製通道名稱,在 milvus.yaml 檔案中為{msgChannel.chanNamePrefix.cluster}/{msgChannel.chanNamePrefix.replicateMsg}

    • sourceConfig.pulsar:源 Milvus 的 Pulsar 配置。如果來源 Milvus 使用 Kafka 儲存訊息,請移除所有與 Pulsar 相關的設定。如需詳細資訊,請參閱Pulsar 相關設定

    • sourceConfig.kafka.address:來源 Milvus 的 Kafka 位址。如果來源 Milvus 使用 Kafka 儲存訊息,請取消註解此組態。

配置範例:

# milvus-source config, these settings are basically the same as the corresponding configuration of milvus.yaml in milvus source.
sourceConfig:
  # etcd config
  etcdAddress:
    - localhost:2379
  etcdRootPath: by-dev
  etcdMetaSubPath: meta
  # default partition name
  defaultPartitionName: _default
  # read buffer length, mainly used for buffering if writing data to milvus-target is slow.
  readChanLen: 10
  replicateChan: by-dev-replicate-msg
  # milvus-source mq config, which is pulsar or kafka
  pulsar:
    address: pulsar://localhost:6650
    webAddress: localhost:80
    maxMessageSize: 5242880
    tenant: public
    namespace: default
#    authPlugin: org.apache.pulsar.client.impl.auth.AuthenticationToken
#    authParams: token:xxx
#  kafka:
#    address: 127.0.0.1:9092

編譯 Milvus-CDC 伺服器

儲存cdc.yaml 檔案後,導覽到milvus-cdc 目錄,並執行下列其中一個指令來編譯伺服器:

  • 對於二進位檔案

    make build
    
  • 對於 Docker 映像檔

    bash build_image.sh
    

    對於 Docker 映像檔,將已編譯的檔案掛載到容器內的/app/server/configs/cdc.yaml

啟動伺服器

  • 使用二進位檔案

    導覽到包含milvus-cdc 二進位檔案的目錄,以及包含cdc.yaml 檔案的configs 目錄,然後啟動伺服器:

    # dir tree
    .
    ├── milvus-cdc # build from source code or download from release page
    ├── configs
    │   └── cdc.yaml # config for cdc and source milvus
    
    # start milvus cdc
    ./milvus-cdc server
    
  • 使用 Docker Compose:

    docker compose up -d
    

免費嘗試托管的 Milvus

Zilliz Cloud 無縫接入,由 Milvus 提供動力,速度提升 10 倍。

開始使用
反饋

這個頁面有幫助嗎?