Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie Datenbank-Flags für eine Instanz in einem AlloyDB for PostgreSQL-Cluster hinzufügen, ändern und löschen.
Sie können Datenbank-Flags für viele Vorgänge verwenden, z. B. für das Anpassen von PostgreSQL-Parametern und Optionen sowie für das Konfigurieren und Optimieren einer Instanz.
Änderungen am Wert eines Datenbank-Flags bleiben für die Instanz erhalten, bis Sie das Flag entfernen oder seinen Wert noch einmal ändern.
In einigen Fällen ist es notwendig, vor dem Setzen eines Flags ein anderes Flag zu setzen, damit die Funktionalität in vollem Umfang genutzt werden kann.
Wenn Sie ein Flag für eine Datenbankinstanz festlegen, entfernen oder ändern, wird die Instanz möglicherweise neu gestartet. Das hängt vom Flag ab, wie in Unterstützte Datenbank-Flags aufgeführt.
Wenn Sie ein Datenbankflag in der primären Instanz oder einer Lesepoolinstanz ändern, für das ein Neustart erforderlich ist, können Sie eine der folgenden Wartungsrichtlinien auswählen:
Geringe Ausfallzeiten. Diese Richtlinie ist standardmäßig aktiviert. Wir empfehlen, diese Richtlinie für alle AlloyDB-Cluster in der Produktionsumgebung zu verwenden, da sie die Ausfallzeiten von Anwendungen minimiert.
Wenn die Richtlinie für geringe Ausfallzeiten aktiviert ist, hat das Aktualisieren eines Flags, das einen Neustart der primären Instanz Ihres Clusters erfordert, folgende Auswirkungen:
Bei den meisten Arbeitslasten ist die primäre Instanz weniger als eine Sekunde lang nicht verfügbar.
Es dauert etwa 15 Minuten, bis das Flag auf der primären Instanz auf den neuen Wert aktualisiert wurde.
Wenn Sie ein Flag aktualisieren, das einen Neustart einer Lesepoolinstanz erfordert, hat das folgende Auswirkungen:
Bei der Lesepoolinstanz kommt es zu keinen Ausfallzeiten.
Die Aktualisierung des Flags für die Instanz des Lesepools auf den neuen Wert dauert etwa 10 Minuten.
Erzwingen Wenn Sie Flag-Updates schneller anwenden möchten, verwenden Sie die Option FORCE_APPLY mit dem Befehl gcloud beta alloydb instances update.
Diese Richtlinie eignet sich besser für Entwicklungsumgebungen, da Sie Flags schnell hinzufügen oder ändern können. Dafür müssen Sie jedoch längere Ausfallzeiten der Instanz und eine vorübergehende Verringerung der Datenbankleistung oder des Durchsatzes in Kauf nehmen. Es dauert einige Minuten, bis Ihr Cluster nach dem Erzwingen einer Flag-Aktualisierung wieder die Spitzenleistung erreicht.
Wenn die Richtlinie „Force Apply Policy“ aktiviert ist, hat das Aktualisieren eines Flags, für das ein Neustart der primären Instanz Ihres Clusters erforderlich ist, folgende Auswirkungen:
Bei der primären Instanz kommt es zu einer Ausfallzeit von etwa einer Minute.
Das Flag auf der primären Instanz wird nach ein bis zwei Minuten auf den neuen Wert aktualisiert.
Wenn Sie ein Flag aktualisieren, das einen Neustart einer Lesepoolinstanz erfordert, hat das folgende Auswirkungen:
Die Lesepoolinstanz ist etwa eine Minute lang nicht verfügbar.
Das Flag für die Lesepoolinstanz wird nach ein bis zwei Minuten auf den neuen Wert aktualisiert.
Klicken Sie in der Spalte Ressourcenname auf einen Cluster.
Rufen Sie auf der Seite Übersicht den Bereich Instanzen in Ihrem Cluster auf, wählen Sie eine Instanz aus und klicken Sie auf Bearbeiten.
So fügen Sie ein Datenbankflag für Ihre Instanz hinzu, ändern oder löschen es:
Markierung hinzufügen
Klicken Sie auf Flag hinzufügen, um Ihrer Instanz ein Datenbank-Flag hinzuzufügen.
Wählen Sie ein Flag aus der Liste Neues Datenbankflag aus.
Geben Sie einen Wert für das Flag an.
Klicken Sie auf Fertig.
Flag ändern
Wenn Sie ein in Ihrer Instanz vorhandenes Datenbank-Flag ändern möchten, maximieren Sie das Datenbank-Flag und ändern Sie den Wert des vorhandenen Flags im Bereich Datenbank-Flag bearbeiten.
Klicken Sie auf Fertig.
Kennzeichnung löschen
Wenn Sie ein Datenbank-Flag aus Ihrer Instanz löschen möchten, wählen Sie ein Flag aus und klicken Sie auf das Löschsymbol.
Wenn Sie möchten, dass Flag-Updates schneller angewendet werden, fügen Sie das Argument --update-mode=FORCE_APPLY ein. Da dies die Datenbankleistung vorübergehend beeinträchtigen kann, sollten Sie diese Option nicht in einer Produktionsumgebung verwenden.
FLAGS_LIST: Eine durch Kommas getrennte Liste mit einer oder mehreren Spezifikationen für Datenbank-Flags. Jede Spezifikation besteht aus dem Namen des Flags, einem Gleichheitszeichen (=) und dem Wert, der den Flags zugewiesen werden soll. Für Datenbank-Flags, die keine Werte annehmen, geben Sie den Namen des Flags gefolgt von einem Gleichheitszeichen (=) an.
REGION_ID: Die Region, in der sich die Instanz befindet, z. B. us-central1.
CLUSTER_ID: Die ID des Clusters, in dem sich die Instanz befindet.
PROJECT_ID: Die ID des Projekts, in dem sich der Cluster befindet.
Führen Sie den folgenden Befehl aus, um die Liste der aktuellen, manuell festgelegten Flags einer Instanz aufzurufen:
[[["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 guide details how to add, modify, and delete database flags for instances within an AlloyDB for PostgreSQL cluster, which are used for various operational adjustments.\u003c/p\u003e\n"],["\u003cp\u003eDatabase flag modifications persist until removed or changed, and sometimes, setting one flag necessitates setting another for full functionality.\u003c/p\u003e\n"],["\u003cp\u003eApplying flag changes may trigger an instance restart, and users can choose between a "Low downtime" policy (recommended for production) or a "Force apply" policy (for faster updates, but with potential downtime and performance dips).\u003c/p\u003e\n"],["\u003cp\u003eThe "Low downtime" policy on primary instances results in minimal downtime (less than one second) and read pools experience zero downtime, while "Force apply" results in about one minute of downtime for both, with flag changes applying much faster.\u003c/p\u003e\n"],["\u003cp\u003eYou can manage database flags via the Google Cloud console or by using the \u003ccode\u003egcloud\u003c/code\u003e command-line tool, being cautious that \u003ccode\u003egcloud\u003c/code\u003e commands can reset unlisted flags to their default values.\u003c/p\u003e\n"]]],[],null,["# Configure an instance's database flags\n\nThis page describes how to add database flags for an instance, modify database\nflags, and delete database flags from an instance in an AlloyDB for PostgreSQL\ncluster.\n\nYou use database flags for many operations, including adjusting PostgreSQL\nparameters, adjusting options, and configuring and tuning an instance.\nModifications to a database flag's value persist for its\ninstance until you remove the flag or you modify its value again.\n\nIn some cases, setting one flag may require that you set another flag to\nfully enable the desired functionality.\n\nAfter you set, remove, or modify a flag for a database instance,\nAlloyDB might restart the instance. This depends upon the flag,\nas listed in\n[Supported database flags](https://cloud.google.com/alloydb/docs/reference/database-flags).\n\nWhen you modify a database flag in the primary or a read pool instance\nthat needs a restart, you can choose one of the following maintenance policies:\n\n- **Low downtime.** This policy is enabled by default. We recommend\n using this policy for all your production AlloyDB\n clusters because it minimizes application downtime.\n\n With the low downtime policy enabled, updating a flag that requires a\n restart on your cluster's primary instance has these effects:\n - The primary instance experiences less than one second of downtime\n for most workloads.\n\n - The flag on the primary instance finishes updating to its new value\n after about 15 minutes.\n\n Updating a flag that requires a restart on a read pool instance has\n these effects:\n - The read pool instance does not require any downtime.\n\n - The flag on the read pool instance finishes updating to its new\n value after about 10 minutes.\n\n- **Force apply.** To apply flag updates faster, use the `FORCE_APPLY`\n option with the `gcloud beta alloydb instances update` command.\n\n This policy is more appropriate for development environments, letting\n you quickly add or modify flags in exchange for longer instance\n downtime and a temporary decrease in database performance or\n throughput. Your cluster returns to peak performance several minutes\n after force applying a flag update.\n\n With the force apply policy enabled, updating a flag that requires a\n restart on your cluster's primary instance has these effects:\n - The primary instance experiences about one minute of downtime.\n\n - The flag on the primary instance finishes updating to its new value\n after one or two minutes.\n\n Updating a flag that requires a restart on a read pool instance has\n these effects:\n - The read pool instance experiences about one minute of downtime.\n\n - The flag on the read pool instance finishes updating to its new\n value after one or two minutes.\n\n\nBefore you begin\n----------------\n\n- The Google Cloud project you are using must have been [enabled to access AlloyDB](/alloydb/docs/project-enable-access).\n- You must have one of these IAM roles in the Google Cloud project you are using:\n - `roles/alloydb.admin` (the AlloyDB Admin predefined IAM role)\n - `roles/owner` (the Owner basic IAM role)\n - `roles/editor` (the Editor basic IAM role)\n\n If you don't have any of these roles, contact your Organization Administrator to request\n access.\n\n\u003cbr /\u003e\n\n### Console\n\n1. In the Google Cloud console, go to the **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/alloydb/clusters)\n2. Click a cluster in the **Resource Name** column.\n\n3. In the **Overview** page, go to **Instances in your cluster** ,\n select an instance, and then click **Edit**.\n\n4. Add, modify, or delete a database flag from your instance:\n\n **Add a flag**\n 1. To add a database flag to your instance, click **Add flag**.\n 2. Select a flag from the **New database flag** list.\n 3. Provide a value for the flag.\n 4. Click **Done**.\n\n **Modify a flag**\n 1. To modify a database flag present in your instance, expand the database flag and modify the value of the existing flag in the **Edit database flag** section.\n 2. Click **Done**.\n\n **Delete a flag**\n 1. To delete a database flag from your instance, select a flag and click the delete icon.\n 2. Click **Done**.\n5. Click **Update instance**.\n\n### gcloud\n\nUse the [`gcloud alloydb instances update`](/sdk/gcloud/reference/beta/alloydb/instances/update)\ncommand to change the database flags for an instance.\n**Caution:** Running the following command overwrites all database flags that are previously set. Any database flags that are not explicitly included in the `--database-flags` list are reset to its default value. To retain your instance's database flags while adding new flags, you must include both current and new flags in the `--database-flags` list. \n\n gcloud alloydb instances update \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --database-flags \u003cvar translate=\"no\"\u003eFLAGS_LIST\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e \\\n --cluster=\u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\nTo apply flag updates more rapidly, include the argument\n`--update-mode=FORCE_APPLY`. Because this can temporarily decrease database\nperformance, avoid using this option in a production environment. \n\n gcloud beta alloydb instances update \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --database-flags \u003cvar translate=\"no\"\u003eFLAGS_LIST\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e \\\n --cluster=\u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --update-mode=FORCE_APPLY\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e: The ID of the instance.\n- \u003cvar translate=\"no\"\u003eFLAGS_LIST\u003c/var\u003e: A comma-separated list of one or more database flag specifications. Each specification consists of the name of the flag, an equals sign (=), and the value to assign to the flags. For database flags that do not take values, provide the name of the flag followed by an equals sign (=).\n- \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e: The region where the instance is placed---for example, `us-central1`.\n- \u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e: The ID of the cluster where the instance is placed.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: The ID of the project where the cluster is placed. undergoing low or zero downtime maintenance cycle, after you modify database flags.\n\nTo see the list of an instance's current, manually-set flags, run the following\ncommand: \n\n gcloud alloydb instances describe \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e \\\n --cluster=\u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e"]]