Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Lo scopo di una configurazione ad alta disponibilità è ridurre i tempi di inattività quando un'istanza del cluster di database non è disponibile. Ciò può accadere quando un'istanza esaurisce la memoria. Con l'alta disponibilità, i tuoi dati continuano a essere
disponibili per le applicazioni client.
All'interno di un sito, la configurazione è costituita da un'istanza principale e da una replica
in standby. Tutte le scritture effettuate nell'istanza principale vengono replicate nella replica
di standby prima che venga confermato il commit di una transazione. In caso di errore dell'istanza, puoi richiedere che la replica in standby diventi la nuova istanza principale.
Il traffico dell'applicazione viene quindi reindirizzato alla nuova istanza primaria. Questo processo è chiamato
failover.
GDC trasforma la replica in standby nel nuovo cluster di database attivo.
GDC elimina il cluster di database attivo precedente.
GDC crea una nuova replica di standby.
Per i cluster di database AlloyDB Omni e PostgreSQL, puoi attivare o disattivare l'alta disponibilità nella stessa zona.
Aggiornare un cluster esistente
Puoi aggiornare le impostazioni di alta disponibilità per un cluster di database esistente:
Console
Nel menu di navigazione, seleziona Database Service.
Nell'elenco dei cluster di database, fai clic sul cluster di database da aggiornare.
Seleziona ModificaModifica nella sezione Alta disponibilità.
Seleziona Abilita standby nella stessa zona per attivare o disattivare
la disponibilità di un'istanza di standby nella stessa zona del cluster di database
principale.
Fai clic su Salva.
Verifica che il cluster di database rifletta l'aggiornamento dell'alta disponibilità visualizzando il suo stato nella colonna Alta disponibilità dell'elenco dei cluster di database.
gdcloud
Aggiorna la configurazione per l'alta disponibilità del cluster di database:
HA_TYPE: il livello di alta disponibilità per il cluster di database. Puoi impostare zonal o zonal_ha. Il valore di zonal
è impostato per impostazione predefinita.
Verifica che il cluster di database rifletta l'aggiornamento dell'alta affidabilità:
gdclouddatabaseclusterslist
API
Aggiorna la configurazione per l'alta disponibilità del cluster di database:
DBENGINE_NAME: il nome del motore del database. Si tratta di uno dei seguenti valori: alloydbomni, postgresql o oracle.
DBCLUSTER_NAME: il nome del cluster di database.
USER_PROJECT: il nome del progetto utente in cui è stato creato il cluster di database.
HA_ENABLED: il livello di alta disponibilità per il cluster di database. Puoi impostare true o false. Il valore di false è impostato per impostazione predefinita.
Verifica che il cluster di database rifletta l'aggiornamento dell'alta affidabilità:
Se hai configurato l'alta disponibilità per il cluster di database, puoi
attivare un failover. Per attivare un failover, completa i seguenti passaggi:
Console
Nel menu di navigazione, seleziona Database Service.
Nell'elenco dei cluster di database, fai clic sul cluster di database per attivare un
failover. Per essere idoneo
per un failover, il cluster di database deve avere
l'alta disponibilità abilitata.
Fai clic su Failover.
Digita l'ID del cluster per la frase di conferma e fai clic su Failover
per attivare la procedura di failover.
gdcloud
Attiva il failover per il cluster di database:
gdclouddatabaseclustersfailoverCLUSTER_NAME
Sostituisci CLUSTER_NAME con il nome del cluster di database.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Configure high availability\n\nThe purpose of a high availability configuration is to reduce downtime when a\ndatabase cluster instance becomes unavailable. This might happen when an\ninstance runs out of memory. With high availability, your data continues to be\navailable to client applications.\n| **Note:** High availability is only available for the AlloyDB Omni and PostgreSQL database engines at this time.\n\nWithin a site, the configuration is made up of a primary instance and a standby\nreplica. All writes made to the primary instance are replicated to the standby\nreplica before a transaction is reported as committed. In the event of an\ninstance failure, you can request that the standby replica become the new primary instance.\nApplication traffic is then rerouted to the new primary instance. This process is called a\n*failover*.\n\nYou can [manually trigger a failover](#trigger-failover) at any time. The\nfailover involves the following process, in order:\n\n1. GDC takes the primary instance offline.\n\n2. GDC turns the standby replica into the new active\n database cluster.\n\n3. GDC deletes the previous active database cluster.\n\n4. GDC creates a new standby replica.\n\nFor AlloyDB Omni and PostgreSQL database clusters, you can enable or disable same zone high\navailability.\n\nUpdate an existing cluster\n--------------------------\n\nYou can update your high availability settings for an existing database cluster: \n\n### Console\n\n1. In the navigation menu, select **Database Service**.\n\n2. From the database cluster list, click the database cluster to update.\n\n3. Select edit **Edit** in\n the **High availability** section.\n\n4. Select **Enable same zone standby** to either toggle on or off the\n availability of a standby instance in the same zone as your primary\n database cluster.\n\n5. Click **Save**.\n\n6. Verify your database cluster reflects your high availability update by\n viewing its status in the **High availability** column of the database\n cluster list.\n\n### gdcloud\n\n1. Update your database cluster's high availability configuration:\n\n gdcloud database clusters update \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e \\\n --availability-type \u003cvar translate=\"no\"\u003eHA_TYPE\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the database cluster.\n - \u003cvar translate=\"no\"\u003eHA_TYPE\u003c/var\u003e: the high availability level for the database cluster. You can set `zonal` or `zonal_ha`. The `zonal` value is set by default.\n2. Verify your database cluster reflects your high availability update:\n\n gdcloud database clusters list\n\n### API\n\n1. Update your database cluster's high availability configuration:\n\n kubectl patch dbcluster.\u003cvar translate=\"no\"\u003eDBENGINE_NAME\u003c/var\u003e.dbadmin.gdc.goog \u003cvar translate=\"no\"\u003eDBCLUSTER_NAME\u003c/var\u003e \\\n -n \u003cvar translate=\"no\"\u003eUSER_PROJECT\u003c/var\u003e \\\n -p '{\"spec\": {\"availability\": {\"enableHighAvailability\": \u003cvar translate=\"no\"\u003eHA_ENABLED\u003c/var\u003e}}}' \\\n --type=merge\n\n Replace the following variables:\n - \u003cvar translate=\"no\"\u003eDBENGINE_NAME\u003c/var\u003e: the name of the database engine. This is one of `alloydbomni`, `postgresql`, or `oracle`.\n - \u003cvar translate=\"no\"\u003eDBCLUSTER_NAME\u003c/var\u003e: the name of the database cluster.\n - \u003cvar translate=\"no\"\u003eUSER_PROJECT\u003c/var\u003e: the name of the user project where the database cluster was created.\n - \u003cvar translate=\"no\"\u003eHA_ENABLED\u003c/var\u003e: the high availability level for the database cluster. You can set `true` or `false`. The `false` value is set by default.\n2. Verify your database cluster reflects your high availability update:\n\n kubectl get dbcluster.\u003cvar translate=\"no\"\u003eDBENGINE_NAME\u003c/var\u003e.dbadmin.gdc.goog \u003cvar translate=\"no\"\u003eDBCLUSTER_NAME\u003c/var\u003e \\\n -n \u003cvar translate=\"no\"\u003eUSER_PROJECT\u003c/var\u003e \\\n -o yaml\n\nTrigger a failover\n------------------\n\nIf you have configured high availability for your database cluster, you can\ntrigger a failover. To trigger a failover, complete the following steps: \n\n### Console\n\n1. In the navigation menu, select **Database Service**.\n\n2. From the database cluster list, click the database cluster to trigger a\n failover for. Your database cluster must have\n [high availability enabled](#update-existing-cluster-ha) to be eligible\n for a failover.\n\n3. Click **Failover**.\n\n4. Type the cluster's ID for the confirmation phrase and click **Failover**\n to trigger the failover process.\n\n### gdcloud\n\n- Trigger the failover for the database cluster:\n\n gdcloud database clusters failover \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e with the name of the database\n cluster.\n\n### API\n\n apiVersion: fleet.dbadmin.gdc.goog/v1\n kind: Failover\n metadata:\n name: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eFAILOVER_NAME\u003c/span\u003e\u003c/var\u003e\n spec:\n dbclusterRef: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eDBCLUSTER_NAME\u003c/span\u003e\u003c/var\u003e\n\nReplace the following variables:\n\n- \u003cvar translate=\"no\"\u003eDBCLUSTER_NAME\u003c/var\u003e, the name of the database cluster.\n- \u003cvar translate=\"no\"\u003eFAILOVER_NAME\u003c/var\u003e, the unique name of the failover, for example `failover-sample`."]]