העברת נתונים ממסד נתונים וקטורי אל AlloyDB

אתם יכולים להעביר הטמעות וקטורים ומטא-נתונים ממסדי נתונים וקטוריים של צד שלישי ל-AlloyDB ל-PostgreSQL באמצעות שילוב של LangChain VectorStore. במדריך הזה תייצאו נתוני וקטורים קיימים שנוצרו באמצעות LangChain ותטענו אותם לטבלה ב-AlloyDBVectorStore. אם הטמעתם נתונים באחד ממסדי הנתונים הבאים בלי להשתמש ב-LangChain, אתם צריכים לשנות את הסקריפטים של ההעברה שסופקו כדי להתאים אותם לסכימת הנתונים שלכם. אלה מסדי הנתונים של וקטורים שנתמכים:

המדריך הזה מתבסס על ההנחה שאתם מכירים את Google Cloud, את AlloyDB ואת תכנות Python אסינכרוני.

מטרות

במדריך הזה מוסבר איך:

  • לחלץ נתונים ממסד נתונים וקטורי קיים.
  • מתחברים ל-AlloyDB.
  • מאתחלים את הטבלה ב-AlloyDB.
  • מאתחלים אובייקט של מאגר וקטורים.
  • מריצים את סקריפט ההעברה כדי להוסיף את הנתונים.

עלויות

במסמך הזה משתמשים ברכיבים הבאים של Google Cloud, והשימוש בהם כרוך בתשלום:

You might be eligible for a free trial cluster. For more information, see AlloyDB free trial clusters overview.

בעזרת מחשבון העלויות אתם יכולים להעריך את העלויות בהתאם לשימוש הצפוי.

משתמשים חדשים של Google Cloud ? יכול להיות שאתם זכאים לתקופת ניסיון בחינם.

כשמסיימים את המשימות שמתוארות במסמך הזה אפשר למחוק את המשאבים שיצרתם כדי להימנע מחיובים נוספים. מידע נוסף זמין בקטע הסרת המשאבים.

לפני שמתחילים

מוודאים שיש לכם אחד ממאגרי הווקטורים הבאים של מסדי נתונים של צד שלישי ב-LangChain:

הפעלת החיוב וממשקי ה-API הנדרשים

  1. בדף לבחירת הפרויקט במסוף Google Cloud , בוחרים פרויקט ב-Google Cloud או יוצרים אותו.

    כניסה לדף לבחירת הפרויקט

  2. מוודאים שהחיוב מופעל בפרויקט ב- Google Cloud .

  3. מפעילים את ממשקי ה-API של Cloud שנדרשים כדי ליצור מכונות של AlloyDB ל-PostgreSQL ולהתחבר אליהן.

    הפעלת ממשקי ה-API

    1. בשלב Confirm project, לוחצים על Next כדי לאשר את שם הפרויקט שבו רוצים לבצע שינויים.
    2. בשלב Enable APIs, לוחצים על Enable כדי להפעיל את ממשקי ה-API הבאים:

      • AlloyDB API
      • Compute Engine API
      • Service Networking API

התפקידים הנדרשים

כדי לקבל את ההרשאות שנדרשות לביצוע המשימות במדריך הזה, צריך את התפקידים הבאים בממשק של ניהול הזהויות והרשאות הגישה (IAM), שמאפשרים ליצור טבלאות ולהוסיף נתונים:

  • בעלים (roles/owner) או עורך (roles/editor)
  • אם המשתמש הוא לא בעלים או עורך, נדרשים התפקידים הבאים ב-IAM וההרשאות הבאות ב-PostgreSQL:

אם אתם רוצים לאמת את מסד הנתונים באמצעות אימות IAM במקום להשתמש באימות המובנה במדריך הזה, השתמשו ב-Notebook שמראה איך להשתמש ב-AlloyDB ל-PostgreSQL כדי לאחסן הטמעות וקטורים באמצעות המחלקה AlloyDBVectorStore.

