Skip to content

Commit

Permalink
ticdc: update ticdc time-zone docs (#13850) (#13874)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jun 14, 2023
1 parent c2648c4 commit bc0189e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
2 changes: 1 addition & 1 deletion ticdc/ticdc-server-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ticdc/ticdc-sink-to-mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
38 changes: 2 additions & 36 deletions ticdc/troubleshoot-ticdc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://[email protected]: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?

Expand Down

0 comments on commit bc0189e

Please sign in to comment.