Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Configurare i flussi di modifiche
Se vuoi monitorare le modifiche ai dati apportate a una tabella Bigtable, puoi attivare una modifica in tempo reale per la tabella e poi leggerla utilizzando un'applicazione come Dataflow. Prima di leggere questo documento, consulta la Panoramica degli stream di modifiche. In particolare, assicurati di conoscere i costi sostenuti quando lo streaming cambia.
Questa pagina descrive come attivare, disattivare e modificare il periodo di conservazione per un stream di modifiche.
Per istruzioni su come creare una nuova tabella con un flusso di modifiche abilitato, consulta
Creare una tabella.
Ruolo richiesto
Per ottenere le autorizzazioni necessarie per attivare, disattivare o modificare un stream di modifiche Bigtable, chiedi all'amministratore di concederti il seguente ruolo IAM.
Bigtable Administrator
(roles/bigtable.admin)
nell'istanza Bigtable contenente la tabella da cui vuoi eseguire lo streaming delle modifiche
Attivare un flusso di modifiche
Per attivare uno stream di modifiche in una tabella esistente:
Console
Apri l'elenco delle istanze Bigtable nella Google Cloud console.
Fai clic sull'istanza contenente la tabella per cui vuoi attivare un flusso di modifiche.
Fai clic su Tables (Tabelle) nel riquadro a sinistra.
La pagina Tabelle mostra un elenco delle tabelle nell'istanza.
Fai clic su Modifica per la tabella per cui vuoi attivare un stream di modifiche.
Fai clic su Attiva flusso di modifiche.
Nel campo Data di scadenza, inserisci un numero compreso tra 1 e 7 per configurare il numero di giorni per i quali devono essere conservati i record dello stream di dati.
TABLE_ID: l'ID della tabella di cui vuoi eseguire lo streaming delle modifiche
INSTANCE_ID: l'istanza che contiene la tabella
PROJECT_ID: il progetto che contiene l'istanza
CHANGE_STREAM_RETENTION_PERIOD: il periodo di tempo per il quale
Bigtable deve conservare i dati dello stream di modifiche per la tabella. Deve essere obbligatoriamente compreso tra un giorno e sette giorni, espresso come numero e lettera per l'unità. Le unità accettabili sono giorni (d), ore (h),
minuti (m) e secondi (s). Esempio: 5d
Disattivare un flusso di modifiche
Puoi disattivare il flusso di variazioni di una tabella in qualsiasi momento. I record dello stream di dati che sono stati creati prima di disattivare lo stream di modifiche continuano a consumare spazio di archiviazione fino al successivo compaction, ma non ti viene più addebitato alcun costo per lo spazio di archiviazione. Non puoi leggere uno stream di modifiche dopo averlo disattivato, incluse le modifiche registrate prima della disattivazione dello stream.
Console
Apri l'elenco delle istanze Bigtable nella Google Cloud console.
TABLE_ID: l'ID della tabella di cui vuoi eseguire lo streaming delle modifiche
INSTANCE_ID: l'istanza che contiene la tabella
PROJECT_ID: il progetto che contiene l'istanza
Modificare il tempo di conservazione di un flusso di modifiche
Puoi modificare il numero di giorni per cui Bigtable conserva i record del flusso di modifiche. Se riduci il numero di giorni, i record sottoposti a streaming
prima della modifica della configurazione continuano a occupare spazio di archiviazione fino alla successiva
compazione. Dopo la modifica della configurazione, puoi eseguire lo streaming delle modifiche solo dal periodo di tempo appena specificato.
Se aumenti il tempo di conservazione, la modifica non è retroattiva: gli stream di modifiche vengono conservati per il numero di giorni aumentato a partire dalla modifica della configurazione.
Console
Apri l'elenco delle istanze Bigtable nella Google Cloud console.
Fai clic sull'istanza di cui vuoi visualizzare le tabelle.
Fai clic su Tables (Tabelle) nel riquadro a sinistra.
La pagina Tabelle mostra un elenco delle tabelle nell'istanza.
Fai clic su Modifica per la tabella di cui vuoi modificare la configurazione dello stream di modifiche.
Nel campo Data e ora di scadenza, inserisci un numero compreso tra 1 e 7 per il numero di giorni per i quali devono essere conservati i record dello stream di dati.
TABLE_ID: l'ID della tabella di cui vuoi eseguire lo streaming delle modifiche
INSTANCE_ID: l'istanza che contiene la tabella
PROJECT_ID: il progetto che contiene l'istanza
CHANGE_STREAM_RETENTION_PERIOD: il periodo di tempo per il quale
Bigtable deve conservare i dati dello stream di modifiche per la tabella.
Deve essere compreso tra 1 e 7 giorni, espresso come numero e lettera per l'unità. Le unità accettate sono giorni (d), ore (h), minuti (m) e secondi (s). Esempio: 5d
[[["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."],[[["\u003cp\u003eChange streams on Bigtable tables can be enabled to track data modifications, which can be read by applications like Dataflow.\u003c/p\u003e\n"],["\u003cp\u003eChange stream retention periods can be configured for a duration between one and seven days, specifying how long Bigtable keeps the change stream data.\u003c/p\u003e\n"],["\u003cp\u003eYou can enable, disable, or modify the change stream retention period for existing tables via the Google Cloud console or using \u003ccode\u003egcloud\u003c/code\u003e commands.\u003c/p\u003e\n"],["\u003cp\u003eDisabling a change stream immediately halts new data capture, although previously recorded data will remain until the next compaction.\u003c/p\u003e\n"],["\u003cp\u003eTo make changes to a table's change stream, the user must have the Bigtable Administrator role, which is \u003ccode\u003eroles/bigtable.admin\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Configure change streams\n========================\n\nIf you want to track data changes made to a Bigtable table, you can\nenable a change stream for the table and then read it using an application\nsuch as Dataflow. Before you read this document, read the [Overview of\nchange streams](/bigtable/docs/change-streams-overview). In particular, make\nsure that you are aware of the costs incurred when streaming changes.\n\nThis page describes how to enable, disable, and change the retention period for\na change stream.\n\nFor instructions on creating a new table with a change stream enabled, see\n[Create a\ntable](/bigtable/docs/managing-tables#create-table).\n\nRequired role\n-------------\n\nTo get the permissions that you need to enable, disable, or modify a\nBigtable change stream, ask your administrator to grant you the\nfollowing IAM role.\n\n- Bigtable Administrator ([`roles/bigtable.admin`](/bigtable/docs/access-control#bigtable.admin)) on the Bigtable instance that contains the table you plan to stream changes from\n\nEnable a change stream\n----------------------\n\nTo enable a change stream on an existing table, complete the following steps: \n\n### Console\n\n1.\n Open the list of Bigtable instances in the Google Cloud console.\n\n\n [Open the instance list](https://console.cloud.google.com/bigtable/instances)\n2. Click the instance containing the table that you want to enable a change\n stream for.\n\n3. Click **Tables** in the left pane.\n\n The Tables page displays a list of tables in the instance.\n4. Click **Edit** for the table for which you want to enable a change\n stream.\n\n5. Click **Enable change stream**.\n\n6. In the **Expiration time** field, enter a number from 1 to 7 to\n configure the number of days that data stream records should be\n retained.\n\n7. Click **Save**.\n\n### gcloud\n\nTo enable a change stream on a table, use the [`gcloud bigtable instances\ntables update`](/sdk/gcloud/reference/bigtable/instances/tables/update)\ncommand. \n\n gcloud bigtable instances tables update \u003cvar translate=\"no\"\u003eTABLE_ID\u003c/var\u003e \\\n --instance=\u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --change-stream-retention-period=\u003cvar translate=\"no\"\u003eCHANGE_STREAM_RETENTION_PERIOD\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eTABLE_ID\u003c/code\u003e\u003c/var\u003e: the ID for the table whose changes you want to stream\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eINSTANCE_ID\u003c/code\u003e\u003c/var\u003e: the instance that contains the table\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003ePROJECT_ID\u003c/code\u003e\u003c/var\u003e: the project that contains the instance\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eCHANGE_STREAM_RETENTION_PERIOD\u003c/code\u003e\u003c/var\u003e: the length of time that Bigtable should keep change stream data for the table. Must be no less than one day and no more than seven days, expressed as a number and a letter for the unit. Acceptable units are days (d), hours (h), minutes (m), and seconds (s). Example: `5d`\n\nDisable a change stream\n-----------------------\n\nYou can disable a table's change stream at any time. Data stream records that\nwere created before you disable the change stream continue to consume storage\nuntil the next [compaction](/bigtable/docs/overview#compactions), but you are no\nlonger charged for that storage. You can't read a change stream after you\ndisable it, including changes recorded before you disable the stream. \n\n### Console\n\n1.\n Open the list of Bigtable instances in the Google Cloud console.\n\n\n [Open the instance list](https://console.cloud.google.com/bigtable/instances)\n2. Click the instance whose tables you want to view.\n\n3. Click **Tables** in the left pane.\n\n The Tables page displays a list of tables in the instance.\n4. Click **Edit** for the table whose change stream configuration you want\n to disable.\n\n5. Clear the checkmark from **Enable change stream**.\n\n6. Click **Save**.\n\n### gcloud\n\nTo disable a change stream on a table, use the [`gcloud bigtable instances\ntables update`](/sdk/gcloud/reference/bigtable/instances/tables/update)\ncommand. \n\n gcloud bigtable instances tables update \u003cvar translate=\"no\"\u003eTABLE_ID\u003c/var\u003e \\\n --instance=\u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --clear-change-stream-retention-period\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eTABLE_ID\u003c/code\u003e\u003c/var\u003e: the ID for the table whose changes you want to stream\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eINSTANCE_ID\u003c/code\u003e\u003c/var\u003e: the instance that contains the table\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003ePROJECT_ID\u003c/code\u003e\u003c/var\u003e: the project that contains the instance\n\nModify a change stream's retention time\n---------------------------------------\n\nYou can modify the number of days that Bigtable keeps your change\nstream records. If you reduce the number of days, records that were streamed\nbefore the configuration change continue to consume storage until the next\n[compaction](/bigtable/docs/overview#compactions). After the configuration\nchange, you can only stream changes from the newly specified time period.\n\nIf you increase the retention time, it's not retroactive --- change streams\nare kept for the increased number of days starting when you modify the\nconfiguration. \n\n### Console\n\n1.\n Open the list of Bigtable instances in the Google Cloud console.\n\n\n [Open the instance list](https://console.cloud.google.com/bigtable/instances)\n2. Click the instance whose tables you want to view.\n\n3. Click **Tables** in the left pane.\n\n The Tables page displays a list of tables in the instance.\n4. Click **Edit** for the table whose change stream configuration you want\n to modify.\n\n5. In the Expiration time field, enter a number from 1 to 7 for the number\n of days that data stream records should be retained.\n\n6. Click **Save**.\n\n### gcloud\n\nTo change the retention period for a table's change stream, use the [`gcloud\nbigtable instances tables\nupdate`](/sdk/gcloud/reference/bigtable/instances/tables/update)\ncommand. \n\n gcloud bigtable instances tables update \u003cvar translate=\"no\"\u003eTABLE_ID\u003c/var\u003e \\\n --instance=\u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --change-stream-retention-period=\u003cvar translate=\"no\"\u003eCHANGE_STREAM_RETENTION_PERIOD\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eTABLE_ID\u003c/code\u003e\u003c/var\u003e: the ID for the table whose changes you want to stream\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eINSTANCE_ID\u003c/code\u003e\u003c/var\u003e: the instance that contains the table\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003ePROJECT_ID\u003c/code\u003e\u003c/var\u003e: the project that contains the instance\n- \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eCHANGE_STREAM_RETENTION_PERIOD\u003c/code\u003e\u003c/var\u003e: the length of time that Bigtable should keep change stream data for the table. Must be from one to seven days, expressed as a number and a letter for the unit. Acceptable units are days (d), hours (h), minutes (m), and seconds (s). Example: `5d`\n\nWhat's next\n-----------\n\n- [Read a change stream with Dataflow.](/bigtable/docs/change-streams-use-dataflow)\n- [Review Bigtable pricing.](/bigtable/pricing)\n- [Complete a quickstart to learn how to enable a change stream and view changes.](/bigtable/docs/change-streams-quickstart)\n- [Use the Cloud Bigtable client library for Java to read change streams.](/bigtable/docs/change-streams-read-java)\n- [Work through a tutorial about processing a change stream.](/bigtable/docs/change-streams-tutorial)"]]