Ab AlloyDB Omni 15.5.4 steuern Sie AlloyDB Omni mit gängigen Paketverwaltungstools.
Wenn Sie bereits eine Installation von AlloyDB Omni haben, folgen Sie der Anleitung auf dieser Seite, um zur neuen Installation mit einem einzelnen Image zu migrieren.
Vorbereitung
Bevor Sie mit dem Upgrade auf die neueste Version von AlloyDB Omni beginnen können, müssen Sie die folgenden Voraussetzungen erfüllen, sofern Sie dies noch nicht getan haben.
Upgrade auf AlloyDB Omni 15.5.2
Die neueste AlloyDB Omni-Version, die die AlloyDB Omni CLI unterstützt, ist 15.5.2.
Führen Sie den folgenden Befehl aus, um die Version von AlloyDB Omni zu prüfen:
sudoalloydbversion
Die Ausgabe sieht dann ungefähr so aus:
AlloyDB Omni CLI version: 1.6
AlloyDB Omni database server version: 15.5.2
Wenn in der Ausgabe eine Datenbankversion vor 15.5.2 angezeigt wird, führen Sie den folgenden Befehl aus, um ein Upgrade durchzuführen:
sudoalloydbdatabase-serverupgrade
Informationen zu Ihrer bestehenden Installation sammeln
Führen Sie dazu diesen Befehl aus:
cat/var/alloydb/config/dataplane.conf
Notieren Sie sich aus der Ausgabe des cat-Befehls die Werte der folgenden Variablen:
DATADIR_PATH, z. B. /var/alloydb/main
ENABLE_ALLOYDB_AI, z. B. FALSE
PGPORT, z. B. 5432
INSTANCE_TYPE, z. B. PRIMARY/READ_REPLICA
Mit der postgres_ann-Erweiterung erstellte ScaNN-Indizes löschen
Die Erweiterung postgres_ann wurde in alloyd_scann umbenannt. Wenn Sie die postgres_ann-Erweiterung installiert und ScaNN-Indizes damit erstellt haben, müssen Sie alle ScaNN-Indizes löschen und die Erweiterung deinstallieren, bevor Sie ein Upgrade durchführen.
Führen Sie die folgenden Schritte aus, um Auswirkungen auf Ihre Datenbank aufgrund der Umbenennung der postgres_ann-Erweiterung zu beheben:
Ersetzen Sie DATABASE_NAME durch den Namen der Datenbank, in der Sie die Abfrage ausführen möchten.
Speichern Sie Indexdefinitionen und Parameter als DDL-Dump mit einem Dienstprogramm wie pg_dump, um die ScaNN-Indizes später neu zu erstellen.
pg_dump-stTABLE_NAMEDATABASE_NAME
Ersetzen Sie Folgendes:
DATABASE_NAME: der Name der Datenbank
TABLE_NAME: der Name der Tabelle.
Löschen Sie ScaNN-Indexe, die mit dem postgres_ann-Index erstellt wurden.
DROPINDEXINDEX_NAME;
Ersetzen Sie INDEX_NAME durch den Namen der Datenbank, in der Sie die Abfrage ausführen möchten.
Prüfen Sie, ob in Ihren Datenbanken ScaNN-Indizes enthalten sind. Verwenden Sie die folgende SQL-Abfrage, um die Löschung zu überprüfen: Die folgende SQL-Abfrage sollte eine leere Ergebnismenge zurückgeben.
Die Argumente für docker run sind die, die in früheren Versionen von AlloyDB Omni verwendet wurden. Sie können sie aber weiter anpassen. Weitere Informationen finden Sie unter AlloyDB Omni-Installation anpassen.
Wenn der Typ Ihrer Datenbankinstanz PRIMARY ist, führen Sie den folgenden Befehl aus, um die folgenden Nutzer zu erstellen. Das sind Nutzernamen, die derzeit nicht verwendet werden, aber für zukünftige Erweiterungen reserviert sind.
fornameinalloydbagentalloydbexportalloydbiamgroupuseralloydbiamuseralloydbimportexportalloydbobservabilityalloydbsqllogicalalloydbsuperuser;doechodockerexec-itCONTAINER_NAMEpsql-hlocalhost-Upostgresalloydbadmin\-c"CREATE ROLE ${name} NOLOGIN;"\-c"CREATE TABLE ${name}_table();"\-c"ALTER TABLE ${name}_table OWNER TO ${name};"done
Die Deinstallation der AlloyDB Omni-Befehlszeile wirkt sich nicht auf Ihre in AlloyDB Omni gespeicherten Daten aus.
ScaNN-Indizes mit der alloydb_scann-Erweiterung neu erstellen
Nach dem Upgrade von AlloyDB Omni wird auch die Erweiterung alloydb_scann installiert. Führen Sie die folgenden Schritte aus, um ScaNN-Indizes neu zu erstellen, die Sie vor dem Upgrade im Abschnitt Mit der Erweiterung postgres_ann erstellte ScaNN-Indizes löschen gelöscht haben.
So erstellen Sie die alloydb_scann-Erweiterung:
Führen Sie die folgende Abfrage aus, um die alloydb_scann-Erweiterung zu erstellen:
createextensionalloydb_scanncascade;
Prüfen Sie, ob die Erweiterung alloydb_scann erfolgreich erstellt wurde.
select*frompg_extension;
Erstellen Sie den ScaNN-Index für Ihre Tabelle neu und stellen Sie dann die vorherigen pg_dump-DDL-Indexdefinitionen wieder her.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThis page provides instructions for migrating from AlloyDB Omni versions 15.5.2 and earlier to the latest version, which uses package-management tools and a single-image installation.\u003c/p\u003e\n"],["\u003cp\u003eBefore upgrading, users must first upgrade to AlloyDB Omni version 15.5.2, gather information about their existing installation's configuration, and drop any ScaNN indexes created with the \u003ccode\u003epostgres_ann\u003c/code\u003e extension.\u003c/p\u003e\n"],["\u003cp\u003eThe upgrade process involves stopping the existing database, starting a new single-image container while mounting the existing data directory, and running specific commands for user creation and AlloyDB AI setup if applicable.\u003c/p\u003e\n"],["\u003cp\u003eAfter upgrading, users must reinstall the \u003ccode\u003ealloydb_scann\u003c/code\u003e extension, and then recreate ScaNN indexes to replace the old ones that had to be dropped before upgrading.\u003c/p\u003e\n"],["\u003cp\u003eThe old AlloyDB Omni CLI needs to be uninstalled as part of the upgrade, as the latest version doesn't use it.\u003c/p\u003e\n"]]],[],null,["# Migrate from AlloyDB Omni version 15.5.2 and earlier to the latest version\n\nSelect a documentation version: 15.5.5keyboard_arrow_down\n\n- [15.7.0](/alloydb/omni/15.7.0/docs/migrate-to-latest-version)\n- [15.5.5](/alloydb/omni/15.5.5/docs/migrate-to-latest-version)\n- [15.5.4](/alloydb/omni/15.5.4/docs/migrate-to-latest-version)\n\n\u003cbr /\u003e\n\nThis page provides instructions for migrating from version 15.5.2 and earlier to the latest version of AlloyDB Omni.\n\n\u003cbr /\u003e\n\nStarting with AlloyDB Omni 15.5.4, you control AlloyDB Omni with common package-management tools.\n\nIf you have an existing installation of AlloyDB Omni, follow the instructions on this page to migrate to the new, single-image installation.\n\nPrerequisites\n-------------\n\nBefore you can start upgrading to the latest version of AlloyDB Omni, complete the following prerequisites, if you haven't done so already.\n\n### Upgrade to AlloyDB Omni 15.5.2\n\nThe latest AlloyDB Omni version that supports the AlloyDB Omni CLI is 15.5.2.\nTo check the version of AlloyDB Omni, run the following command: \n\n sudo alloydb version\n\nThe output looks similar to the following: \n\n AlloyDB Omni CLI version: 1.6\n AlloyDB Omni database server version: 15.5.2\n\nIf the output displays a database version earlier than 15.5.2, run the following command to upgrade: \n\n sudo alloydb database-server upgrade\n\n### Gather information about your existing installation\n\n1. Run the following command:\n\n cat /var/alloydb/config/dataplane.conf\n\n2. From the output of the `cat` command, note the values of the following variables for your reference:\n\n - \u003cvar translate=\"no\"\u003eDATADIR_PATH\u003c/var\u003e---for example, `/var/alloydb/main`\n - \u003cvar translate=\"no\"\u003eENABLE_ALLOYDB_AI\u003c/var\u003e---for example, `FALSE`\n - \u003cvar translate=\"no\"\u003ePGPORT\u003c/var\u003e---for example, `5432`\n - \u003cvar translate=\"no\"\u003eINSTANCE_TYPE\u003c/var\u003e---for example, `PRIMARY/READ_REPLICA`\n\n### Drop ScaNN indexes created with `postgres_ann` extension\n\n|\n| **Preview\n| --- AlloyDB ScaNN index**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThe `postgres_ann` extension is renamed to `alloyd_scann`. If you have installed the `postgres_ann` extension and created `ScaNN` indexes using the extension, you must drop all `ScaNN` indexes and uninstall the extension before performing an upgrade.\n\nTo handle any impact to your database due to the renaming of the `postgres_ann` extension, complete the following steps:\n\n1. [Run and connect to AlloyDB Omni.](/alloydb/omni/15.5.5/docs/run-connect)\n2. Identify all tables that use the `ScaNN` index.\n\n \\c \u003cvar translate=\"no\"\u003eDATABASE_NAME\u003c/var\u003e\n select schemaname, relname, indexrelname, indextype, indexconfig, indexsize, indexscan FROM pg_stat_ann_indexes;\n\n Replace \u003cvar translate=\"no\"\u003eDATABASE_NAME\u003c/var\u003e with the name of the database where you want to run the query.\n3. Save index definitions and parameters as a dump DDL using a utility like `pg_dump` to recreate the `ScaNN` indexes later.\n\n pg_dump -st \u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e \u003cvar translate=\"no\"\u003eDATABASE_NAME\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eDATABASE_NAME\u003c/var\u003e: the name of the database.\n - \u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e: the name of the table.\n4. Drop `ScaNN` Indexes that were created using the `postgres_ann` index.\n\n DROP INDEX \u003cvar translate=\"no\"\u003eINDEX_NAME\u003c/var\u003e;\n\n Replace \u003cvar translate=\"no\"\u003eINDEX_NAME\u003c/var\u003e with the name of the database where you want to run the query.\n | **Note:** If the index is not successfully dropped before upgrading, then the table will be not used and queried in subsequent query requests.\n5. Verify that none of your databases include `ScaNN` indexes. Use the following SQL query to verify the deletion: The following sql should return an empty result set.\n\n \\c \u003cvar translate=\"no\"\u003eDATABASE_NAME\u003c/var\u003e\n select schemaname, relname, indexrelname, indextype, indexconfig, indexsize, indexscan FROM pg_stat_ann_indexes;\n\n6. Drop the `postgres_ann` extension using the following steps:\n\n 1. Verify that the `postgres_ann` extension is installed in your database.\n\n select * from pg_extension;\n\n 1. Drop the `postgres_ann` extension.\n\n DROP EXTENSION postgres_ann CASCADE;\n\n 1. Verify that the `postgres_ann` extension is no longer installed in your database.\n\n select * from pg_extension;\n\nPerform an in-place upgrade\n---------------------------\n\n1. Stop the existing database:\n\n sudo alloydb database-server stop\n\n2. Start the new single-image AlloyDB Omni, mounting your existing data directory from before:\n\n docker run --name \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e \\\n -e POSTGRES_PASSWORD=\u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e \\\n -e PGDATA=/var/lib/postgresql/data \\\n -v /var/alloydb/main/data:/var/lib/postgresql/data \\\n -v /dev/shm:/dev/shm \\\n -p \u003cvar translate=\"no\"\u003ePGPORT\u003c/var\u003e:5432 \\\n --network=host \\\n --ulimit=nice=-20:-20 \\\n --ulimit=core=-1:-1 \\\n --log-driver=journald \\\n -d google/alloydbomni:15.5.5\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e: The name to assign this new AlloyDB Omni container in your host machine's container registry---for example, `my-omni`.\n\n - \u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e: The password assigned the new container's `postgres` user after its creation.\n\n - \u003cvar translate=\"no\"\u003ePGPORT\u003c/var\u003e: The IP address of the port the AlloyDB Omni runs on. This is the value you noted down in step 2 of [Gather information about your existing installation](#gather-information).\n\n The arguments to `docker run` are the ones used in earlier versions of AlloyDB Omni, but you may further customize them. See [Customize your AlloyDB Omni installation](/alloydb/omni/15.5.5/docs/install) for details.\n3. If your database instance type is `PRIMARY`, run the following command to create the following users. These are usernames which are unused at the moment, but reserved for future extensions.\n\n for name in alloydbagent alloydbexport alloydbiamgroupuser alloydbiamuser alloydbimportexport alloydbobservability alloydbsqllogical alloydbsuperuser; do\n echo docker exec -it \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e psql -h localhost -U postgres alloydbadmin \\\n -c \"CREATE ROLE ${name} NOLOGIN;\" \\\n -c \"CREATE TABLE ${name}_table();\" \\\n -c \"ALTER TABLE ${name}_table OWNER TO ${name};\"\n done\n\n4. If `ENABLE_ALLOYDB_AI` is set to `TRUE`, follow instructions in [Install AlloyDB Omni with AlloyDB AI](/alloydb/omni/15.5.5/docs/install-with-alloydb-ai) to set up AlloyDB AI.\n\n5. Connect to the database to verify that the data is unchanged:\n\n docker exec -it \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e psql -h localhost -U postgres\n\n6. Uninstall the AlloyDB Omni CLI:\n\n sudo alloydb database-server uninstall\n\n The AlloyDB Omni CLI uninstallation does not affect your data stored in AlloyDB Omni.\n\nRecreate ScaNN indexes using `alloydb_scann` extension\n------------------------------------------------------\n\nAfter you upgrade AlloyDB Omni, the `alloydb_scann` extension is also installed. Complete the following steps to recreate ScaNN indexes that you dropped in the [Drop ScaNN indexes created with `postgres_ann` extension](#drop-extension-postgres-ann) section before the upgrade.\n\n1. Create the `alloydb_scann` extension using the following steps:\n\n 1. To create the `alloydb_scann` extension, run the following query:\n\n create extension alloydb_scann cascade;\n\n 1. Verify that the `alloydb_scann` extension was created successfully.\n\n select * from pg_extension;\n\n2. Recreate `ScaNN` index for your table, and then restore the previous `pg_dump` DDL index definitions.\n\n 1. Create `ScaNN` index on the table:\n\n CREATE INDEX \u003cvar translate=\"no\"\u003eINDEX_NAME\u003c/var\u003e ON \u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e\n USING scann (\u003cvar translate=\"no\"\u003eVECTOR_COLUMN\u003c/var\u003e \u003cvar translate=\"no\"\u003eDISTANCE\u003c/var\u003e)\n WITH (num_leaves = \u003cvar translate=\"no\"\u003eNUM_LEAVES_VALUE\u003c/var\u003e);\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eINDEX_NAME\u003c/var\u003e: the name of the index.\n - \u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e: the name of the table.\n - \u003cvar translate=\"no\"\u003eVECTOR_COLUMN\u003c/var\u003e: the name of the column that stores vector data.\n - \u003cvar translate=\"no\"\u003eDISTANCE\u003c/var\u003e: the distance function to use with this index.\n - \u003cvar translate=\"no\"\u003eNUM_LEAVES_VALUE\u003c/var\u003e: the number of partitions to apply to the index.\n\n 1. Verify that the index is created.\n\n \\d TABLE_NAME\n\n 1. Recommended: Backup your indexes data. We recommend creating a backup of your database and indexes as a best practice.\n\n | **Caution:** Any backup that includes the `postgres_ann` extension and was taken before the upgrade cannot be restored after the upgrade."]]