使用docker 部署向量数据库Milvus 在执行之前需要配置docker 的镜像加速地址需要编辑daemon.jsonvim /etc/docker/daemon.json可以通过阿里云获取自己的官方云镜像不会可以搜索阿里云镜像加速[rootlocalhost milvus]# cat /etc/docker/daemon.json -EOF{registry-mirrors:[你的阿里云镜像地址],debug:false,experimental:false}EOF之后使用下面的命令使地址生效systemctl daemon-reload如果还不生效则重启dockersystemctl restart docker验证镜像地址是否生效docker info | grep -A 3 Registry Mirrors这样就生效了Registry Mirrors: https://你的镜像地址/ Live Restore Enabled: falsedocker拉取Milvusdocker pull docker.m.daocloud.io/milvusdb/milvus:v2.5.3启动milvus脚本这里用的是milvus:v2.5.3版本复制下方的脚本到官方的standalone_embed.sh脚本中#!/usr/bin/env bash# Licensed to the LF AI Data foundation under one# or more contributor license agreements. See the NOTICE file# distributed with this work for additional information# regarding copyright ownership. The ASF licenses this file# to you under the Apache License, Version 2.0 (the# License); you may not use this file except in compliance# with the License. You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an AS IS BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.run_embed(){catEOFembedEtcd.yamllisten-client-urls: http://0.0.0.0:2379 advertise-client-urls: http://0.0.0.0:2379 quota-backend-bytes: 4294967296 auto-compaction-mode: revision auto-compaction-retention: 1000 EOFcatEOFuser.yaml# Extra config to override default milvus.yaml EOFif[!-f./embedEtcd.yaml]thenechoembedEtcd.yaml file does not exist. Please try to create it in the current directory.exit1fiif[!-f./user.yaml]thenechouser.yaml file does not exist. Please try to create it in the current directory.exit1fisudodockerrun-d\--namemilvus-standalone\--security-opt seccomp:unconfined\-eETCD_USE_EMBEDtrue\-eETCD_DATA_DIR/var/lib/milvus/etcd\-eETCD_CONFIG_PATH/milvus/configs/embedEtcd.yaml\-eCOMMON_STORAGETYPElocal\-eDEPLOY_MODESTANDALONE\-v$(pwd)/volumes/milvus:/var/lib/milvus\-v$(pwd)/embedEtcd.yaml:/milvus/configs/embedEtcd.yaml\-v$(pwd)/user.yaml:/milvus/configs/user.yaml\-p19530:19530\-p9091:9091\-p2379:2379\--health-cmdcurl -f http://localhost:9091/healthz\--health-interval30s\--health-start-period90s\--health-timeout20s\--health-retries3\milvusdb/milvus:v2.5.3\milvus run standalone1/dev/null}wait_for_milvus_running(){echoWait for Milvus Starting...whiletruedoressudodockerps|grepmilvus-standalone|grephealthy|wc-lif[$res-eq1]thenechoStart successfully.echoTo change the default Milvus configuration, add your settings to the user.yaml file and then restart the service.breakfisleep1done}start(){ressudodockerps|grepmilvus-standalone|grephealthy|wc-lif[$res-eq1]thenechoMilvus is running.exit0firessudodockerps-a|grepmilvus-standalone|wc-lif[$res-eq1]thensudodockerstart milvus-standalone1/dev/nullelserun_embedfiif[$?-ne0]thenechoStart failed.exit1fiwait_for_milvus_running}stop(){sudodockerstop milvus-standalone1/dev/nullif[$?-ne0]thenechoStop failed.exit1fiechoStop successfully.}delete_container(){ressudodockerps|grepmilvus-standalone|wc-lif[$res-eq1]thenechoPlease stop Milvus service before delete.exit1fisudodockerrmmilvus-standalone1/dev/nullif[$?-ne0]thenechoDelete milvus container failed.exit1fiechoDelete milvus container successfully.}delete(){read-pPlease confirm if youd like to proceed with the delete. This operation will delete the container and data. Confirm with y for yes or n for no. checkif[$checky]||[$checkY];thendelete_containersudorm-rf$(pwd)/volumessudorm-rf$(pwd)/embedEtcd.yamlsudorm-rf$(pwd)/user.yamlechoDelete successfully.elseechoExit deleteexit0fi}upgrade(){read-pPlease confirm if youd like to proceed with the upgrade. The default will be to the latest version. Confirm with y for yes or n for no. checkif[$checky]||[$checkY];thenressudodockerps-a|grepmilvus-standalone|wc-lif[$res-eq1]thenstop delete_containerficurl-sfLhttps://raw.githubusercontent.com/milvus-io/milvus/master/scripts/standalone_embed.sh-ostandalone_embed_latest.sh\bashstandalone_embed_latest.sh start1/dev/null\echoUpgrade successfully.elseechoExit upgradeexit0fi}case$1inrestart)stop start;;start)start;;stop)stop;;upgrade)upgrade;;delete)delete;;*)echoplease use bash standalone_embed.sh restart|start|stop|upgrade|delete;;esac之后执行命令bashstandalone_embed.sh start命令执行结果如下就代表成功了访问milvus如果显示下方图片就表示部署成功了在这里插入图片描述