1. 安装milvus
ref:https://milvus.io/docs
第一次装东西,要把遇到的问题和成功经验都记录下来。
1.Download the YAML file
wget https://github.com/milvus-io/milvus/releases/download/v2.2.11/milvus-standalone-docker-compose.yml -O docker-compose.yml
看一下下载下来的是什么东西
cat 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
command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 -- data-dir /etcd
minio:
container_name: milvus-minio
image: minio/minio:RELEASE.2023-03-20T20-16-18Z
environment:
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
command: minio server /minio_data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
standalone:
container_name: milvus-standalone
image: milvusdb/milvus:v2.2.11
command: ["milvus", "run", "standalone"]
environment:
ETCD_ENDPOINTS: etcd:2379
MINIO_ADDRESS: minio:9000
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
ports:
- "19530:19530"
- "9091:9091"
depends_on:
- "etcd"
- "minio"
networks:
default:
Start Milvus
In the same directory as the docker-compose.yml file, start up Milvus by running:
sudo docker-compose up -d
报错则需要安装docker-compose了
(base) [root@localhost ~]# sudo docker-compose up -d
sudo: docker-compose:找不到命令
下载最新版的docker-compose 文件
https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64
添加可执行权限
[root@offline-client bin]# mv docker-compose-linux-x86_64 docker-compose
[root@offline-client bin]# docker-compose version
Docker Compose version v2.5.0
curl -SL https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
docker-compose version
(base) [root@localhost bin]# docker-compose version
Docker Compose version v2.5.0
Start Milvus
In the same directory as the docker-compose.yml file, start up Milvus by running:
sudo docker-compose up -d
回到docker-compose.yml所在的目录,执行 以上命令
开始安装了:
After Milvus standalone starts, there will be three docker containers running, including the Milvus standalone service and its two dependencies.
执行完以上命令,会有三个docker containers服务起来, 包括:Milvus standalone service and its two dependencies.
一个milvus单体服务。以及它的两个依赖。
Name Command State Ports
--------------------------------------------------------------------------------------------------------------------
milvus-etcd etcd -advertise-client-url ... Up 2379/tcp, 2380/tcp
milvus-minio /usr/bin/docker-entrypoint ... Up (healthy) 9000/tcp
milvus-standalone /tini -- milvus run standalone Up 0.0.0.0:19530->19530/tcp, 0.0.0.0:9091->9091/tcp
连接到Milvus
Verify which local port the Milvus server is listening on. Replace the container name with your own.
docker port milvus-standalone 19530/tcp
You can connect to Milvus cluster using the local IP address and port number returned by this command.
stop Milvus 停止Milvus
To stop Milvus standalone, run:
sudo docker-compose down
To delete data after stopping Milvus, run:
sudo rm -rf volumes
我的几个也起来了。
2. 使用milvus做事情
ref:https://milvus.io/docs/example_code.md
todo