Deploy TiCDC

This document describes how to deploy a TiCDC cluster and the hardware and software recommendations for deploying and running it. You can either deploy TiCDC along with a new TiDB cluster or add the TiCDC component to an existing TiDB cluster. Generally, it is recommended that you deploy TiCDC using TiUP. In addition, you can also deploy it using binary as needed.

Software and hardware recommendations

In production environments, the recommendations of software and hardware for TiCDC are as follows:

Linux OSVersion
Red Hat Enterprise Linux7.3 or later versions
CentOS7.3 or later versions
CPUMemoryDisk typeNetworkNumber of TiCDC cluster instances (minimum requirements for production environment)
16 core+64 GB+SSD10 Gigabit network card (2 preferred)2

For more information, see Software and Hardware Recommendations.

Deploy a new TiDB cluster that includes TiCDC using TiUP

When you deploy a new TiDB cluster using TiUP, you can also deploy TiCDC at the same time. You only need to add the cdc_servers section in the initialization configuration file that TiUP uses to start the TiDB cluster. For detailed operations, see Edit the initialization configuration file. For detailed configurable fields, see Configure cdc_servers using TiUP.

Add TiCDC to an existing TiDB cluster using TiUP

You can also use TiUP to add the TiCDC component to an existing TiDB cluster. Take the following procedures:

  1. Make sure that the current TiDB version supports TiCDC; otherwise, you need to upgrade the TiDB cluster to v4.0.0-rc.1 or later versions. Since v4.0.6, TiCDC has become a feature for general availability (GA). It is recommended that you use v4.0.6 or later versions.

  2. To deploy TiCDC, refer to Scale out a TiCDC cluster.

Suppose that the PD cluster has a PD node (the client URL is 10.0.10.25:2379) that can provide services. If you want to deploy three TiCDC nodes, start the TiCDC cluster by executing the following commands. You only need to specify the same PD address, and the newly started nodes automatically join the TiCDC cluster.

cdc server --pd=http://10.0.10.25:2379 --log-file=ticdc_1.log --addr=0.0.0.0:8301 --advertise-addr=127.0.0.1:8301 cdc server --pd=http://10.0.10.25:2379 --log-file=ticdc_2.log --addr=0.0.0.0:8302 --advertise-addr=127.0.0.1:8302 cdc server --pd=http://10.0.10.25:2379 --log-file=ticdc_3.log --addr=0.0.0.0:8303 --advertise-addr=127.0.0.1:8303

Description of TiCDC cdc server command-line parameters

The following are descriptions of options available in the cdc server command:

  • gc-ttl: The TTL (Time To Live) of the service level GC safepoint in PD set by TiCDC, and the duration that the replication task can suspend, in seconds. The default value is 86400, which means 24 hours. Note: Suspending of the TiCDC replication task affects the progress of TiCDC GC safepoint, which means that it affects the progress of upstream TiDB GC, as detailed in Complete Behavior of TiCDC GC safepoint.
  • pd: The URL of the PD client.
  • addr: The listening address of TiCDC, the HTTP API address, and the Prometheus address of the service.
  • advertise-addr: The access address of TiCDC to the outside world.
  • 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.
  • log-file: The address of the running log of the TiCDC process. The default is cdc.log.
  • log-level: The log level when the TiCDC process is running. The default is info.
  • ca: The path of the CA certificate file used by TiCDC, in the PEM format (optional).
  • cert: The path of the certificate file used by TiCDC, in the PEM format (optional).
  • key: The path of the certificate key file used by TiCDC, in the PEM format (optional).
  • config: The address of the configuration file that TiCDC uses (optional). This option is supported since TiCDC v5.0.0. This option can be used in the TiCDC deployment since TiUP v1.4.0.
  • data-dir: Specifies the directory that TiCDC uses when it needs to use disk to store files. Unified Sorter uses this directory to store temporary files. Make sure there is enough space available on the device where this directory is located. If you are using TiUP, you can configure data_dir in the cdc_servers section, or directly use the default data_dir path in global.This option is supported since TiDB v4.0.14, v5.0.3. and later versions.
  • sort-dir: Specifies the temporary file directory used by the sorting engine. Note that this option is not supported since TiDB v4.0.14, v5.0.3 and v5.1.0. Do not use it any more.