Bonnes pratiques générales à suivre lors de l'utilisation de Datastream
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page présente les bonnes pratiques d'utilisation de Datastream. Elles incluent les bonnes pratiques générales d'utilisation de Datastream.
Modifier la base de données source d'un flux
Dans certains cas, vous devrez peut-être modifier la base de données source d'un flux. Par exemple, vous devrez peut-être modifier le flux pour répliquer les données à partir d'une instance répliquée plutôt que de l'instance de base de données principale.
Le tableau de bord Datastream contient de nombreuses informations. Ces informations peuvent être utiles à des fins de débogage. Vous trouverez des informations supplémentaires dans les journaux, disponibles dans Cloud Logging.
Alertes Datastream
Aucune alerte par défaut n'est configurée pour Datastream. Par exemple, vous pouvez créer une règle d'alerte pour la métrique Fraîcheur des données en cliquant sur le lien Créer une règle d'alerte dans l'onglet Vue d'ensemble. Pour les autres métriques, procédez comme suit :
Dans la console Google Cloud , accédez à la page notificationsAlertes :
Nous vous recommandons de créer des alertes pour les métriques Datastream suivantes :
Fraîcheur des données
Nombre d'événements de flux non acceptés
Latences totales des flux
Une alerte sur l'une de ces métriques peut indiquer un problème avec le flux ou la base de données source.
Combien de tables un même flux peut-il gérer ?
Nous vous recommandons d'inclure jusqu'à 10 000 tables dans un même flux. La taille des tables n'est pas limitée. Si vous devez créer un flux avec plus de tables, il est possible qu'il passe à l'état d'erreur. Pour éviter cela, envisagez de diviser la source en plusieurs flux.
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)."],[[["\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."]]