Vérifiez que vous disposez d'au moins 5 Go d'espace disque libre.
Si vous exécutez des systèmes de sauvegarde externes ou à distance, effectuez une sauvegarde complète et mettez en veille toutes les sauvegardes planifiées pour éviter de sauvegarder pendant le processus de mise à niveau.
Arrêtez le processus PostgreSQL pour que les données puissent être déplacées pour la mise à niveau.
kexec-tiPOD_NAME--/bin/Bash
# Shut down postgres
postgres@POD_NAME:~$supervisorctl.parstoppostgres
postgres@POD_NAME:~$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;chmod2740/mnt/disks/pgsql/15/data
Remplacez la variable suivante :
POD_NAME : nom de votre pod.
Corrigez votre cluster de bases de données pour qu'il utilise la version 16.8.0 et vos agents du plan de contrôle (CPA) pour qu'ils utilisent la version 1.5.0.
Créez un cluster de base de données vide pour la version AlloyDB Omni mise à niveau.
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~
Remplacez la variable suivante :
POD_NAME : nom de votre pod.
Modifiez pg_hba.conf dans votre cluster de base de données existant pour fournir au processus de mise à niveau les autorisations et les connexions dont il a besoin.
# 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
Remplacez la variable suivante :
POD_NAME : nom de votre pod.
Modifiez pg_hba.conf dans le nouveau cluster de bases de données pour fournir au processus de mise à niveau les autorisations et les connexions dont il a besoin.
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
Remplacez la variable suivante :
POD_NAME : nom de votre pod.
Mettez à niveau votre cluster de bases de données.
# (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/
Remplacez la variable suivante :
POD_NAME : nom de votre pod.
Une fois la mise à niveau effectuée, supprimez l'annotation de mise à niveau manuelle de la version de votre cluster de bases de données.
Reprenez les opérations normales et réactivez les sauvegardes, les plans de sauvegarde ou les processus de réplication que vous avez désactivés lors des étapes 1 à 3.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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."]]