使用Docker Compose安装 Milvus standalone(即单机版),进行一个快速milvus的体验。
前提条件:
1.系统可以使用centos
2.系统已经安装docker和docker-compose
3.milvus版本这里选择2.3.1
由于milvus依赖etcd和minio,因此需要先启动这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
修改docker-compose.yml
修改后的docker-compose.yml文件内容如下:
version: '3.5'
services:
etcd:
container_name: milvus-etcd
image: quay.io/coreos/etcd:v3.5.5
environment:
- ETCD_AUTO_COMPACTION_MODE=revision
- ETCD_AUTO_COMPACTION_RETENTION=1000
- ETCD_QUOTA_BACKEND_BYTES=4294967296
- ETCD_SNAPSHOT_COUNT=50000
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
ports:
- "2379:2379"
command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
healthcheck:
test: ["CMD", "etcdctl", "endpoint", "health"]
interval: 5s
timeout: 3s
retries: 10
minio:
container_name: milvus-minio
image: minio/minio:RELEASE.2023-03-20T20-16-18Z
environment:
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
ports:
- "9001:9001"
- "9000:9000"
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/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: milvusdb/milvus:v2.3.1
command: ["milvus", "run", "standalone"]
environment:
ETCD_ENDPOINTS: etcd:2379
MINIO_ADDRESS: minio:9000
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/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
二、启动milvus
docker-compose up -d
-d 代表后台启动
报错命令不存在
下载docker-compose
wget https://github.com/docker/compose/releases/download/v2.3.1/docker-compose-linux-x86_64
复制docker-compose
sudo cp -arf docker-compose-linux-x86_64 /usr/bin/docker-compose
docker-compose -version
权限不够
sudo chmod +x /usr/bin/docker-compose
重新启动
docker-compose up -d
三、查看状态
docker-compose ps 查看容器
docker-compose stop 停止容器
docker-compose start 启动容器
docker-compose down 停止并删除容器(特别注意以免误删容器)
这时候已经完成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
web访问地址:
http:// 192.168.181.136:8000/
起初地址写错
查看所有容器
docker ps –a
Attu
被占用,且正在运行
停止运行
docker stop 1e65307769bc
docker rm NAME/CONTAINER ID
删除一个容器
重新来一遍步骤4 ,ip要写对哦