向量数据库Milvus在Linux环境下的在线+离线安装
1.千问简介
Milvus 是一款专为处理高维向量数据设计的开源云原生数据库,旨在满足海量向量数据的实时召回需求。它由 Zilliz 公司开发并维护,基于Apache许可证2.0版本发布。Milvus的核心能力在于其高可用性、高性能及易拓展性,特别优化了对由深度神经网络和其他机器学习模型生成的嵌入(embedding)向量的管理、搜索和操作。
该数据库底层集成了诸如 FAISS、Annoy、HNSW 等高效的向量搜索库,用以解决稠密向量的相似度检索问题。通过支持数据分片、数据持久化、增量数据摄取、标量与向量混合查询以及时间旅行查询(time travel)等功能,Milvus能够应对复杂多变的向量检索场景,并且显著提升向量检索性能。
Milvus广泛应用于需要高效处理非结构化数据检索的领域,如推荐系统、图像检索、语音识别、自然语言处理、语义搜索等人工智能应用场景。为了实现最佳的可用性和弹性,通常建议通过Kubernetes来部署Milvus。其采用的共享存储架构将存储与计算分离,进一步增强了系统的灵活性和扩展性。
- 安装文档:https://milvus.io/docs/v2.1.x/install_standalone-aptyum.md
- 下载地址:https://github.com/milvus-io/milvus/releases
2.在线安装
bash
[root@tcloud milvus]# yum install ./milvus-2.1.4-1.el7.x86_64.rpm
安装日志:
shell
Loaded plugins: fastestmirror, langpacks
Examining ./milvus-2.1.4-1.el7.x86_64.rpm: milvus-2.1.4-1.el7.x86_64
Marking ./milvus-2.1.4-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package milvus.x86_64 0:2.1.4-1.el7 will be installed
--> Processing Dependency: libquadmath.so.0(QUADMATH_1.0)(64bit) for package: milvus-2.1.4-1.el7.x86_64
Loading mirror speeds from cached hostfile
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
os | 3.6 kB 00:00:00
updates | 2.9 kB 00:00:00
--> Processing Dependency: tbb-devel for package: milvus-2.1.4-1.el7.x86_64
--> Processing Dependency: libquadmath.so.0()(64bit) for package: milvus-2.1.4-1.el7.x86_64
--> Running transaction check
---> Package libquadmath.x86_64 0:4.8.5-44.el7 will be installed
---> Package tbb-devel.x86_64 0:4.1-9.20130314.el7 will be installed
--> Processing Dependency: tbb(x86-64) = 4.1-9.20130314.el7 for package: tbb-devel-4.1-9.20130314.el7.x86_64
--> Processing Dependency: libtbbmalloc_proxy.so.2()(64bit) for package: tbb-devel-4.1-9.20130314.el7.x86_64
--> Processing Dependency: libtbbmalloc.so.2()(64bit) for package: tbb-devel-4.1-9.20130314.el7.x86_64
--> Processing Dependency: libtbb.so.2()(64bit) for package: tbb-devel-4.1-9.20130314.el7.x86_64
--> Running transaction check
---> Package tbb.x86_64 0:4.1-9.20130314.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================================
Installing:
milvus x86_64 2.1.4-1.el7 /milvus-2.1.4-1.el7.x86_64 388 M
Installing for dependencies:
libquadmath x86_64 4.8.5-44.el7 os 190 k
tbb x86_64 4.1-9.20130314.el7 os 124 k
tbb-devel x86_64 4.1-9.20130314.el7 os 218 k
Transaction Summary
================================================================================================================================================================
Install 1 Package (+3 Dependent packages)
Total size: 389 M
Total download size: 532 k
Installed size: 390 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): libquadmath-4.8.5-44.el7.x86_64.rpm | 190 kB 00:00:00
(2/3): tbb-4.1-9.20130314.el7.x86_64.rpm | 124 kB 00:00:00
(3/3): tbb-devel-4.1-9.20130314.el7.x86_64.rpm | 218 kB 00:00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.2 MB/s | 532 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : tbb-4.1-9.20130314.el7.x86_64 1/4
Installing : tbb-devel-4.1-9.20130314.el7.x86_64 2/4
Installing : libquadmath-4.8.5-44.el7.x86_64 3/4
Installing : milvus-2.1.4-1.el7.x86_64 4/4
Verifying : milvus-2.1.4-1.el7.x86_64 1/4
Verifying : tbb-devel-4.1-9.20130314.el7.x86_64 2/4
Verifying : libquadmath-4.8.5-44.el7.x86_64 3/4
Verifying : tbb-4.1-9.20130314.el7.x86_64 4/4
Installed:
milvus.x86_64 0:2.1.4-1.el7
Dependency Installed:
libquadmath.x86_64 0:4.8.5-44.el7 tbb.x86_64 0:4.1-9.20130314.el7 tbb-devel.x86_64 0:4.1-9.20130314.el7
Complete!
安装了3个依赖,让yum缓存下来,离线安装时可以使用,yum开启缓存及查找缓存文件地址:
bash
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=1
安装成功后查看状态:
bash
systemctl start milvus-etcd
systemctl start milvus-minio
systemctl start milvus
查看服务状态:
bash
# systemctl status milvus-etcd
● milvus-etcd.service - Etcd of Milvus Standalone Server
Loaded: loaded (/etc/systemd/system/milvus-etcd.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2024-06-13 09:09:54 CST; 19s ago
Main PID: 18846 (milvus-etcd)
CGroup: /system.slice/milvus-etcd.service
└─18846 /usr/bin/milvus-etcd --data-dir /var/lib/milvus/etcd-data
# systemctl status milvus-minio
● milvus-minio.service - MinIO of Milvus Standalone Server
Loaded: loaded (/etc/systemd/system/milvus-minio.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2024-06-13 09:10:05 CST; 1min 3s ago
Main PID: 18961 (milvus-minio)
CGroup: /system.slice/milvus-minio.service
└─18961 /usr/bin/milvus-minio server /var/lib/milvus/minio-data
# systemctl status milvus
● milvus.service - Milvus Standalone Server
Loaded: loaded (/etc/systemd/system/milvus.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2024-06-13 09:10:12 CST; 1s ago
Main PID: 19058 (milvus-server)
CGroup: /system.slice/milvus.service
└─19058 /usr/bin/milvus-server run standalone
shell
# milvus安装的文件
[root@tcloud ~]# rpm -ql milvus
/etc/ld.so.conf.d/milvus.conf
/etc/milvus/configs/advanced/etcd.yaml
/etc/milvus/configs/milvus.yaml
/etc/systemd/system/milvus-etcd.service
/etc/systemd/system/milvus-minio.service
/etc/systemd/system/milvus.service
/lib64/milvus/libgfortran.so.4
/lib64/milvus/libknowhere.so
/lib64/milvus/libmarisa.a
/lib64/milvus/libmarisa.la
/lib64/milvus/libmarisa.so
/lib64/milvus/libmarisa.so.0
/lib64/milvus/libmilvus_common.so
/lib64/milvus/libmilvus_index.so
/lib64/milvus/libmilvus_indexbuilder.so
/lib64/milvus/libmilvus_segcore.so
/lib64/milvus/libopenblas.so.0
/usr/bin/milvus
/usr/bin/milvus-etcd
/usr/bin/milvus-minio
/usr/bin/milvus-server
缓存的依赖包:
2.离线安装
离线安装要使用在线安装缓存的依赖文件:
bash
# 安装
rpm -ivh libquadmath-4.8.5-44.el7.x86_64.rpm
rpm -ivh tbb-4.1-9.20130314.el7.x86_64.rpm
rpm -ivh tbb-devel-4.1-9.20130314.el7.x86_64.rpm
rpm -ivh milvus-2.1.4-1.el7.x86_64.rpm
bash
# 启动
systemctl start milvus-etcd
systemctl start milvus-minio
systemctl start milvus