From bc0189e525464c08919dfc53b2b88e083e400f52 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Wed, 14 Jun 2023 14:23:07 +0800 Subject: [PATCH] ticdc: update ticdc time-zone docs (#13850) (#13874) --- ticdc/ticdc-server-config.md | 2 +- ticdc/ticdc-sink-to-mysql.md | 2 +- ticdc/troubleshoot-ticdc.md | 38 ++---------------------------------- 3 files changed, 4 insertions(+), 38 deletions(-) diff --git a/ticdc/ticdc-server-config.md b/ticdc/ticdc-server-config.md index 3135a7cee30aa..4f48585b3e2ad 100644 --- a/ticdc/ticdc-server-config.md +++ b/ticdc/ticdc-server-config.md @@ -23,7 +23,7 @@ The following are descriptions of options available in a `cdc server` command: - `cert`: Specifies the path of the certificate file in PEM format for TLS connection (optional). - `cert-allowed-cn`: Specifies the path of the common name in PEM format for TLS connection (optional). - `key`: Specifies the path of the private key file in PEM format for TLS connection (optional). -- `tz`: Time zone used by the TiCDC service. TiCDC uses this time zone when it internally converts time data types such as `TIMESTAMP` or when it replicates data to the downstream. The default is the local time zone in which the process runs. If you specify `time-zone` (in `sink-uri`) and `tz` at the time, the internal TiCDC processes use the time zone specified by `tz`, and the sink uses the time zone specified by `time-zone` for replicating data to the downstream. +- `tz`: Time zone used by the TiCDC service. TiCDC uses this time zone when it internally converts time data types such as `TIMESTAMP` or when it replicates data to the downstream. The default is the local time zone in which the process runs. If you specify `time-zone` (in `sink-uri`) and `tz` at the same time, the internal TiCDC processes use the time zone specified by `tz`, and the sink uses the time zone specified by `time-zone` for replicating data to the downstream. Make sure that the time zone specified by `tz` is the same as that specified by `time-zone` (in `sink-uri`). - `cluster-id`: (optional) The ID of the TiCDC cluster. The default value is `default`. `cluster-id` is the unique identifier of a TiCDC cluster. TiCDC nodes with the same `cluster-id` belong to the same cluster. The length of a `cluster-id` is 128 characters at most. `cluster-id` must follow the pattern of `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$` and cannot be one of the following: `owner`, `capture`, `task`, `changefeed`, `job`, and `meta`. ## `cdc server` configuration file parameters diff --git a/ticdc/ticdc-sink-to-mysql.md b/ticdc/ticdc-sink-to-mysql.md index 6a7f5f1098f6a..e02031c8779d4 100644 --- a/ticdc/ticdc-sink-to-mysql.md +++ b/ticdc/ticdc-sink-to-mysql.md @@ -62,7 +62,7 @@ The following are descriptions of sink URI parameters and parameter values that | `ssl-ca` | The path of the CA certificate file needed to connect to the downstream MySQL instance (optional). | | `ssl-cert` | The path of the certificate file needed to connect to the downstream MySQL instance (optional). | | `ssl-key` | The path of the certificate key file needed to connect to the downstream MySQL instance (optional). | -| `time-zone` | The time zone used when connecting to the downstream MySQL instance, which is effective since v4.0.8. This is an optional parameter. If this parameter is not specified, the time zone of TiCDC service processes is used. If this parameter is set to an empty value, no time zone is specified when TiCDC connects to the downstream MySQL instance and the default time zone of the downstream is used. | +| `time-zone` | The time zone used when connecting to the downstream MySQL instance, which is effective since v4.0.8. This is an optional parameter. If this parameter is not specified, the time zone of TiCDC service processes is used. If this parameter is set to an empty value, such as `time-zone=""`, no time zone is specified when TiCDC connects to the downstream MySQL instance and the default time zone of the downstream is used. | | `transaction-atomicity` | The atomicity level of a transaction. This is an optional parameter, with the default value of `none`. When the value is `table`, TiCDC ensures the atomicity of a single-table transaction. When the value is `none`, TiCDC splits the single-table transaction. | To encode the database password in the sink URI using Base64, use the following command: diff --git a/ticdc/troubleshoot-ticdc.md b/ticdc/troubleshoot-ticdc.md index 9202874a03846..f7621b220188c 100644 --- a/ticdc/troubleshoot-ticdc.md +++ b/ticdc/troubleshoot-ticdc.md @@ -86,43 +86,9 @@ Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it. ``` -If the downstream is a special MySQL environment (a public cloud RDS or some MySQL derivative versions) and importing the time zone using the above method fails, you need to specify the MySQL time zone of the downstream using the `time-zone` parameter in `sink-uri`. You can first query the time zone used by MySQL: +If the downstream is a special MySQL environment (a public cloud RDS or some MySQL derivative versions) and importing the time zone using the preceding method fails, you can use the default time zone of the downstream by setting `time-zone` to an empty value, such as `time-zone=""`. -1. Query the time zone used by MySQL: - - {{< copyable "sql" >}} - - ```sql - show variables like '%time_zone%'; - ``` - - ``` - +------------------+--------+ - | Variable_name | Value | - +------------------+--------+ - | system_time_zone | CST | - | time_zone | SYSTEM | - +------------------+--------+ - ``` - -2. Specify the time zone when you create the replication task and create the TiCDC service: - - {{< copyable "shell-regular" >}} - - ```shell - cdc cli changefeed create --sink-uri="mysql://root@127.0.0.1:3306/?time-zone=CST" --server=http://127.0.0.1:8300 - ``` - - > **Note:** - > - > CST might be an abbreviation for the following four different time zones: - > - > - Central Standard Time (USA) UT-6:00 - > - Central Standard Time (Australia) UT+9:30 - > - China Standard Time UT+8:00 - > - Cuba Standard Time UT-4:00 - > - > In China, CST usually stands for China Standard Time. +When using time zones in TiCDC, it is recommended to explicitly specify the time zone, such as `time-zone="Asia/Shanghai"`. Also, make sure that the `tz` specified in TiCDC server configurations and the `time-zone` specified in Sink URI are consistent with the time zone configuration of the downstream database. This prevents data inconsistency caused by inconsistent time zones. ## How do I handle the incompatibility issue of configuration files caused by TiCDC upgrade?