Export data to Yandex.Cloud
If you use Yandex.Cloud and Managed Service for ClickHouse, you can export data from AppMetrica to your cluster. You can use the data, for example, to create your own reports in Yandex DataLens.
Data can be exported “in real time” — export starts every 30 minutes.
This section below describes the steps for configuring export:
Step 1. Check the ClickHouse cluster settings
- Ensure that your ClickHouse cluster has two or more hosts. This is necessary for replication.
If the cluster is with a single host, add one or more hosts.
- Ensure that the Access from Metrica and AppMetrica option is enabled in the cluster settings.
- (Optional) To create reports in Yandex DataLens, ensure that the Access from the DataLens option is enabled in the cluster settings.
Step 2. Create a service account and an authorized key
Create a service account in the Yandex.Cloud console. When creating select a role editor.
For more information, see the Creating a service account article of the Yandex.Cloud documentation.
Create an authorized key. After creating, save the secret part of the key, for example, in a text file. You need it to link your service account to AppMetrica.
For more information, see the Creating an authorized key article of the Yandex.Cloud documentation.
Step 3. Start exporting process
- In the AppMetrica interface, click.
- On page Export to Yandex.Cloud press the button Launch a new export.
- Link your Yandex.Cloud service account To do this, in the Service account field click the Create button. In the window that opens, specify the following:
- Name;
- Private key — the secret key that you saved when creating an authorized key;
Click Create.
- Select the date period to export. If the Realtime option is enabled, export process runs every 30 minutes.
In the field Event fields select the parameters to export.
For more information about event parameters, see the Logs API available endpoints .
- In the Cluster field select the cluster to export. It creates a table with exported parameters.
- Click the Launch export button.
- Start exporting data to the cluster. This creates a user named
appmetrica_export_user
with certain permissions. - In the Yandex.Cloud interface, go to the folder page and select Managed Service for ClickHouse.
- Click on the name of the appropriate cluster and select the Users tab.
- Grant the
appmetrica_export_user
the rights to write data to the database where you want to create the MaterializedView. Otherwise, the export is suspended.