NetApp ONTAP 용 Amazon FSx ONTAP 탑재한 Milvus - 파일 및 객체 이중성
이 섹션에서는 NetApp 의 벡터 데이터베이스 솔루션을 위한 Amazon FSx ONTAP 사용한 milvus 클러스터 설정에 대해 설명합니다.
NetApp ONTAP 용 Amazon FSx ONTAP 탑재한 Milvus – 파일 및 객체 이중성
이 섹션에서는 왜 클라우드에 벡터 데이터베이스를 배포해야 하는지, 그리고 Docker 컨테이너 내 NetApp ONTAP 용 Amazon FSx ONTAP 에 벡터 데이터베이스(milvus standalone)를 배포하는 단계를 알아봅니다.
클라우드에 벡터 데이터베이스를 구축하면 여러 가지 중요한 이점이 있는데, 특히 고차원 데이터를 처리하고 유사성 검색을 실행해야 하는 애플리케이션의 경우 이점이 큽니다. 첫째, 클라우드 기반 배포는 확장성을 제공하므로 증가하는 데이터 볼륨과 쿼리 부하에 맞춰 리소스를 쉽게 조정할 수 있습니다. 이를 통해 데이터베이스는 높은 성능을 유지하는 동시에 증가된 수요를 효율적으로 처리할 수 있습니다. 두 번째로, 클라우드 구축은 여러 지리적 위치에 걸쳐 데이터를 복제할 수 있으므로 높은 가용성과 재해 복구를 제공하고, 데이터 손실 위험을 최소화하며, 예상치 못한 이벤트 발생 시에도 지속적인 서비스를 보장합니다. 셋째, 사용한 리소스에 대해서만 비용을 지불하고 수요에 따라 확장하거나 축소할 수 있으므로 하드웨어에 대한 상당한 사전 투자가 필요 없어 비용 효율성이 높습니다. 마지막으로, 클라우드에 벡터 데이터베이스를 구축하면 어디서나 데이터에 접근하고 공유할 수 있으므로 협업이 향상되고, 팀 기반 작업과 데이터 기반 의사 결정이 용이해집니다. 이 검증에 사용된 NetApp ONTAP 용 Amazon FSx ONTAP 과 함께 사용되는 milvus 독립형의 아키텍처를 확인하세요.
-
NetApp ONTAP 인스턴스를 위한 Amazon FSx ONTAP 생성하고 VPC, VPC 보안 그룹 및 서브넷의 세부 정보를 기록해 둡니다. 이 정보는 EC2 인스턴스를 생성할 때 필요합니다. 자세한 내용은 여기에서 확인할 수 있습니다. https://us-east-1.console.aws.amazon.com/fsx/home?region=us-east-1#file-system-create
-
VPC, 보안 그룹 및 서브넷이 NetApp ONTAP 인스턴스의 Amazon FSx ONTAP 과 일치하는지 확인하여 EC2 인스턴스를 생성합니다.
-
'apt-get install nfs-common' 명령어를 사용하여 nfs-common을 설치하고 'sudo apt-get update'를 사용하여 패키지 정보를 업데이트합니다.
-
마운트 폴더를 만들고 해당 폴더에 NetApp ONTAP 용 Amazon FSx ONTAP 마운트합니다.
ubuntu@ip-172-31-29-98:~$ mkdir /home/ubuntu/milvusvectordb ubuntu@ip-172-31-29-98:~$ sudo mount 172.31.255.228:/vol1 /home/ubuntu/milvusvectordb ubuntu@ip-172-31-29-98:~$ df -h /home/ubuntu/milvusvectordb Filesystem Size Used Avail Use% Mounted on 172.31.255.228:/vol1 973G 126G 848G 13% /home/ubuntu/milvusvectordb ubuntu@ip-172-31-29-98:~$
-
'apt-get install'을 사용하여 Docker와 Docker Compose를 설치합니다.
-
Milvus 웹사이트에서 다운로드할 수 있는 docker-compose.yaml 파일을 기반으로 Milvus 클러스터를 설정합니다.
root@ip-172-31-22-245:~# wget https://github.com/milvus-io/milvus/releases/download/v2.0.2/milvus-standalone-docker-compose.yml -O docker-compose.yml --2024-04-01 14:52:23-- https://github.com/milvus-io/milvus/releases/download/v2.0.2/milvus-standalone-docker-compose.yml <removed some output to save page space>
-
docker-compose.yml 파일의 'volumes' 섹션에서 NetApp NFS 마운트 지점을 해당 Milvus 컨테이너 경로(특히 etcd, minio 및 standalone)에 매핑합니다."부록 D: docker-compose.yml" yml 변경 사항에 대한 자세한 내용은
-
마운트된 폴더와 파일을 확인하세요.
ubuntu@ip-172-31-29-98:~/milvusvectordb$ ls -ltrh /home/ubuntu/milvusvectordb total 8.0K -rw-r--r-- 1 root root 1.8K Apr 2 16:35 s3_access.py drwxrwxrwx 2 root root 4.0K Apr 4 20:19 volumes ubuntu@ip-172-31-29-98:~/milvusvectordb$ ls -ltrh /home/ubuntu/milvusvectordb/volumes/ total 0 ubuntu@ip-172-31-29-98:~/milvusvectordb$ cd ubuntu@ip-172-31-29-98:~$ ls docker-compose.yml docker-compose.yml~ milvus.yaml milvusvectordb vectordbvol1 ubuntu@ip-172-31-29-98:~$
-
docker-compose.yml 파일이 있는 디렉토리에서 'docker-compose up -d'를 실행합니다.
-
Milvus 컨테이너의 상태를 확인하세요.
ubuntu@ip-172-31-29-98:~$ sudo docker-compose ps Name Command State Ports ---------------------------------------------------------------------------------------------------------------------------------------------------------- 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 ubuntu@ip-172-31-29-98:~$ ubuntu@ip-172-31-29-98:~$ ls -ltrh /home/ubuntu/milvusvectordb/volumes/ total 12K drwxr-xr-x 3 root root 4.0K Apr 4 20:21 etcd drwxr-xr-x 4 root root 4.0K Apr 4 20:21 minio drwxr-xr-x 5 root root 4.0K Apr 4 20:21 milvus ubuntu@ip-172-31-29-98:~$
-
NetApp ONTAP 용 Amazon FSx ONTAP 에서 벡터 데이터베이스와 데이터의 읽기 및 쓰기 기능을 검증하기 위해 Python Milvus SDK와 PyMilvus의 샘플 프로그램을 사용했습니다. 'apt-get install python3-numpy python3-pip'를 사용하여 필요한 패키지를 설치하고 'pip3 install pymilvus'를 사용하여 PyMilvus를 설치합니다.
-
벡터 데이터베이스에서 NetApp ONTAP 용 Amazon FSx ONTAP 의 데이터 쓰기 및 읽기 작업을 검증합니다.
root@ip-172-31-29-98:~/pymilvus/examples# python3 prepare_data_netapp_new.py === start connecting to Milvus === === Milvus host: localhost === Does collection hello_milvus_ntapnew_sc exist in Milvus: True === Drop collection - hello_milvus_ntapnew_sc === === Drop collection - hello_milvus_ntapnew_sc2 === === Create collection `hello_milvus_ntapnew_sc` === === Start inserting entities === Number of entities in hello_milvus_ntapnew_sc: 9000 root@ip-172-31-29-98:~/pymilvus/examples# find /home/ubuntu/milvusvectordb/ … <removed content to save page space > … /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/103/448789845791411923/b3def25f-c117-4fba-8256-96cb7557cd6c /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/103/448789845791411923/b3def25f-c117-4fba-8256-96cb7557cd6c/part.1 /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/103/448789845791411923/xl.meta /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/0 /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/0/448789845791411924 /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/0/448789845791411924/xl.meta /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/1 /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/1/448789845791411925 /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/1/448789845791411925/xl.meta /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/100 /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/100/448789845791411920 /home/ubuntu/milvusvectordb/volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/100/448789845791411920/xl.meta
-
verify_data_netapp.py 스크립트를 사용하여 읽기 작업을 확인합니다.
root@ip-172-31-29-98:~/pymilvus/examples# python3 verify_data_netapp.py === start connecting to Milvus === === Milvus host: localhost === Does collection hello_milvus_ntapnew_sc exist in Milvus: True {'auto_id': False, 'description': 'hello_milvus_ntapnew_sc', 'fields': [{'name': 'pk', 'description': '', 'type': <DataType.INT64: 5>, 'is_primary': True, 'auto_id': False}, {'name': 'random', 'description': '', 'type': <DataType.DOUBLE: 11>}, {'name': 'var', 'description': '', 'type': <DataType.VARCHAR: 21>, 'params': {'max_length': 65535}}, {'name': 'embeddings', 'description': '', 'type': <DataType.FLOAT_VECTOR: 101>, 'params': {'dim': 8}}], 'enable_dynamic_field': False} Number of entities in Milvus: hello_milvus_ntapnew_sc : 9000 === Start Creating index IVF_FLAT === === Start loading === === Start searching based on vector similarity === hit: id: 2248, distance: 0.0, entity: {'random': 0.2777646777746381}, random field: 0.2777646777746381 hit: id: 4837, distance: 0.07805602252483368, entity: {'random': 0.6451650959930306}, random field: 0.6451650959930306 hit: id: 7172, distance: 0.07954417169094086, entity: {'random': 0.6141351712303128}, random field: 0.6141351712303128 hit: id: 2249, distance: 0.0, entity: {'random': 0.7434908973629817}, random field: 0.7434908973629817 hit: id: 830, distance: 0.05628090724349022, entity: {'random': 0.8544487225667627}, random field: 0.8544487225667627 hit: id: 8562, distance: 0.07971227169036865, entity: {'random': 0.4464554280115878}, random field: 0.4464554280115878 search latency = 0.1266s === Start querying with `random > 0.5` === query result: -{'random': 0.6378742006852851, 'embeddings': [0.3017092, 0.74452263, 0.8009826, 0.4927033, 0.12762444, 0.29869467, 0.52859956, 0.23734547], 'pk': 0} search latency = 0.3294s === Start hybrid searching with `random > 0.5` === hit: id: 4837, distance: 0.07805602252483368, entity: {'random': 0.6451650959930306}, random field: 0.6451650959930306 hit: id: 7172, distance: 0.07954417169094086, entity: {'random': 0.6141351712303128}, random field: 0.6141351712303128 hit: id: 515, distance: 0.09590047597885132, entity: {'random': 0.8013175797590888}, random field: 0.8013175797590888 hit: id: 2249, distance: 0.0, entity: {'random': 0.7434908973629817}, random field: 0.7434908973629817 hit: id: 830, distance: 0.05628090724349022, entity: {'random': 0.8544487225667627}, random field: 0.8544487225667627 hit: id: 1627, distance: 0.08096684515476227, entity: {'random': 0.9302397069516164}, random field: 0.9302397069516164 search latency = 0.2674s Does collection hello_milvus_ntapnew_sc2 exist in Milvus: True {'auto_id': True, 'description': 'hello_milvus_ntapnew_sc2', 'fields': [{'name': 'pk', 'description': '', 'type': <DataType.INT64: 5>, 'is_primary': True, 'auto_id': True}, {'name': 'random', 'description': '', 'type': <DataType.DOUBLE: 11>}, {'name': 'var', 'description': '', 'type': <DataType.VARCHAR: 21>, 'params': {'max_length': 65535}}, {'name': 'embeddings', 'description': '', 'type': <DataType.FLOAT_VECTOR: 101>, 'params': {'dim': 8}}], 'enable_dynamic_field': False}
-
고객이 AI 워크로드를 위해 S3 프로토콜을 통해 벡터 데이터베이스에서 테스트된 NFS 데이터에 액세스(읽기)하려는 경우 간단한 Python 프로그램을 사용하여 이를 검증할 수 있습니다. 이에 대한 예로는 이 섹션의 시작 부분에 있는 그림에서 언급한 것처럼 다른 애플리케이션의 이미지에 대한 유사성 검색을 들 수 있습니다.
root@ip-172-31-29-98:~/pymilvus/examples# sudo python3 /home/ubuntu/milvusvectordb/s3_access.py -i 172.31.255.228 --bucket milvusnasvol --access-key PY6UF318996I86NBYNDD --secret-key hoPctr9aD88c1j0SkIYZ2uPa03vlbqKA0c5feK6F OBJECTS in the bucket milvusnasvol are : *************************************** … <output content removed to save page space> … bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611920/0/448789845791411917/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611920/1/448789845791411918/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611920/100/448789845791411913/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611920/101/448789845791411914/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611920/102/448789845791411915/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611920/103/448789845791411916/1c48ab6e-1546-4503-9084-28c629216c33/part.1 volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611920/103/448789845791411916/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/0/448789845791411924/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/1/448789845791411925/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/100/448789845791411920/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/101/448789845791411921/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/102/448789845791411922/xl.meta volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/103/448789845791411923/b3def25f-c117-4fba-8256-96cb7557cd6c/part.1 volumes/minio/a-bucket/files/insert_log/448789845791611912/448789845791611913/448789845791611939/103/448789845791411923/xl.meta volumes/minio/a-bucket/files/stats_log/448789845791211880/448789845791211881/448789845791411889/100/1/xl.meta volumes/minio/a-bucket/files/stats_log/448789845791211880/448789845791211881/448789845791411889/100/448789845791411912/xl.meta volumes/minio/a-bucket/files/stats_log/448789845791611912/448789845791611913/448789845791611920/100/1/xl.meta volumes/minio/a-bucket/files/stats_log/448789845791611912/448789845791611913/448789845791611920/100/448789845791411919/xl.meta volumes/minio/a-bucket/files/stats_log/448789845791611912/448789845791611913/448789845791611939/100/1/xl.meta volumes/minio/a-bucket/files/stats_log/448789845791611912/448789845791611913/448789845791611939/100/448789845791411926/xl.meta *************************************** root@ip-172-31-29-98:~/pymilvus/examples#
이 섹션에서는 고객이 Amazon의 NetApp FSx ONTAP NetApp ONTAP 데이터 스토리지에 활용하여 Docker 컨테이너 내에서 독립형 Milvus 설정을 배포하고 운영하는 방법을 효과적으로 보여줍니다. 이러한 설정을 통해 고객은 Docker 컨테이너의 확장 가능하고 효율적인 환경 내에서 벡터 데이터베이스의 힘을 활용하여 고차원 데이터를 처리하고 복잡한 쿼리를 실행할 수 있습니다. NetApp ONTAP 인스턴스와 일치하는 EC2 인스턴스를 위한 Amazon FSx ONTAP 생성하면 고객은 최적의 리소스 활용과 데이터 관리를 보장할 수 있습니다. FSx ONTAP 에서 벡터 데이터베이스의 데이터 쓰기 및 읽기 작업을 성공적으로 검증함으로써 고객은 안정적이고 일관된 데이터 작업을 보장받을 수 있습니다. 또한 S3 프로토콜을 통해 AI 워크로드의 데이터를 나열(읽기)하는 기능을 통해 데이터 접근성이 향상됩니다. 따라서 이 포괄적인 프로세스는 고객에게 Amazon FSx ONTAP for NetApp ONTAP 의 기능을 활용하여 대규모 데이터 작업을 관리할 수 있는 강력하고 효율적인 솔루션을 제공합니다.