通过下载docker镜像部署milvus2.3.5
环境:
Os:Centos 7
milvus:2.3.5
1.查看docker和docker-compose版本
[root@host134 milvus]# docker -v
Docker version 26.1.4, build 5650f9b
[root@host134 milvus]# docker-compose -v
docker-compose version 1.29.2, build unknown
2.准备目录
mkdir -p /home/middle/milvus
3.下载docker镜像
通过vpnFQ下载
下载后的文件存放在 /soft/milvus 目录
[root@host134 milvus]# ls -1
attu.tar.gz
etcd.tar.gz
milvus.tar.gz
minio.tar.gz
4.下载docker-compose.yml
进入到milvus目录执行命令
# CPU单机版
cd /home/middle/milvus
wget https://github.com/milvus-io/milvus/releases/download/v2.3.5/milvus-standalone-docker-compose.yml -O docker-compose.yml
# GPU单机版
cd /home/middle/milvus
wget https://github.com/milvus-io/milvus/releases/download/v2.3.5/milvus-standalone-docker-compose-gpu.yml -O docker-compose.yml
下载安装文件,注意这里的路径版本是v2.3.5,根据自己实际情况选择CPU和GPU版本,不清楚的话就选CPU版本.
5.下载milvus.yml文件
进入到milvus目录执行
cd /home/middle/milvus
# 注意改成自己对应的milvus版本号
wget https://raw.githubusercontent.com/milvus-io/milvus/v2.3.5/configs/milvus.yaml
报错误:
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8002::154|:443... failed: Network is unreachable.
解决办法:
查询raw.githubusercontent.com的真实IP
在https://www.ipaddress.com/ 查询raw.githubuercontent.com的真实IP.
raw.githubusercontent.com has IPv4 address 185.199.108.133
raw.githubusercontent.com has IPv4 address 185.199.109.133
raw.githubusercontent.com has IPv4 address 185.199.110.133
raw.githubusercontent.com has IPv4 address 185.199.111.133
修改hosts
在/etc/hosts/中绑定查到的host,例如:
185.199.108.133 raw.githubusercontent.com
下载好后,确保该文件位于milvus工作目录下,然后编辑该文件,找到其中的common > security > authorizationEnabled 并将其设置为true
security:
authorizationEnabled: true
6.编辑docker-compose.yml文件
[root@host134 milvus]# more 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 /etc
d
healthcheck:
test: ["CMD", "etcdctl", "endpoint", "health"]
interval: 30s
timeout: 20s
retries: 3
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: 30s
timeout: 20s
retries: 3
standalone:
container_name: milvus-standalone
image: milvusdb/milvus:v2.3.5
command: ["milvus", "run", "standalone"]
security_opt:
- seccomp:unconfined
environment:
ETCD_ENDPOINTS: etcd:2379
MINIO_ADDRESS: minio:9000
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
- ${DOCKER_VOLUME_DIRECTORY:-.}/milvus.yaml:/milvus/configs/milvus.yaml
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"
attu:
container_name: attu
image: zilliz/attu:v2.3.6
environment:
MILVUS_URL: milvus-standalone:19530
ports:
- "8000:3000"
depends_on:
- "standalone"
networks:
default:
name: milvus
红色标准部分
a.增下面这一行来实现配置文件的映射
- ${DOCKER_VOLUME_DIRECTORY:-.}/milvus.yaml:/milvus/configs/milvus.yaml
b.添加attu部分
attu:
container_name: attu
image: zilliz/attu:v2.3.6
environment:
MILVUS_URL: milvus-standalone:19530
ports:
- "8000:3000"
depends_on:
- "standalone"
7.加载镜像cd到milvus文件夹下,Docker加载镜像.
cd到镜像存放的目录
[root@host134 milvus]# cd /soft/milvus
[root@host134 milvus]#docker load -i ./milvus.tar.gz
Loaded image: milvusdb/milvus:v2.3.5
[root@host134 milvus]#docker load -i ./etcd.tar.gz
Loaded image: quay.io/coreos/etcd:v3.5.5
[root@host134 milvus]#docker load -i ./minio.tar.gz
Loaded image: minio/minio:RELEASE.2023-03-20T20-16-18Z
[root@host134 milvus]#docker load -i ./attu.tar.gz
Loaded image: zilliz/attu:v2.3.6
8.查看镜像
[root@host134 milvus]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
milvusdb/milvus v2.3.5 49ec7be59e9e 6 months ago 968MB
zilliz/attu v2.3.6 3905dd95d828 6 months ago 282MB
minio/minio RELEASE.2023-03-20T20-16-18Z 400c20c8aac0 16 months ago 252MB
quay.io/coreos/etcd v3.5.5 673f29d03de9 23 months ago 182MB
9.启动镜像
进入到/home/middle/milvus目录
[root@host134 milvus]# cd /home/middle/milvus
[root@host134 milvus]# docker-compose up -d
/usr/local/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
from cryptography.hazmat.backends import default_backend
milvus-etcd is up-to-date
Starting milvus-minio ... done
Creating milvus-standalone ... done
Creating attu ... done
或是按照如下方式启动
[root@middle milvus]# docker-compose -f /home/middle/milvus/docker-compose.yml up -d
10.浏览器访问
http://192.168.1.134:8000
默认的用户和密码
root/Milvus
11.查看
# 查看启动状态(健康状态)
[root@host134 milvus]# docker-compose ps -a
docker-compose ps -a
Name Command State Ports
----------------------------------------------------------------------------------------------------------------------
attu docker-entrypoint.sh /bin/ ... Up 0.0.0.0:8000->3000/tcp,:::8000->3000/tcp
milvus-etcd etcd -advertise-client-url ... Up (healthy) 2379/tcp, 2380/tcp
milvus-minio /usr/bin/docker-entrypoint ... Up (healthy) 0.0.0.0:9000->9000/tcp,:::9000->9000/tcp,
0.0.0.0:9001->9001/tcp,:::9001->9001/tcp
milvus-standalone /tini -- milvus run standalone Up (healthy) 0.0.0.0:19530->19530/tcp,:::19530->19530/tcp,
0.0.0.0:9091->9091/tcp,:::9091->9091/tcp
# 停止容器
docker-compose down