יצירת אשכול ומשתמש ב-AlloyDB

  1. יוצרים אשכול ומכונה של AlloyDB.
    • כדי להפעיל את המדריך הזה מכל מקום, צריך להפעיל את כתובת ה-IP הציבורית. אם אתם משתמשים בכתובת IP פרטית, אתם צריכים להריץ את המדריך הזה מתוך רשת הענן הווירטואלי הפרטי (VPC).
  2. יוצרים או בוחרים משתמש במסד הנתונים של AlloyDB.
    • כשיוצרים את המכונה, נוצר משתמש postgres עם סיסמה. למשתמש הזה יש הרשאות של משתמש-על.
    • במדריך הזה משתמשים באימות מובנה כדי לצמצם את החיכוך באימות. אפשר לבצע אימות ב-IAM באמצעות AlloyDBEngine.

אחזור של דוגמת הקוד

  1. מעתיקים את דוגמת הקוד מ-GitHub על ידי שכפול המאגר:

    git clone https://github.com/googleapis/langchain-google-alloydb-pg-python.git
  2. מנווטים לספרייה migrations:

    cd langchain-google-alloydb-pg-python/samples/migrations

חילוץ נתונים ממסד נתונים וקטורי קיים

  1. יוצרים לקוח.

    Pinecone

    from pinecone import Pinecone  # type: ignore
    
    pinecone_client = Pinecone(api_key=pinecone_api_key)
    pinecone_index = pinecone_client.Index(pinecone_index_name)

    Weaviate

    import weaviate
    
    # For a locally running weaviate instance, use `weaviate.connect_to_local()`
    weaviate_client = weaviate.connect_to_weaviate_cloud(
        cluster_url=weaviate_cluster_url,
        auth_credentials=weaviate.auth.AuthApiKey(weaviate_api_key),
    )

    Chroma

    from langchain_chroma import Chroma
    
    chromadb_client = Chroma(
        collection_name=chromadb_collection_name,
        embedding_function=embeddings_service,
        persist_directory=chromadb_path,
    )

    Qdrant

    from qdrant_client import QdrantClient
    
    qdrant_client = QdrantClient(path=qdrant_path)
    

    Milvus

    milvus_client = MilvusClient(uri=milvus_uri)
  2. מקבלים את כל הנתונים ממסד הנתונים.

    Pinecone

    מאחזרים את מזהי הווקטורים מהאינדקס של Pinecone:

    results = pinecone_index.list_paginated(
        prefix="", namespace=pinecone_namespace, limit=pinecone_batch_size
    )
    ids = [v.id for v in results.vectors]
    if ids:  # Prevents yielding an empty list.
        yield ids
    
    # Check BOTH pagination and pagination.next
    while results.pagination is not None and results.pagination.get("next") is not None:
        pagination_token = results.pagination.get("next")
        results = pinecone_index.list_paginated(
            prefix="",
            pagination_token=pagination_token,
            namespace=pinecone_namespace,
            limit=pinecone_batch_size,
        )
    
        # Extract and yield the next batch of IDs
        ids = [v.id for v in results.vectors]
        if ids:  # Prevents yielding an empty list.
            yield ids

    ואז מאחזרים רשומות לפי מזהה מהאינדקס של Pinecone:

    import uuid
    
    # Iterate through the IDs and download their contents
    for ids_batch in id_iterator:
        all_data = pinecone_index.fetch(ids=ids_batch, namespace=pinecone_namespace)
        ids = []
        embeddings = []
        contents = []
        metadatas = []
    
        # Process each vector in the current batch
        for doc in all_data.vectors.values():
            # You might need to update this data translation logic according to one or more of your field names
            if pinecone_id_column_name in doc.metadata:
                # pinecone_id_column_name stores the unqiue identifier for the content
                ids.append(doc[pinecone_id_column_name])
            else:
                # Generate a uuid if pinecone_id_column_name is missing in source
                ids.append(str(uuid.uuid4()))
            # values is the vector embedding of the content
            embeddings.append(doc.values)
            # Check if pinecone_content_column_name exists in metadata before accessing
            if pinecone_content_column_name in doc.metadata:
                # pinecone_content_column_name stores the content which was encoded
                contents.append(str(doc.metadata[pinecone_content_column_name]))
                # Remove pinecone_content_column_name after processing
                del doc.metadata[pinecone_content_column_name]
            else:
                # Handle the missing pinecone_content_column_name field appropriately
                contents.append("")
            # metadata is the additional context
            metadatas.append(doc.metadata)
    
        # Yield the current batch of results
        yield ids, contents, embeddings, metadatas

    Weaviate

    # Iterate through the IDs and download their contents
    weaviate_collection = weaviate_client.collections.get(weaviate_collection_name)
    ids: list[str] = []
    content: list[Any] = []
    embeddings: list[list[float]] = []
    metadatas: list[Any] = []
    
    for item in weaviate_collection.iterator(include_vector=True):
        # You might need to update this data translation logic according to one or more of your field names
        # uuid is the unqiue identifier for the content
        ids.append(str(item.uuid))
        # weaviate_text_key is the content which was encoded
        content.append(item.properties[weaviate_text_key])
        # vector is the vector embedding of the content
        embeddings.append(item.vector["default"])  # type: ignore
        del item.properties[weaviate_text_key]  # type: ignore
        # properties is the additional context
        metadatas.append(item.properties)
    
        if len(ids) >= weaviate_batch_size:
            # Yield the current batch of results
            yield ids, content, embeddings, metadatas
            # Reset lists to start a new batch
            ids = []
            content = []
            embeddings = []
            metadatas = []

    Chroma

    # Iterate through the IDs and download their contents
    offset = 0
    while True:
        # You might need to update this data translation logic according to one or more of your field names
        # documents is the content which was encoded
        # embeddings is the vector embedding of the content
        # metadatas is the additional context
        docs = chromadb_client.get(
            include=["metadatas", "documents", "embeddings"],
            limit=chromadb_batch_size,
            offset=offset,
        )
    
        if len(docs["documents"]) == 0:
            break
    
        # ids is the unqiue identifier for the content
        yield docs["ids"], docs["documents"], docs["embeddings"].tolist(), docs[
            "metadatas"
        ]
    
        offset += chromadb_batch_size
    

    Qdrant

    # Iterate through the IDs and download their contents
    offset = None
    while True:
        docs, offset = qdrant_client.scroll(
            collection_name=qdrant_collection_name,
            with_vectors=True,
            limit=qdrant_batch_size,
            offset=offset,
            with_payload=True,
        )
    
        ids: List[str] = []
        contents: List[Any] = []
        embeddings: List[List[float]] = []
        metadatas: List[Any] = []
    
        for doc in docs:
            if doc.payload and doc.vector:
                # You might need to update this data translation logic according to one or more of your field names
                # id is the unqiue identifier for the content
                ids.append(str(doc.id))
                # page_content is the content which was encoded
                contents.append(doc.payload["page_content"])
                # vector is the vector embedding of the content
                embeddings.append(doc.vector)  # type: ignore
                # metatdata is the additional context
                metadatas.append(doc.payload["metadata"])
    
        yield ids, contents, embeddings, metadatas
    
        if not offset:
            break
    

    Milvus

    # Iterate through the IDs and download their contents
    iterator = milvus_client.query_iterator(
        collection_name=milvus_collection_name,
        filter='pk >= "0"',
        output_fields=["pk", "text", "vector", "idv"],
        batch_size=milvus_batch_size,
    )
    
    while True:
        ids = []
        content = []
        embeddings = []
        metadatas = []
        page = iterator.next()
        if len(page) == 0:
            iterator.close()
            break
        for i in range(len(page)):
            # You might need to update this data translation logic according to one or more of your field names
            doc = page[i]
            # pk is the unqiue identifier for the content
            ids.append(doc["pk"])
            # text is the content which was encoded
            content.append(doc["text"])
            # vector is the vector embedding of the content
            embeddings.append(doc["vector"])
            del doc["pk"]
            del doc["text"]
            del doc["vector"]
            # doc is the additional context
            metadatas.append(doc)
        yield ids, content, embeddings, metadatas

