-
Notifications
You must be signed in to change notification settings - Fork 338
MySQL ClickPipe: Document generic MySQL and MariaDB #3867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
259d328
Add guides for generic MySQL and MariaDB
ilidemi 2190ce4
Document generic MySQL and MariaDB
ilidemi 73bd5af
Add explicit section ids
ilidemi f52cdb5
Ignore a word
ilidemi b70c455
fix links
serprex 1e720d5
Rerun CI
ilidemi 2af7a95
Cleanup
ilidemi 55b48f6
Merge branch 'main' of https://github.com/ClickHouse/clickhouse-docs …
Blargian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
docs/integrations/data-ingestion/clickpipes/mysql/source/generic.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
--- | ||
sidebar_label: 'Generic MySQL' | ||
description: 'Set up any MySQL instance as a source for ClickPipes' | ||
slug: /integrations/clickpipes/mysql/source/generic | ||
title: 'Generic MySQL source setup guide' | ||
--- | ||
|
||
# Generic MySQL source setup guide | ||
|
||
:::info | ||
|
||
If you use one of the supported providers (in the sidebar), please refer to the specific guide for that provider. | ||
|
||
::: | ||
|
||
## Enable binary log retention {#enable-binlog-retention} | ||
|
||
Binary logs contain information about data modifications made to a MySQL server instance and are required for replication. | ||
|
||
### MySQL 8.x and newer {#binlog-v8-x} | ||
|
||
To enable binary logging on your MySQL instance, ensure that the following settings are configured: | ||
|
||
```sql | ||
log_bin = ON -- default value | ||
binlog_format = ROW -- default value | ||
binlog_row_image = FULL -- default value | ||
binlog_row_metadata = FULL | ||
binlog_expire_logs_seconds = 86400 -- 1 day or higher; default is 30 days | ||
``` | ||
|
||
To check these settings, run the following SQL commands: | ||
```sql | ||
SHOW VARIABLES LIKE 'log_bin'; | ||
SHOW VARIABLES LIKE 'binlog_format'; | ||
SHOW VARIABLES LIKE 'binlog_row_image'; | ||
SHOW VARIABLES LIKE 'binlog_row_metadata'; | ||
SHOW VARIABLES LIKE 'binlog_expire_logs_seconds'; | ||
``` | ||
|
||
If the values don't match, you can run the following SQL commands to set them: | ||
```sql | ||
SET PERSIST log_bin = ON; | ||
SET PERSIST binlog_format = ROW; | ||
SET PERSIST binlog_row_image = FULL; | ||
SET PERSIST binlog_row_metadata = FULL; | ||
SET PERSIST binlog_expire_logs_seconds = 86400; | ||
``` | ||
|
||
If you have changed the `log_bin` setting, you NEED to RESTART the MySQL instance for the changes to take effect. | ||
|
||
After changing the settings, continue on with [configuring a database user](#configure-database-user). | ||
|
||
### MySQL 5.7 {#binlog-v5-x} | ||
|
||
To enable binary logging on your MySQL 5.7 instance, ensure that the following settings are configured: | ||
|
||
```sql | ||
server_id = 1 -- or greater; anything but 0 | ||
log_bin = ON | ||
binlog_format = ROW -- default value | ||
binlog_row_image = FULL -- default value | ||
expire_logs_days = 1 -- or higher; 0 would mean logs are preserved forever | ||
``` | ||
|
||
To check these settings, run the following SQL commands: | ||
```sql | ||
SHOW VARIABLES LIKE 'server_id'; | ||
SHOW VARIABLES LIKE 'log_bin'; | ||
SHOW VARIABLES LIKE 'binlog_format'; | ||
SHOW VARIABLES LIKE 'binlog_row_image'; | ||
SHOW VARIABLES LIKE 'expire_logs_days'; | ||
``` | ||
|
||
If the values don't match, you can set them in the config file (typically at `/etc/my.cnf` or `/etc/mysql/my.cnf`): | ||
```ini | ||
[mysqld] | ||
server_id = 1 | ||
log_bin = ON | ||
binlog_format = ROW | ||
binlog_row_image = FULL | ||
expire_logs_days = 1 | ||
``` | ||
|
||
You NEED to RESTART the MySQL instance for the changes to take effect. | ||
|
||
:::note | ||
|
||
Column exclusion is not supported for MySQL 5.7 because the `binlog_row_metadata` setting wasn't yet introduced. | ||
|
||
::: | ||
|
||
## Configure a database user {#configure-database-user} | ||
|
||
Connect to your MySQL instance as the root user and execute the following commands: | ||
|
||
1. Create a dedicated user for ClickPipes: | ||
|
||
```sql | ||
CREATE USER 'clickpipes_user'@'%' IDENTIFIED BY 'some_secure_password'; | ||
``` | ||
|
||
2. Grant schema permissions. The following example shows permissions for the `clickpipes` database. Repeat these commands for each database and host you want to replicate: | ||
|
||
```sql | ||
GRANT SELECT ON `clickpipes`.* TO 'clickpipes_user'@'%'; | ||
``` | ||
|
||
3. Grant replication permissions to the user: | ||
|
||
```sql | ||
GRANT REPLICATION CLIENT ON *.* TO 'clickpipes_user'@'%'; | ||
GRANT REPLICATION SLAVE ON *.* TO 'clickpipes_user'@'%'; | ||
``` | ||
|
||
:::note | ||
|
||
Make sure to replace `clickpipes_user` and `some_secure_password` with your desired username and password. | ||
|
||
::: | ||
|
||
## SSL/TLS configuration (recommended) {#ssl-tls-configuration} | ||
|
||
SSL certificates ensure secure connections to your MySQL database. Configuration depends on your certificate type: | ||
|
||
**Trusted Certificate Authority (DigiCert, Let's Encrypt, etc.)** - no additional configuration needed. | ||
|
||
**Internal Certificate Authority** - Obtain the root CA certificate file from your IT team. In the ClickPipes UI, upload it when creating a new MySQL ClickPipe. | ||
|
||
**Self-hosted MySQL** - Copy the CA certificate from your MySQL server (typically at `/var/lib/mysql/ca.pem`) and upload it in the UI when creating a new MySQL ClickPipe. Use the IP address of the server as the host. | ||
|
||
**Self-hosted MySQL without server access** - Contact your IT team for the certificate. As a last resort, use the "Skip Certificate Verification" toggle in ClickPipes UI (not recommended for security reasons). | ||
|
||
For more information on SSL/TLS options, check out our [FAQ](https://clickhouse.com/docs/integrations/clickpipes/mysql/faq#tls-certificate-validation-error). | ||
|
||
## What's next? {#whats-next} | ||
|
||
You can now [create your ClickPipe](../index.md) and start ingesting data from your MySQL instance into ClickHouse Cloud. | ||
Make sure to note down the connection details you used while setting up your MySQL instance as you will need them during the ClickPipe creation process. |
106 changes: 106 additions & 0 deletions
106
docs/integrations/data-ingestion/clickpipes/mysql/source/generic_maria.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
--- | ||
sidebar_label: 'Generic MariaDB' | ||
description: 'Set up any MariaDB instance as a source for ClickPipes' | ||
slug: /integrations/clickpipes/mysql/source/generic_maria | ||
title: 'Generic MariaDB source setup guide' | ||
--- | ||
|
||
# Generic MariaDB source setup guide | ||
|
||
:::info | ||
|
||
If you use one of the supported providers (in the sidebar), please refer to the specific guide for that provider. | ||
|
||
::: | ||
|
||
## Enable binary log retention {#enable-binlog-retention} | ||
|
||
Binary logs contain information about data modifications made to a MariaDB server instance and are required for replication. | ||
|
||
To enable binary logging on your MariaDB instance, ensure that the following settings are configured: | ||
|
||
```sql | ||
server_id = 1 -- or greater; anything but 0 | ||
log_bin = ON | ||
binlog_format = ROW | ||
binlog_row_image = FULL | ||
binlog_row_metadata = FULL -- introduced in 10.5.0 | ||
expire_logs_days = 1 -- or higher; 0 would mean logs are preserved forever | ||
``` | ||
|
||
To check these settings, run the following SQL commands: | ||
```sql | ||
SHOW VARIABLES LIKE 'server_id'; | ||
SHOW VARIABLES LIKE 'log_bin'; | ||
SHOW VARIABLES LIKE 'binlog_format'; | ||
SHOW VARIABLES LIKE 'binlog_row_image'; | ||
SHOW VARIABLES LIKE 'binlog_row_metadata'; | ||
SHOW VARIABLES LIKE 'expire_logs_days'; | ||
``` | ||
|
||
If the values don't match, you can set them in the config file (typically at `/etc/my.cnf` or `/etc/my.cnf.d/mariadb-server.cnf`): | ||
```ini | ||
[mysqld] | ||
server_id = 1 | ||
log_bin = ON | ||
binlog_format = ROW | ||
binlog_row_image = FULL | ||
binlog_row_metadata = FULL ; only in 10.5.0 and newer | ||
expire_logs_days = 1 | ||
``` | ||
|
||
You NEED to RESTART the MariaDB instance for the changes to take effect. | ||
|
||
:::note | ||
|
||
Column exclusion is not supported for MariaDB \<= 10.4 because the `binlog_row_metadata` setting wasn't yet introduced. | ||
|
||
::: | ||
|
||
## Configure a database user {#configure-database-user} | ||
|
||
Connect to your MariaDB instance as the root user and execute the following commands: | ||
|
||
1. Create a dedicated user for ClickPipes: | ||
|
||
```sql | ||
CREATE USER 'clickpipes_user'@'%' IDENTIFIED BY 'some_secure_password'; | ||
``` | ||
|
||
2. Grant schema permissions. The following example shows permissions for the `clickpipes` database. Repeat these commands for each database and host you want to replicate: | ||
|
||
```sql | ||
GRANT SELECT ON `clickpipes`.* TO 'clickpipes_user'@'%'; | ||
``` | ||
|
||
3. Grant replication permissions to the user: | ||
|
||
```sql | ||
GRANT REPLICATION CLIENT ON *.* TO 'clickpipes_user'@'%'; | ||
GRANT REPLICATION SLAVE ON *.* TO 'clickpipes_user'@'%'; | ||
``` | ||
|
||
:::note | ||
|
||
Make sure to replace `clickpipes_user` and `some_secure_password` with your desired username and password. | ||
|
||
::: | ||
|
||
## SSL/TLS configuration (recommended) {#ssl-tls-configuration} | ||
|
||
SSL certificates ensure secure connections to your MariaDB database. Configuration depends on your certificate type: | ||
|
||
**Trusted Certificate Authority (DigiCert, Let's Encrypt, etc.)** - no additional configuration needed. | ||
|
||
**Internal Certificate Authority** - Obtain the root CA certificate file from your IT team. In the ClickPipes UI, upload it when creating a new MariaDB ClickPipe. | ||
|
||
**Self-hosted MariaDB** - Copy the CA certificate from your MariaDB server (look up the path via the `ssl_ca` setting in your `my.cnf`). In the ClickPipes UI, upload it when creating a new MariaDB ClickPipe. Use the IP address of the server as the host. | ||
|
||
**Self-hosted MariaDB starting with 11.4** - If your server has `ssl_ca` set up, follow the option above. Otherwise, consult with your IT team to provision a proper certificate. As a last resort, use the "Skip Certificate Verification" toggle in ClickPipes UI (not recommended for security reasons). | ||
|
||
For more information on SSL/TLS options, check out our [FAQ](https://clickhouse.com/docs/integrations/clickpipes/mysql/faq#tls-certificate-validation-error). | ||
|
||
## What's next? {#whats-next} | ||
|
||
You can now [create your ClickPipe](../index.md) and start ingesting data from your MariaDB instance into ClickHouse Cloud. | ||
Make sure to note down the connection details you used while setting up your MariaDB instance as you will need them during the ClickPipe creation process. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.