加载中...

Milvus Standalone安装

Milvus Standalone安装

使用Docker Compose安装 Milvus standalone(即单机版),进行一个快速milvus的体验。

前提条件:

1.系统可以使用centos

2.系统已经安装docker和docker-compose

3.milvus版本这里选择2.3.1

由于milvus依赖etcdminio,因此需要先启动这2个组件。同样也使用docker进行启动。
etcd:用来存储milvus的元数据。
minio:用来存储milvus的向量数据和索引数据。

一、下载milvus-standalone-docker-compose.yml 文件,保存为docker-compose.yml:

wget https://github.com/milvus-io/milvus/releases/download/v2.3.1/milvus-standalone-docker-compose.yml -O docker-compose.yml

New Image

修改docker-compose.yml

修改后的docker-compose.yml文件内容如下:

  1. version: ''3.5''
  2. services:
  3.   etcd:
  4.     container_name: milvus-etcd
  5.     image: quay.io/coreos/etcd:v3.5.5
  6.     environment:
  7.       - ETCD_AUTO_COMPACTION_MODE=revision
  8.       - ETCD_AUTO_COMPACTION_RETENTION=1000
  9.       - ETCD_QUOTA_BACKEND_BYTES=4294967296
  10.       - ETCD_SNAPSHOT_COUNT=50000
  11.     volumes:
  12.       - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
  13.     ports:
  14.       - "2379:2379"
  15.     command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
  16.     healthcheck:
  17.       test: ["CMD", "etcdctl", "endpoint", "health"]
  18.       interval: 5s
  19.       timeout: 3s
  20.       retries: 10
  21.   minio:
  22.     container_name: milvus-minio
  23.     image: minio/minio:RELEASE.2023-03-20T20-16-18Z
  24.     environment:
  25.       MINIO_ACCESS_KEY: minioadmin
  26.       MINIO_SECRET_KEY: minioadmin
  27.     ports:
  28.       - "9001:9001"
  29.       - "9000:9000"
  30.     volumes:
  31.       - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
  32.     command: minio server /minio_data --console-address ":9001"
  33.     healthcheck:
  34.       test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
  35.       interval: 5s
  36.       timeout: 3s
  37.       retries: 10
  38.   standalone:
  39.     container_name: milvus-standalone
  40.     image: milvusdb/milvus:v2.3.1
  41.     command: ["milvus", "run", "standalone"]
  42.     environment:
  43.       ETCD_ENDPOINTS: etcd:2379
  44.       MINIO_ADDRESS: minio:9000
  45.     volumes:
  46.       - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
  47.     healthcheck:
  48.       test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
  49.       interval: 30s
  50.       start_period: 90s
  51.       timeout: 20s
  52.       retries: 3
  53.     ports:
  54.       - "19530:19530"
  55.       - "9091:9091"
  56.     depends_on:
  57.       - "etcd"
  58.       - "minio"
  59. networks:
  60.   default:
  61. name: milvus

二、启动milvus

docker-compose up -d

-d 代表后台启动

报错命令不存在

New Image

下载docker-compose

wget https://github.com/docker/compose/releases/download/v2.3.1/docker-compose-linux-x86_64

New Image

复制docker-compose

sudo cp -arf docker-compose-linux-x86_64 /usr/bin/docker-compose
docker-compose -version

New Image

权限不够

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

重新启动

docker-compose up -d

New Image

三、查看状态

docker-compose ps  查看容器

docker-compose stop 停止容器

docker-compose start 启动容器

docker-compose down  停止并删除容器(特别注意以免误删容器)

New Image

这时候已经完成milvus服务的启动。如果想查看milvus的日志,可以使用如下命令:

docker logs -f milvus-standalone

四、启动attu

docker run -d \

--name=attu \

-p 8000:3000 \

-e MILVUS_URL=192.168.181.136:19530 \

zilliz/attu:v2.3.1

New Image

web访问地址:

http:// 192.168.181.136:8000/

起初地址写错

New Image

查看所有容器

docker ps –a

New Image

Attu被占用,且正在运行

停止运行 docker stop 1e65307769bc

New Image

docker rm NAME/CONTAINER ID删除一个容器

New Image

重新来一遍步骤4 ,ip要写对哦

New Image