Prácticas recomendadas generales para usar Datastream
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En esta página, encontrarás prácticas recomendadas para usar Datastream. Estas incluyen prácticas recomendadas generales para usar Datastream.
Cómo cambiar la base de datos de origen de un flujo
En algunos casos, es posible que debas cambiar la base de datos de origen de una transmisión. Por ejemplo, es posible que debas modificar la transmisión para replicar desde una réplica en lugar de desde la instancia de la base de datos principal.
Crea una transmisión con el perfil de conexión de la réplica que creaste y el perfil de conexión existente para el destino.
Inicia la transmisión con el reabastecimiento histórico inhabilitado. Cuando se inicie la transmisión, solo se extraerán los datos de los registros binarios.
Opcional. Después de que se ejecute la transmisión, modifícala para habilitar el reabastecimiento automático.
El panel de Datastream contiene mucha información. Esta información puede ser útil para la depuración. Puedes encontrar información adicional en los registros, que están disponibles en Cloud Logging.
Alertas de Datastream
No hay ninguna alerta predeterminada configurada para Datastream. Por ejemplo, puedes crear una política de alertas para la métrica Actualización de datos haciendo clic en el vínculo Crear política de alertas en la pestaña Descripción general. Para las métricas restantes, sigue estos pasos:
En la consola de Google Cloud , ve a la página notificationsAlertas:
Haz clic en el menú desplegable Seleccionar una métrica.
En el campo de filtro, ingresa Datastream.
Opcional: Es posible que debas inhabilitar el filtro Activo para ver todas las métricas disponibles.
Busca la métrica que deseas supervisar en Flujo de Datastream.
Haz clic en Aplicar.
Opcional: Ingresa los detalles obligatorios en las secciones Agregar filtros y Transformar datos. Haz clic en Siguiente.
Ingresa la información requerida en la sección Configurar activador de alerta. Haz clic en Siguiente.
Configura tus notificaciones en la sección Configurar notificaciones y finalizar la alerta.
Revisa la alerta y haz clic en Crear política cuando esté lista.
Para obtener información detallada sobre cómo completar cada uno de estos pasos, consulta Crea una política de alertas.
Te recomendamos que crees alertas para las siguientes métricas de Datastream:
Actualidad de los datos
Recuento de eventos no admitidos de la transmisión
Latencias totales de la transmisión
Una alerta sobre cualquiera de estas métricas puede indicar un problema con la transmisión o la base de datos de origen.
¿Cuántas tablas puede controlar una sola transmisión?
Recomendamos que una sola transmisión incluya hasta 10,000 tablas. No hay límite para el tamaño de las tablas. Si necesitas crear una transmisión con más tablas, es posible que la transmisión entre en un estado de error. Para evitar esto, considera dividir la fuente en varias transmisiones.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eThis page covers best practices for using Datastream, including modifying a stream's source database and creating custom alerts.\u003c/p\u003e\n"],["\u003cp\u003eTo change a stream's source database, create a connection profile for the replica instance, start a new stream with historical backfill disabled, and then pause the original stream.\u003c/p\u003e\n"],["\u003cp\u003eDatastream offers a dashboard for debugging, and custom alerting policies can be set up for key metrics like data freshness, stream unsupported event count, and stream total latencies.\u003c/p\u003e\n"],["\u003cp\u003eFor optimal performance, it is recommended that a single Datastream stream includes no more than 10,000 tables, with consideration for the impact on the source database if multiple streams are used.\u003c/p\u003e\n"]]],[],null,["# General best practices when using Datastream\n\nIn this page, you'll find best practices for using Datastream. These include general best practices when using Datastream.\n\nChange a stream's source database\n---------------------------------\n\nIn some cases, you may have to change the source database of a stream. For example, you may have to modify the stream to replicate from a replica instead of from the primary database instance.\n\n1. [Create a connection profile](/datastream/docs/create-connection-profiles) for the replica instance.\n2. [Create a stream](/datastream/docs/create-a-stream), using the connection profile for the replica that you created and the existing connection profile for the destination.\n3. [Start the stream](/datastream/docs/run-a-stream#startastream) with historical backfill disabled. When the stream is started, it will bring only the data from the binary logs.\n4. Optional. After the stream is running, [modify it](/datastream/docs/modify-a-stream) to enable automatic backfill.\n5. [Pause the stream](/datastream/docs/run-a-stream#pauseastream) that's reading from the primary instance.\n6. Optional. [Delete the stream](/datastream/docs/delete-a-stream) that was streaming data from the primary instance.\n7. Optional. [Delete the connection profile](/datastream/docs/delete-a-connection-profile) for the primary instance.\n\nAlert and monitor in Datastream\n-------------------------------\n\nThe Datastream dashboard contains a great deal of information. This information can be helpful for debugging purposes. Additional information can be found in the logs, which are available in Cloud Logging.\n| **Tip:** Use [Google Cloud Monitoring](/monitoring) to create a custom dashboard to suit your business needs.\n\n### Datastream alerts\n\nThere's no default alert set up for Datastream. For example, you can create an alerting policy for the **Data freshness** metric by clicking the *Create alerting policy* link in the **Overview** tab. For the remaining metrics, follow these steps:\n\n1. In the Google Cloud console, go to the *notifications* **Alerting** page:\n\n [Go to **Alerting**](https://console.cloud.google.com/monitoring/alerting)\n2. Click **Create policy**.\n\n3. Click the **Select a metric** drop-down.\n\n4. In the filter field, enter `Datastream`.\n\n5. Optional: You might need to disable the **Active** filter to view all available metrics.\n\n6. Search for the metric that you want to monitor under **Datastream Stream**.\n\n7. Click **Apply**.\n\n8. Optional: Enter the required details in the **Add filters** and **Transform data** sections. Click **Next**.\n\n9. Enter the required information in the **Configure alert trigger** section. Click **Next**.\n\n10. Configure your notifications in the **Configure notifications and finalize alert** section.\n\n11. Review your alert and click **Create policy** when ready.\n\n For detailed information about how to complete each of these steps, see\n [Create alerting policy](/monitoring/alerts/using-alerting-ui#create-policy).\n\nWe recommend creating alerts for the following Datastream[metrics](/datastream/docs/monitor-a-stream#monitorstreams):\n\n- Data freshness\n- Stream unsupported event count\n- Stream total latencies\n\nAn alert on any of these metrics can indicate a problem with either the stream or the source database.\n\nHow many tables can a single stream handle?\n-------------------------------------------\n\nWe recommend that a single stream includes up to 10,000 tables. There's no limit to the size of the tables. If you need to create a stream with more tables, then the stream might enter an error state. To avoid this, consider splitting the source into multiple streams.\n| Keep in mind the impact on the source database. Each stream will have its own limit on the number of connections and simultaneous tasks, so combining multiple streams could overwhelm the database."]]