Prüfen Sie, ob Sie mindestens 5 GB freien Speicherplatz haben.
Wenn Sie externe oder Remote-Sicherungssysteme verwenden, führen Sie eine vollständige Sicherung durch und pausieren Sie alle geplanten Sicherungen, um Sicherungen während des Upgrades zu vermeiden.
Erstellen Sie einen leeren Datenbankcluster für die aktualisierte AlloyDB Omni-Version.
kubectlexec-tiPOD_NAME--/bin/Bash
postgres@POD_NAME:~$supervisorctl.parstoppostgres
# Initialize a new, empty database cluster for the new version.
postgres@POD_NAME:~$rm-fr/mnt/disks/pgsql/data;initdb-D/mnt/disks/pgsql/data-Ualloydbadmin--data-checksums--encoding=UTF8--locale=C--locale-provider=icu--icu-locale=und-x-icu--auth-host=trust--auth-local=reject;cd~
Ersetzen Sie die folgende Variable:
POD_NAME: der Name Ihres Pods.
Ändern Sie pg_hba.conf in Ihrem vorhandenen Datenbankcluster, um dem Upgrade-Prozess die erforderlichen Berechtigungen und Verbindungen zu gewähren.
# Backup pg_hba.conf of the pg15 cluster
postgres@POD_NAME:~$cp/mnt/disks/pgsql/15/data/pg_hba.conf/mnt/disks/pgsql/15/data/pg_hba.conf.bak
# Update pg15 configurations
postgres@POD_NAME:~$echo"local all all trust" >> /mnt/disks/pgsql/15/data/pg_hba.conf;echo"host all all 127.0.0.1/32 trust" >> /mnt/disks/pgsql/15/data/pg_hba.conf
Ersetzen Sie die folgende Variable:
POD_NAME: der Name Ihres Pods.
Ändern Sie pg_hba.conf im neuen Datenbankcluster, um dem Upgrade-Prozess die erforderlichen Berechtigungen und Verbindungen zu gewähren.
postgres@POD_NAME:~$rm/mnt/disks/pgsql/data/pg_hba.conf;echo"local all all trust" >> /mnt/disks/pgsql/data/pg_hba.conf;echo"host all all 127.0.0.1/32 trust" >> /mnt/disks/pgsql/data/pg_hba.conf;chmod2740/mnt/disks/pgsql/15/data
Ersetzen Sie die folgende Variable:
POD_NAME: der Name Ihres Pods.
Führen Sie ein Upgrade Ihres Datenbankclusters durch.
# (optional) Make sure postgres is stopped
postgres@POD_NAME:~$supervisorctl.parstoppostgres
# (optional) Check to verify that data can be upgraded.
postgres@POD_NAME:~$pg_upgrade-Ualloydbadmin--check-b/mnt/disks/pgsql/15/bin-B/usr/lib/postgresql/16/bin-d/mnt/disks/pgsql/15/data-D/mnt/disks/pgsql/data--link-v
postgres@POD_NAME:~$pg_upgrade-Ualloydbadmin-b/mnt/disks/pgsql/15/bin-B/usr/lib/postgresql/16/bin-d/mnt/disks/pgsql/15/data-D/mnt/disks/pgsql/data--link-v
# Recover pg15 configurations
postgres@POD_NAME:~$cp/mnt/disks/pgsql/15/data/pg_hba.conf.bak/mnt/disks/pgsql/data/pg_hba.conf;cp-r/mnt/disks/pgsql/15/data/postgresql.conf/mnt/disks/pgsql/data/.;cp-r/mnt/disks/pgsql/15/data/postgresql.conf.d/mnt/disks/pgsql/data/.;cp-r/mnt/disks/pgsql/15/data/parambackup/mnt/disks/pgsql/data/.
# Start postgres
postgres@POD_NAME:~$supervisorctl.parstartpostgres
# Clean up backup data
postgres@POD_NAME:~$rm-fr/mnt/disks/pgsql/15/
Ersetzen Sie die folgende Variable:
POD_NAME: der Name Ihres Pods.
Entfernen Sie nach einem erfolgreichen Upgrade die Anmerkung zum manuellen Versionsupgrade aus Ihrem Datenbankcluster.
Nehmen Sie den normalen Betrieb wieder auf und aktivieren Sie alle Sicherungen, Sicherungspläne oder Replikationsprozesse, die Sie in den Schritten 1 bis 3 deaktiviert haben.
[[["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)."],[],[],null,["# Upgrade to AlloyDB Omni version 16.8.0 on Kubernetes\n\nSelect a documentation version: Current (16.8.0)keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/upgrade-kubernetes-database-major-version)\n- [16.8.0](/alloydb/omni/16.8.0/docs/upgrade-kubernetes-database-major-version)\n\n\u003cbr /\u003e\n\nThis page describes how to perform a major version upgrade to AlloyDB Omni version 16.8.0 on Kubernetes.\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\n- Verify that your AlloyDB Omni Kubernetes operator version is\n `1.5.0`. To upgrade your\n AlloyDB Omni operator version, see\n [Migrate to the latest AlloyDB Omni Kubernetes operator version](/alloydb/omni/current/docs/upgrade-kubernetes-operator-version).\n\n- Verify that you have at least 5GB of free disk space.\n\n- If you run external or remote backup systems, perform a full backup and\n pause any scheduled backups to avoid backing up during the upgrade process.\n\n- For\n [high availability (HA) and data resilience (DR)](/alloydb/omni/current/docs/high-availability/overview)\n environments, decouple your database clusters before upgrading them.\n\nUpgrade your AlloyDB Omni version\n---------------------------------\n\nTo upgrade your AlloyDB Omni version using `pg_upgrade`, do one\nof the following:\n\n- Run the [Bash script](#upgrade-script) that performs the upgrade for you.\n\n- [Run the upgrade instructions manually](#manual-upgrade).\n\nPerform scripted upgrade\n------------------------\n\nYou can find a script that performs the [manual upgrade steps](#manual-upgrade)\nin the\n[AlloyDB Omni samples on GitHub](https://github.com/GoogleCloudPlatform/alloydb-omni-samples/tree/main/samples/MVU.sh).\n\nTo use the upgrade script, download the script and run the following command: \n\n ./MVU.sh 16.8.0 1.5.0 \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e\n\nReplace the following variables:\n\n- \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of your database cluster.\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the namespace for your database cluster.\n\nPerform manual upgrade steps\n----------------------------\n\n1. [Back up your data](/alloydb/omni/current/docs/backup-kubernetes) to avoid any data loss.\n\n2. [Remove your backup plan](/alloydb/omni/current/docs/backup-kubernetes).\n\n3. Terminate all replication processes. This includes\n [physical replication](/alloydb/omni/current/docs/about-pglogical) used for\n [high availability (HA) and data resilience (DR)](/alloydb/omni/current/docs/high-availability/overview)\n as well as all [logical replication](/alloydb/omni/current/docs/create-replication-slots)\n streams.\n\n4. Annotate your database cluster to specify a manual version upgrade.\n\n kubectl annotate dbclusters.alloydbomni.dbadmin.goog \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e dbs.dbadmin.goog.com/manualmvu=true\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of your database cluster.\n5. Stop the PostgreSQL process so that data can be moved for the upgrade.\n\n k exec -ti \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e -- /bin/Bash\n # Shut down postgres\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ supervisorctl.par stop postgres\n\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ mkdir /mnt/disks/pgsql/15; mv /mnt/disks/pgsql/data /mnt/disks/pgsql/15/data; cp -r /usr/lib/postgresql/15/bin /mnt/disks/pgsql/15/.; cp -r /usr/lib/postgresql/15/lib /mnt/disks/pgsql/15/.; cp -r /usr/share/postgresql/15 /mnt/disks/pgsql/15/share; rm /mnt/disks/pgsql/15/share/postgresql.conf.sample; cp /usr/share/postgresql/postgresql.conf.sample /mnt/disks/pgsql/15/share/postgresql.conf.sample; chmod 2740 /mnt/disks/pgsql/15/data\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n6. Patch your database cluster to version `16.8.0` and\n your control plane agents (CPA) to `1.5.0`.\n\n kubectl patch dbclusters.alloydbomni.dbadmin.goog \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e --type=merge -p '{\"spec\":{\"databaseVersion\":\"16.8.0\",\"controlPlaneAgentsVersion\":\"omni_control_plane_agents_version\"}}'\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of your database cluster.\n7. Create an empty database cluster for the upgraded\n AlloyDB Omni version.\n\n kubectl exec -ti \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e -- /bin/Bash\n\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ supervisorctl.par stop postgres\n\n # Initialize a new, empty database cluster for the new version.\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ rm -fr /mnt/disks/pgsql/data; initdb -D /mnt/disks/pgsql/data -U alloydbadmin --data-checksums --encoding=UTF8 --locale=C --locale-provider=icu --icu-locale=und-x-icu --auth-host=trust --auth-local=reject; cd ~\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n8. Modify `pg_hba.conf` in your pre-existing database cluster to provide the\n upgrade process the permissions and connections it needs.\n\n # Backup pg_hba.conf of the pg15 cluster\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ cp /mnt/disks/pgsql/15/data/pg_hba.conf /mnt/disks/pgsql/15/data/pg_hba.conf.bak\n\n # Update pg15 configurations\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ echo \"local all all trust\" \u003e\u003e /mnt/disks/pgsql/15/data/pg_hba.conf; echo \"host all all 127.0.0.1/32 trust\" \u003e\u003e /mnt/disks/pgsql/15/data/pg_hba.conf\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n9. Modify `pg_hba.conf` in the new database cluster to provide the upgrade\n process the permissions and connections it needs.\n\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ rm /mnt/disks/pgsql/data/pg_hba.conf; echo \"local all all trust\" \u003e\u003e /mnt/disks/pgsql/data/pg_hba.conf; echo \"host all all 127.0.0.1/32 trust\" \u003e\u003e /mnt/disks/pgsql/data/pg_hba.conf; chmod 2740 /mnt/disks/pgsql/15/data\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n10. Upgrade your database cluster.\n\n # (optional) Make sure postgres is stopped\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ supervisorctl.par stop postgres\n\n # (optional) Check to verify that data can be upgraded.\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ pg_upgrade -U alloydbadmin --check -b /mnt/disks/pgsql/15/bin -B /usr/lib/postgresql/16/bin -d /mnt/disks/pgsql/15/data -D /mnt/disks/pgsql/data --link -v\n\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ pg_upgrade -U alloydbadmin -b /mnt/disks/pgsql/15/bin -B /usr/lib/postgresql/16/bin -d /mnt/disks/pgsql/15/data -D /mnt/disks/pgsql/data --link -v\n\n # Recover pg15 configurations\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ cp /mnt/disks/pgsql/15/data/pg_hba.conf.bak /mnt/disks/pgsql/data/pg_hba.conf; cp -r /mnt/disks/pgsql/15/data/postgresql.conf /mnt/disks/pgsql/data/.; cp -r /mnt/disks/pgsql/15/data/postgresql.conf.d /mnt/disks/pgsql/data/.; cp -r /mnt/disks/pgsql/15/data/parambackup /mnt/disks/pgsql/data/.\n\n # Start postgres\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ supervisorctl.par start postgres\n\n # Clean up backup data\n postgres@\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:~$ rm -fr /mnt/disks/pgsql/15/\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of your pod.\n11. After a successful upgrade, remove the manual version upgrade annotation\n from your database cluster.\n\n kubectl annotate dbclusters.alloydbomni.dbadmin.goog \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e dbs.dbadmin.goog.com/manualmvu-\n\n Replace the following variable:\n - \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of your database cluster.\n12. Resume normal operations and re-enable any backups, backup plans, or\n replication processes that you disabled in steps one through three."]]