Install AlloyDB Omni with AlloyDB AI

This page shows you how to download and install AlloyDB Omni with AlloyDB AI. AlloyDB AI is a suite of features included with AlloyDB Omni that let you build enterprise generative AI applications.

To install AlloyDB Omni, see the following:

You can enable AlloyDB AI when you install AlloyDB Omni. AlloyDB Omni lets you integrate with Vertex AI to query cloud-based ML models. Both editions of AlloyDB Omni let you work with online predictions and vector embeddings generated from ML models.

For more information about the ML functionality of AlloyDB, see Build generative AI applications.

Configure your AlloyDB Omni installation to query cloud-based models

To install AlloyDB Omni with the ability to query cloud-based models using Vertex AI, follow these steps:

  1. Create a service account with Google Cloud.

  2. Create a service account key, in JSON format, and download it.

  3. Store the key in a permanent location on your file system. It resides at this location for the lifetime of your AlloyDB Omni server.

    Note its location on your file system; you need it for the next step.

  4. Add Vertex AI Identity and Access Management (IAM) permissions to the appropriate project and service account.

    gcloud projects add-iam-policy-binding PROJECT_ID \
        --member="serviceAccount:SERVICE_ACCOUNT_ID" \
        --role="roles/aiplatform.user"
    

    Replace the following:

    • PROJECT_ID: the ID of your Google Cloud project.

    • SERVICE_ACCOUNT_ID: the ID of the service account that you created in the previous step. This includes the full @PROJECT_ID.iam.gserviceaccount.com suffix. For example: my-service@my-project.iam-gserviceaccount.com.

  5. Follow all of the steps in Customize your AlloyDB Omni installation, substituting the following for the sudo alloydb database-server install command:

    sudo alloydb database-server install \
        --data-dir=DATA_DIR \
        --enable-alloydb-ai=true \
        --private-key-file-path=KEY_PATH \
        --vertex-ai-region="LOCATION"
    

    Replace the following:

    • DATA_DIR: the file system path that you want AlloyDB Omni to use for its data directory.

    • KEY_PATH: the file system path to the service account key that you downloaded in the previous step.

    • LOCATION: a Google Cloud region—for example, us-central1. For a list of regions that support generative AI, see Generative AI on Vertex AI locations.

Preview a simplified installation method for AlloyDB Omni AI

To install the Preview of a simplified installation method for AlloyDB Omni with the ability to query cloud-based models using Vertex AI, follow these steps:

  1. Perform all of the steps listed in Configure your AlloyDB Omni installation to query cloud-based models, excluding the final step that calls for running the sudo alloydb command. Because simplified installation method for AlloyDB Omni uses the Docker CLI and not the AlloyDB Omni CLI, you need to finish enabling AlloyDB AI integration using the following steps, instead.

  2. Make a local copy of the default simplified AlloyDB Omni installation method configuration file:

    docker run -i --rm google/alloydbomni cat /usr/share/postgresql/postgresql.conf.sample > my-postgres.conf
    
  3. Edit the configuration file copy to add directives for AlloyDB AI integration:

    echo "omni_enable_ml_agent_process = 'on'" >> my-postgres.conf
    echo "omni_google_cloud_private_key_file_path = '/etc/postgresql/private-key.json'" >> my-postgres.conf
    
  4. Adjust the file system permissions of the key and configuration files:

    sudo chmod +r my-postgres.conf
    sudo chmod +r KEY_PATH
    

    Replace KEY_PATH with the path to the service account private key file on your host file system. This is the key that you created and downloaded earlier in this procedure.

  5. Install the key and configuration files mounted onto the container:

    docker run --name CONTAINER_NAME -e POSTGRES_PASSWORD=NEW_PASSWORD -p HOST_PORT:5432 -v "$PWD/my-postgres.conf":/etc/postgresql/postgresql.conf -v "FULL_KEY_PATH":/etc/postgresql/private-key.json -d google/alloydbomni -c 'config_file=/etc/postgresql/postgresql.conf'
    

    Replace the following:

    • CONTAINER_NAME: the name to assign this new simplified AlloyDB Omni installation method container in your host machine's container registry—for example, my-omni-1.

    • NEW_PASSWORD: the password assigned to new container's postgres user after its creation.

    • HOST_PORT: the TCP port on the host machine that the container should publish its own port 5432 to. To use the PostgreSQL default port on the host machine as well, specify 5432.

    • FULL_KEY_PATH: the full file system path to the service account private key file on your host system.

What's next