הפעלת הטבלה ב-AlloyDB

  1. מגדירים את שירות ההטמעה.

    ממשק VectorStore דורש שירות הטמעה. תהליך העבודה הזה לא יוצר הטמעות חדשות, ולכן משתמשים במחלקה FakeEmbeddings כדי להימנע מעלויות.

    Pinecone

    # The VectorStore interface requires an embedding service. This workflow does not
    # generate new embeddings, therefore FakeEmbeddings class is used to avoid any costs.
    from langchain_core.embeddings import FakeEmbeddings
    
    embeddings_service = FakeEmbeddings(size=vector_size)

    Weaviate

    # The VectorStore interface requires an embedding service. This workflow does not
    # generate new embeddings, therefore FakeEmbeddings class is used to avoid any costs.
    from langchain_core.embeddings import FakeEmbeddings
    
    embeddings_service = FakeEmbeddings(size=vector_size)

    Chroma

    # The VectorStore interface requires an embedding service. This workflow does not
    # generate new embeddings, therefore FakeEmbeddings class is used to avoid any costs.
    from langchain_core.embeddings import FakeEmbeddings
    
    embeddings_service = FakeEmbeddings(size=vector_size)

    Qdrant

    # The VectorStore interface requires an embedding service. This workflow does not
    # generate new embeddings, therefore FakeEmbeddings class is used to avoid any costs.
    from langchain_core.embeddings import FakeEmbeddings
    
    embeddings_service = FakeEmbeddings(size=vector_size)

    Milvus

    # The VectorStore interface requires an embedding service. This workflow does not
    # generate new embeddings, therefore FakeEmbeddings class is used to avoid any costs.
    from langchain_core.embeddings import FakeEmbeddings
    
    embeddings_service = FakeEmbeddings(size=vector_size)
  2. מכינים את הטבלה ב-AlloyDB.

    1. מתחברים ל-AlloyDB באמצעות קישור דרך IP ציבורי. למידע נוסף, קראו את המאמר ציון סוג כתובת ה-IP.

      Pinecone

      from langchain_google_alloydb_pg import AlloyDBEngine
      
      alloydb_engine = await AlloyDBEngine.afrom_instance(
          project_id=project_id,
          region=region,
          cluster=cluster,
          instance=instance,
          database=db_name,
          user=db_user,
          password=db_pwd,
          ip_type=IPTypes.PUBLIC,  # Optionally use IPTypes.PRIVATE
      )

      Weaviate

      from langchain_google_alloydb_pg import AlloyDBEngine
      
      alloydb_engine = await AlloyDBEngine.afrom_instance(
          project_id=project_id,
          region=region,
          cluster=cluster,
          instance=instance,
          database=db_name,
          user=db_user,
          password=db_pwd,
          ip_type=IPTypes.PUBLIC,
      )

      Chroma

      from langchain_google_alloydb_pg import AlloyDBEngine
      
      alloydb_engine = await AlloyDBEngine.afrom_instance(
          project_id=project_id,
          region=region,
          cluster=cluster,
          instance=instance,
          database=db_name,
          user=db_user,
          password=db_pwd,
          ip_type=IPTypes.PUBLIC,
      )

      Qdrant

      from langchain_google_alloydb_pg import AlloyDBEngine
      
      alloydb_engine = await AlloyDBEngine.afrom_instance(
          project_id=project_id,
          region=region,
          cluster=cluster,
          instance=instance,
          database=db_name,
          user=db_user,
          password=db_pwd,
          ip_type=IPTypes.PUBLIC,
      )

      Milvus

      from langchain_google_alloydb_pg import AlloyDBEngine
      
      alloydb_engine = await AlloyDBEngine.afrom_instance(
          project_id=project_id,
          region=region,
          cluster=cluster,
          instance=instance,
          database=db_name,
          user=db_user,
          password=db_pwd,
          ip_type=IPTypes.PUBLIC,
      )
    2. אם עדיין אין טבלה, יוצרים טבלה שאליה אפשר להעתיק את הנתונים.

      Pinecone

      from langchain_google_alloydb_pg import Column
      
      await alloydb_engine.ainit_vectorstore_table(
          table_name=alloydb_table,
          vector_size=vector_size,
          # Customize the ID column types if not using the UUID data type
          # id_column=Column("langchain_id", "TEXT"),  # Default is Column("langchain_id", "UUID")
          # overwrite_existing=True,  # Drop the old table and Create a new vector store table
      )

      Weaviate

      await alloydb_engine.ainit_vectorstore_table(
          table_name=alloydb_table,
          vector_size=vector_size,
          # Customize the ID column types with `id_column` if not using the UUID data type
      )
      

      Chroma

      await alloydb_engine.ainit_vectorstore_table(
          table_name=alloydb_table,
          vector_size=vector_size,
          # Customize the ID column types with `id_column` if not using the UUID data type
      )

      Qdrant

      await alloydb_engine.ainit_vectorstore_table(
          table_name=alloydb_table,
          vector_size=vector_size,
          # Customize the ID column types with `id_column` if not using the UUID data type
      )

      Milvus

      await alloydb_engine.ainit_vectorstore_table(
          table_name=alloydb_table,
          vector_size=vector_size,
          # Customize the ID column types with `id_column` if not using the UUID data type
      )

