In this page, you'll find best practices for using Datastream. These include general best practices when using Datastream.
Change a stream's source database
In 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.
- Create a connection profile for the replica instance.
- Create a stream, using the connection profile for the replica that you created and the existing connection profile for the destination.
- Start the stream with historical backfill disabled. When the stream is started, it will bring only the data from the binary logs.
- Optional. After the stream is running, modify it to enable automatic backfill.
Pause the stream that's reading from the primary instance.
Optional. Delete the stream that was streaming data from the primary instance.
Optional. Delete the connection profile for the primary instance.
Alert and monitor in Datastream
The 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.
Datastream alerts
There'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:
In the Google Cloud console, go to the notifications Alerting page:
Click Create policy.
Click the Select a metric drop-down.
In the filter field, enter
Datastream
.Optional: You might need to disable the Active filter to view all available metrics.
Search for the metric that you want to monitor under Datastream Stream.
Click Apply.
Optional: Enter the required details in the Add filters and Transform data sections. Click Next.
Enter the required information in the Configure alert trigger section. Click Next.
Configure your notifications in the Configure notifications and finalize alert section.
Review your alert and click Create policy when ready.
For detailed information about how to complete each of these steps, see Create alerting policy.
We recommend creating alerts for the following Datastream metrics:
- Data freshness
- Stream unsupported event count
- Stream total latencies
An alert on any of these metrics can indicate a problem with either the stream or the source database.
How many tables can a single stream handle?
We 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.