安装

Alauda Data Services Vector Database E1 以 OLM operator package 的形式交付。安装分为两个独立步骤:先安装 operator,然后将 Milvus 实例创建为 custom resource。

现有 chart-plugin 安装

如果集群已通过 chart-milvus-operator cluster plugin 运行 Milvus,请勿在其旁边安装此 operator,也不要先卸载该 plugin。请改为遵循从 chart plugin 迁移。

前提条件

  • 一个 Alauda Container Platform 4.1、4.2、4.3 或 4.4 集群、amd64 或 arm64,并且已将 milvus-operator package 上传到平台。
  • 具有从 OperatorHub 安装 operator 的权限。
  • 一个默认的 StorageClass,或一个在实例中引用的命名 StorageClass。集群内的每个 etcd 成员和对象存储服务器都声明一个持久卷。
  • 为所创建拓扑提供足够的配额。下面的 standalone 示例运行 3 个 pod;cluster 示例运行 9 个 pod。

安装 operator

Web Console
  1. 登录平台并进入 Platform Management 页面。
  2. 在左侧导航栏中,选择 Marketplace > OperatorHub。
  3. 找到 Alauda Data Services Vector Database E1,单击 Install,然后进入部署页面。

配置参数:

参数推荐配置
Channelstable(默认 channel)。
Version默认选择最新版本。
Installation ModeCluster:一个 operator 管理所有 namespace 中的 Milvus 实例。这是唯一支持的模式。
Installation Location选择 Recommended Namespace:如果不存在,则自动创建。
Upgrade StrategyManual:OperatorHub 中的新版本需要手动确认后才能升级 operator。
  1. 检查设置,然后单击 Install。

检查 operator 是否正在运行:

kubectl get csv -A | grep milvus-operator
# milvus-operator.v1.3.10-acp.2 ... Succeeded

kubectl get crd milvuses.milvus.io milvusclusters.milvus.io milvusupgrades.milvus.io

创建 Milvus 实例

在您选择的 namespace 中创建实例。示例未设置任何镜像:operator 使用平台镜像仓库中随 operator 提供的 Milvus engine、etcd 和 Silo 镜像。engine 版本为 Milvus 2.6.24。

Pod Security

Alauda Container Platform 上的 namespace 通常会强制执行 Pod Security Standard restricted。operator 会为其创建的每个容器配置受限设置 (allowPrivilegeEscalation: false、删除所有 capabilities、seccompProfile: RuntimeDefault),并且集群内的 etcd 和 Silo pod 以非 root 用户运行。

对于 Milvus pod 本身,请设置 spec.components.runAsNonRoot: true,如两个示例所示。随后,operator 会以用户 1000 运行 Milvus 容器,并将 pod 标记为 runAsNonRoot。如果不设置该参数,强制执行 restricted 的 namespace 会拒绝 Milvus pod。

Standalone

所有 Milvus 功能都在一个 pod 中运行,并使用单成员 etcd 和单个 Silo server。适用于开发、测试和小型数据集。

milvus-standalone.yaml
apiVersion: milvus.io/v1beta1
kind: Milvus
metadata:
  name: milvus-standalone
  namespace: <namespace>
  labels:
    app: milvus
spec:
  mode: standalone
  components:
    runAsNonRoot: true
  dependencies:
    # Metadata store: in-cluster etcd.
    etcd:
      inCluster:
        values:
          replicaCount: 1
          persistence:
            size: 5Gi
    # Object storage: in-cluster Silo (S3-compatible).
    storage:
      type: MinIO
      inCluster:
        values:
          mode: standalone
          persistence:
            size: 20Gi
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
  config:
    milvus:
      log:
        level: info

storage.type: MinIO 选择 S3-compatible 存储协议。operator 为其安装的集群内 server 是 Silo。其 Deployment、Service 和 PVC 保留历史名称 <instance-name>-minio,但容器运行的是 Silo 镜像。

Cluster

Milvus 功能作为独立组件运行(Proxy、MixCoord、QueryNode、DataNode 和 StreamingNode),并使用三成员 etcd。消息流为 Woodpecker,它是 Milvus engine 的一部分,无需额外的 pod。

milvus-cluster.yaml
apiVersion: milvus.io/v1beta1
kind: Milvus
metadata:
  name: milvus-cluster
  namespace: <namespace>
  labels:
    app: milvus
spec:
  mode: cluster
  components:
    runAsNonRoot: true
  dependencies:
    # Message stream: Woodpecker, built into Milvus 2.6.
    # Without this line cluster mode defaults to an in-cluster Pulsar,
    # whose images are not delivered with this release.
    msgStreamType: woodpecker
    # Metadata store: in-cluster etcd.
    etcd:
      inCluster:
        values:
          replicaCount: 3
          persistence:
            size: 10Gi
    # Object storage: in-cluster Silo (S3-compatible).
    storage:
      type: MinIO
      inCluster:
        values:
          mode: standalone
          persistence:
            size: 50Gi
          resources:
            requests:
              cpu: 250m
              memory: 256Mi
            limits:
              cpu: 1000m
              memory: 1Gi
  config:
    milvus:
      log:
        level: info
    component:
      proxy:
        timeTickInterval: 150

如需改用外部 S3-compatible 服务或外部 Kafka 或 Pulsar,请参阅 Milvus custom resource 的 spec.dependencies reference。

应用并检查

kubectl apply -f milvus-standalone.yaml

# Wait until the instance reports Healthy (a few minutes on first start).
kubectl -n <namespace> get milvus milvus-standalone

kubectl -n <namespace> get pods -l app.kubernetes.io/instance=milvus-standalone

当状态为 Healthy 时,客户端通过端口 19530 连接到 Service <instance-name>-milvus (gRPC 和 REST),例如 milvus-standalone-milvus.<namespace>.svc:19530。

删除实例

删除 Milvus resource 会移除 Milvus pod。使用默认设置时,集群内的 etcd 和 object storage release 及其 persistent volume 会保留 (deletionPolicy: Retain)。如需将其与实例一同移除,请在删除实例前,在 spec.dependencies.etcd.inCluster 和 spec.dependencies.storage.inCluster 下设置 deletionPolicy: Delete 和 pvcDeletion: true。


Milvus™ 是 The Linux Foundation 的商标。Alauda 是独立供应商。本产品与 The Linux Foundation 无关联,也未获得其认可或赞助。所有商标均归其各自所有者所有,此处仅用于标识目的。