הפעלה של אובייקט מאגר וקטורים

הקוד הזה מוסיף עוד מטא-נתונים של הטמעת וקטורים לעמודה langchain_metadata בפורמט JSON. כדי שהסינון יהיה יעיל יותר, כדאי לארגן את המטא-נתונים האלה בעמודות נפרדות. מידע נוסף זמין במאמר יצירת מאגר וקטורים בהתאמה אישית.

  1. כדי לאתחל אובייקט של מאגר וקטורים, מריצים את הפקודה הבאה:

    Pinecone

    from langchain_google_alloydb_pg import AlloyDBVectorStore
    
    vs = await AlloyDBVectorStore.create(
        engine=alloydb_engine,
        embedding_service=embeddings_service,
        table_name=alloydb_table,
    )

    Weaviate

    from langchain_google_alloydb_pg import AlloyDBVectorStore
    
    vs = await AlloyDBVectorStore.create(
        engine=alloydb_engine,
        embedding_service=embeddings_service,
        table_name=alloydb_table,
    )

    Chroma

    from langchain_google_alloydb_pg import AlloyDBVectorStore
    
    vs = await AlloyDBVectorStore.create(
        engine=alloydb_engine,
        embedding_service=embeddings_service,
        table_name=alloydb_table,
    )

    Qdrant

    from langchain_google_alloydb_pg import AlloyDBVectorStore
    
    vs = await AlloyDBVectorStore.create(
        engine=alloydb_engine,
        embedding_service=embeddings_service,
        table_name=alloydb_table,
    )

    Milvus

    from langchain_google_alloydb_pg import AlloyDBVectorStore
    
    vs = await AlloyDBVectorStore.create(
        engine=alloydb_engine,
        embedding_service=embeddings_service,
        table_name=alloydb_table,
    )
  2. מוסיפים נתונים לטבלה ב-AlloyDB:

    Pinecone

    pending: set[Any] = set()
    for ids, contents, embeddings, metadatas in data_iterator:
        pending.add(
            asyncio.ensure_future(
                vs.aadd_embeddings(
                    texts=contents,
                    embeddings=embeddings,
                    metadatas=metadatas,
                    ids=ids,
                )
            )
        )
        if len(pending) >= max_concurrency:
            _, pending = await asyncio.wait(
                pending, return_when=asyncio.FIRST_COMPLETED
            )
    if pending:
        await asyncio.wait(pending)

    Weaviate

    pending: set[Any] = set()
    for ids, contents, embeddings, metadatas in data_iterator:
        pending.add(
            asyncio.ensure_future(
                vs.aadd_embeddings(
                    texts=contents,
                    embeddings=embeddings,
                    metadatas=metadatas,
                    ids=ids,
                )
            )
        )
        if len(pending) >= max_concurrency:
            _, pending = await asyncio.wait(
                pending, return_when=asyncio.FIRST_COMPLETED
            )
    if pending:
        await asyncio.wait(pending)

    Chroma

    pending: set[Any] = set()
    for ids, contents, embeddings, metadatas in data_iterator:
        pending.add(
            asyncio.ensure_future(
                vs.aadd_embeddings(
                    texts=contents,
                    embeddings=embeddings,
                    metadatas=metadatas,
                    ids=ids,
                )
            )
        )
        if len(pending) >= max_concurrency:
            _, pending = await asyncio.wait(
                pending, return_when=asyncio.FIRST_COMPLETED
            )
    if pending:
        await asyncio.wait(pending)

    Qdrant

    pending: set[Any] = set()
    for ids, contents, embeddings, metadatas in data_iterator:
        pending.add(
            asyncio.ensure_future(
                vs.aadd_embeddings(
                    texts=contents,
                    embeddings=embeddings,
                    metadatas=metadatas,
                    ids=ids,
                )
            )
        )
        if len(pending) >= max_concurrency:
            _, pending = await asyncio.wait(
                pending, return_when=asyncio.FIRST_COMPLETED
            )
    if pending:
        await asyncio.wait(pending)

    Milvus

    pending: set[Any] = set()
    for ids, contents, embeddings, metadatas in data_iterator:
        pending.add(
            asyncio.ensure_future(
                vs.aadd_embeddings(
                    texts=contents,
                    embeddings=embeddings,
                    metadatas=metadatas,
                    ids=ids,
                )
            )
        )
        if len(pending) >= max_concurrency:
            _, pending = await asyncio.wait(
                pending, return_when=asyncio.FIRST_COMPLETED
            )
    if pending:
        await asyncio.wait(pending)

