未验证 提交 3c3975b5 编写于 作者: Q quicksilver 提交者: GitHub

Add Milvus offline installation README (#7026)

Signed-off-by: Nquicksilver <zhifeng.zhang@zilliz.com>
上级 7557616f
# Milvus offline installation
## Manually downloading Docker images
Your Milvus installation may fail when images are not properly loaded from public Docker registries. To pull all images and save them into a directory that can be moved to the target host and loaded manually, perform the following procedure:
1. Save Milvus manifest and Docker images
If you install your Milvus with the **docker-compose.yml** file, use these command:
- Download Milvus docker-compose.yaml
```shell
# Download Milvus standalone docker-compose.yaml
wget https://raw.githubusercontent.com/milvus-io/milvus/master/deployments/docker/standalone/docker-compose.yml -O docker-compose.yml
```
or
```shell
# Download Milvus cluster docker-compose.yaml
wget https://raw.githubusercontent.com/milvus-io/milvus/master/deployments/docker/cluster/docker-compose.yml -O docker-compose.yml
```
- Pull and save Docker images
```shell
# Pull and save Docker images
pip3 install -r requirements.txt
python3 save_image.py --manifest docker-compose.yml
```
If you install your Milvus with **Helm**, use these command:
- Update Helm repo
```shell
helm repo add milvus https://milvus-io.github.io/milvus-helm/
helm repo update
```
- Get Kubernetes manifest of Milvus standalone
```shell
# Get Kubernetes manifest of Milvus standalone
helm template my-release milvus/milvus > milvus_manifest.yaml
```
or
```shell
# Get Kubernetes manifest of Milvus cluster
helm template --set cluster.enabled=true my-release milvus/milvus > milvus_manifest.yaml
```
- Pull and save Docker images
```shell
pip3 install -r requirements.txt
python3 save_image.py --manifest milvus_manifest.yaml
```
The Docker images will be stored under **images** directory.
2. Enter the following command to load the Docker images:
```shell
for image in $(find images/ -type f -name "*.tar.gz") ; do gunzip -c $image | docker load; done
```
## Install Milvus
- Install Milvus with Docker Compose
```shell
docker-compose -f docker-compose.yaml up -d
```
- Install Milvus on Kubernetes
```shell
kubectl apply -f milvus_manifest.yaml
```
\ No newline at end of file
import argparse import argparse
import docker import docker
import gzip import gzip
import os
import yaml import yaml
from nested_lookup import nested_lookup from nested_lookup import nested_lookup
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Save Docker image") description="Save Docker images")
parser.add_argument("--manifest", parser.add_argument("--manifest",
required=True, required=True,
help="Path to the manifest yaml") help="Path to the manifest yaml")
parser.add_argument("--save_path",
type=str,
default='images',
help='Directory to save images to')
arguments = parser.parse_args() arguments = parser.parse_args()
with open(arguments.manifest, 'r') as file: with open(arguments.manifest, 'r') as file:
template = file.read() template = file.read()
images=[] images=[]
parts = template.split('---') parts = template.split('---')
for p in parts: for p in parts:
...@@ -25,11 +29,15 @@ if __name__ == "__main__": ...@@ -25,11 +29,15 @@ if __name__ == "__main__":
matches = nested_lookup("image", y) matches = nested_lookup("image", y)
if (len(matches)): if (len(matches)):
images += matches images += matches
save_path = arguments.save_path
if not os.path.isdir(save_path):
os.mkdir(save_path)
client = docker.from_env() client = docker.from_env()
for image_name in set(images): for image_name in set(images):
file_name = (image_name.split(':')[0].replace("/", "-")) file_name = (image_name.split(':')[0].replace("/", "-"))
f = gzip.open( file_name + '.tar.gz', 'wb') f = gzip.open(save_path + "/" + file_name + '.tar.gz', 'wb')
try: try:
image = client.images.get(image_name) image = client.images.get(image_name)
if image.id: if image.id:
...@@ -40,3 +48,5 @@ if __name__ == "__main__": ...@@ -40,3 +48,5 @@ if __name__ == "__main__":
image_tar = image.save(named=True) image_tar = image.save(named=True)
f.writelines(image_tar) f.writelines(image_tar)
f.close() f.close()
print("Save docker images to \"" + save_path + "\"")
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册