milvus 向量数据库安装-milvus 安装

时间:2025-03-31 11:19:20

初始化主机挂载目录

mkdir -p /zpaas/volumes/etcd
mkdir -p /zpaas/volumes/milvus
mkdir -p /zpaas/volumes/minio
chmod 700 /zpaas/volumes/etcd

docker-compose-milvus.yml

version: '3.5'
services:
  etcd:
    container_name: milvus-etcd
    image: hub-nj.iwhalecloud.com/zcm_k8s/etcd:3.5.6-0
    environment:
      - ETCD_AUTO_COMPACTION_MODE=revision
      - ETCD_AUTO_COMPACTION_RETENTION=1000
      - ETCD_QUOTA_BACKEND_BYTES=4294967296
      - ETCD_SNAPSHOT_COUNT=50000
    volumes:
      - /zpaas/volumes/etcd:/etcd
    ports:
      - "3379:3379"
    command: etcd -advertise-client-urls=http://127.0.0.1:3379 -listen-client-urls http://0.0.0.0:3379 --data-dir /etcd
    healthcheck:
      test: ["CMD", "etcdctl", "endpoint", "health"]
      interval: 5s
      timeout: 3s
      retries: 10
 
  minio:
    container_name: milvus-minio
    image: hub-nj.iwhalecloud.com/public/minio:RELEASE.2023-03-20T20-16-18Z
    environment:
      MINIO_ACCESS_KEY: minioadmin
      MINIO_SECRET_KEY: minioadmin
    ports:
      - "9001:9001"
      - "9000:9000"
    volumes:
      - /zpaas/volumes/minio:/minio_data
    command: minio server /minio_data --console-address ":9001"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
      interval: 5s
      timeout: 3s
      retries: 10
 
  standalone:
    container_name: milvus-standalone
    image: hub-nj.iwhalecloud.com/public/milvus:v2.4.5
    command: ["milvus", "run", "standalone"]
    security_opt:
      - seccomp:unconfined
    environment:
      ETCD_ENDPOINTS: etcd:3379
      MINIO_ADDRESS: minio:9000
    volumes:
      - /zpaas/volumes/milvus:/var/lib/milvus
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
      interval: 30s
      start_period: 90s
      timeout: 20s
      retries: 3
    ports:
      - "19530:19530"
      - "9091:9091"
    depends_on:
      - "etcd"
      - "minio"
 
networks:
  default:
    name: milvus

启动

docker-compose -f docker-compose-milvus.yml up -d

查看

root@10.10.194.210[/zpaas/volumes]# docker ps -a  | grep milvus
df9f6e31a2f6   hub-nj.iwhalecloud.com/public/milvus:v2.4.5                        "/tini -- milvus run…"   33 minutes ago       Up 33 minutes (healthy)     0.0.0.0:9091->9091/tcp, :::9091->9091/tcp, 0.0.0.0:19530->19530/tcp, :::19530->19530/tcp   milvus-standalone
3e4c32da554c   hub-nj.iwhalecloud.com/public/minio:RELEASE.2023-03-20T20-16-18Z   "/usr/bin/docker-ent…"   33 minutes ago       Up 33 minutes (healthy)     0.0.0.0:9000-9001->9000-9001/tcp, :::9000-9001->9000-9001/tcp                              milvus-minio
be224b2f19d7   hub-nj.iwhalecloud.com/zcm_k8s/etcd:3.5.6-0                        "etcd -advertise-cli…"   33 minutes ago       Up 33 minutes (unhealthy)   2379-2380/tcp, 4001/tcp, 7001/tcp, 0.0.0.0:3379->3379/tcp, :::3379->3379/tcp               milvus-etcd
root@10.10.194.210[/zpaas/volumes]# docker exec -it milvus-etcd etcdctl --endpoints=http://127.0.0.1:3379 endpoint health
http://127.0.0.1:3379 is healthy: successfully committed proposal: took = 9.597225ms