מריצים את סקריפט ההעברה

  1. הגדרת סביבת Python.

  2. מתקינים את יחסי התלות של הדוגמה:

    pip install -r requirements.txt
  3. מריצים את ההעברה לדוגמה.

    Pinecone

    python migrate_pinecone_vectorstore_to_alloydb.py

    לפני שמריצים את הדוגמה, מחליפים את הערכים הבאים:

    • ‫PINECONE_API_KEY: מפתח ה-API של Pinecone.
    • ‫PINECONE_NAMESPACE: מרחב השמות של Pinecone.
    • ‫PINECONE_INDEX_NAME: השם של האינדקס ב-Pinecone.
    • ‫PROJECT_ID: מזהה הפרויקט.
    • ‫REGION: האזור שבו פרוס אשכול AlloyDB.
    • ‫CLUSTER: שם האשכול.
    • ‫INSTANCE: שם המכונה.
    • ‫DB_NAME: שם מסד הנתונים.
    • ‫DB_USER: שם המשתמש במסד הנתונים.
    • ‫DB_PWD: הסיסמה הסודית של מסד הנתונים.

    Weaviate

    python migrate_weaviate_vectorstore_to_alloydb.py

    לפני שמריצים את הדוגמה, מחליפים את הערכים הבאים:

    • ‫WEAVIATE_API_KEY: מפתח ה-API של Weaviate.
    • ‫WEAVIATE_CLUSTER_URL: כתובת ה-URL של אשכול Weaviate.
    • ‫WEAVIATE_COLLECTION_NAME: שם האוסף ב-Weaviate.
    • ‫PROJECT_ID: מזהה הפרויקט.
    • ‫REGION: האזור שבו פרוס אשכול AlloyDB.
    • ‫CLUSTER: שם האשכול.
    • ‫INSTANCE: שם המכונה.
    • ‫DB_NAME: שם מסד הנתונים.
    • ‫DB_USER: שם המשתמש במסד הנתונים.
    • ‫DB_PWD: הסיסמה הסודית של מסד הנתונים.

    Chroma

    python migrate_chromadb_vectorstore_to_alloydb.py

    לפני שמריצים את הדוגמה, מחליפים את הערכים הבאים:

    • ‫CHROMADB_PATH: הנתיב למסד הנתונים של Chroma.
    • ‫CHROMADB_COLLECTION_NAME: השם של אוסף מסד הנתונים של Chroma.
    • ‫PROJECT_ID: מזהה הפרויקט.
    • ‫REGION: האזור שבו פרוס אשכול AlloyDB.
    • ‫CLUSTER: שם האשכול.
    • ‫INSTANCE: שם המכונה.
    • ‫DB_NAME: שם מסד הנתונים.
    • ‫DB_USER: שם המשתמש במסד הנתונים.
    • ‫DB_PWD: הסיסמה הסודית של מסד הנתונים.

    Qdrant

    python migrate_qdrant_vectorstore_to_alloydb.py

    לפני שמריצים את הדוגמה, מחליפים את הערכים הבאים:

    • ‫QDRANT_PATH: הנתיב למסד הנתונים של Qdrant.
    • ‫QDRANT_COLLECTION_NAME: השם של אוסף Qdrant.
    • ‫PROJECT_ID: מזהה הפרויקט.
    • ‫REGION: האזור שבו פרוס אשכול AlloyDB.
    • ‫CLUSTER: שם האשכול.
    • ‫INSTANCE: שם המכונה.
    • ‫DB_NAME: שם מסד הנתונים.
    • ‫DB_USER: שם המשתמש במסד הנתונים.
    • ‫DB_PWD: הסיסמה הסודית של מסד הנתונים.

    Milvus

    python migrate_milvus_vectorstore_to_alloydb.py

    לפני שמריצים את הדוגמה, מחליפים את הערכים הבאים:

    • ‫MILVUS_URI: ה-URI של Milvus.
    • ‫MILVUS_COLLECTION_NAME: השם של אוסף Milvus.
    • ‫PROJECT_ID: מזהה הפרויקט.
    • ‫REGION: האזור שבו פרוס אשכול AlloyDB.
    • ‫CLUSTER: שם האשכול.
    • ‫INSTANCE: שם המכונה.
    • ‫DB_NAME: שם מסד הנתונים.
    • ‫DB_USER: שם המשתמש במסד הנתונים.
    • ‫DB_PWD: הסיסמה הסודית של מסד הנתונים.

    אם ההעברה תצליח, יודפסו יומנים שדומים לאלה, בלי שגיאות:
    Migration completed, inserted all the batches of data to AlloyDB

  4. פותחים את AlloyDB Studio כדי לראות את הנתונים שהועברו. מידע נוסף מופיע במאמר ניהול הנתונים באמצעות AlloyDB Studio.

הסרת המשאבים

כדי להימנע מחיובים בחשבון Google Cloud בגלל השימוש במשאבים שנעשה במסגרת המדריך הזה, אפשר למחוק את הפרויקט שמכיל את המשאבים או להשאיר את הפרויקט ולמחוק את המשאבים הנפרדים.

  1. נכנסים לדף Clusters במסוף Google Cloud .

    כניסה לדף Clusters

  2. בעמודה Resource name, לוחצים על שם האשכול שיצרתם.

  3. לוחצים על Delete cluster.

  4. בקטע Delete cluster, מזינים את שם האשכול כדי לאשר שרוצים למחוק אותו.

  5. לוחצים על Delete.

    אם יצרתם חיבור פרטי כשיצרתם אשכול, מחקו את החיבור הפרטי:

  6. נכנסים לדף Networking במסוף Google Cloud ולוחצים על Delete VPC network.

המאמרים הבאים