github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/deployments/ticdc/docker-compose/docker-compose-canal.yml (about)

     1  ---
     2  version: '3.5'
     3  
     4  services:
     5    controller:
     6      image: ticdc:latest
     7      container_name: ticdc_controller
     8      build:
     9        context: ../../../
    10        dockerfile: ./deployments/ticdc/docker/Dockerfile
    11      volumes:
    12        - /data
    13        - ./logs:/logs
    14        - ./configs:/configs
    15      command:
    16        - /bin/bash
    17        - -c
    18        - /usr/bin/tail -f /dev/null
    19      depends_on:
    20        - "upstream-pd"
    21        - "kafka"
    22        - "capturer0"
    23        - "capturer1"
    24        - "capturer2"
    25      restart: on-failure
    26  
    27    capturer0:
    28      image: ticdc:latest
    29      build:
    30        context: ../../../
    31        dockerfile: ./deployments/ticdc/docker/Dockerfile
    32      volumes:
    33        - /data
    34        - ./logs:/logs
    35      ports:
    36        - "8300:8300"
    37      entrypoint: "/cdc server"
    38      command:
    39        - --addr=0.0.0.0:8300
    40        - --pd=http://upstream-pd:2379
    41        - --log-file=/logs/capturer0.log
    42        - --advertise-addr=capturer0:8300
    43        - --data-dir=/data
    44        - --log-level=debug
    45      depends_on:
    46        - "upstream-tidb"
    47        - "downstream-tidb"
    48        - "kafka"
    49      restart: on-failure
    50  
    51    capturer1:
    52      image: ticdc:latest
    53      build:
    54        context: ../../../
    55        dockerfile: ./deployments/ticdc/docker/Dockerfile
    56      volumes:
    57        - /data
    58        - ./logs:/logs
    59      ports:
    60        - "8301:8300"
    61      entrypoint: "/cdc server"
    62      command:
    63        - --addr=0.0.0.0:8300
    64        - --pd=http://upstream-pd:2379
    65        - --log-file=/logs/capturer1.log
    66        - --advertise-addr=capturer1:8300
    67        - --data-dir=/data
    68        - --log-level=debug
    69      depends_on:
    70        - "upstream-tidb"
    71        - "downstream-tidb"
    72        - "kafka"
    73      restart: on-failure
    74  
    75    capturer2:
    76      image: ticdc:latest
    77      build:
    78        context: ../../../
    79        dockerfile: ./deployments/ticdc/docker/Dockerfile
    80      volumes:
    81        - /data
    82        - ./logs:/logs
    83      ports:
    84        - "8302:8300"
    85      entrypoint: "/cdc server"
    86      command:
    87        - --addr=0.0.0.0:8300
    88        - --pd=http://upstream-pd:2379
    89        - --log-file=/logs/capturer2.log
    90        - --advertise-addr=capturer2:8300
    91        - --data-dir=/data
    92        - --log-level=debug
    93      depends_on:
    94        - "upstream-tidb"
    95        - "downstream-tidb"
    96        - "kafka"
    97      restart: on-failure
    98  
    99    upstream-pd:
   100      image: pingcap/pd:nightly
   101      ports:
   102        - "2379:2379"
   103      volumes:
   104        - ./configs/pd.toml:/pd.toml:ro
   105        - /data
   106        - ./logs:/logs
   107      command:
   108        - --name=upstream-pd
   109        - --client-urls=http://0.0.0.0:2379
   110        - --peer-urls=http://0.0.0.0:2380
   111        - --advertise-client-urls=http://upstream-pd:2379
   112        - --advertise-peer-urls=http://upstream-pd:2380
   113        - --initial-cluster=upstream-pd=http://upstream-pd:2380
   114        - --data-dir=/data/upstream-pd
   115        - --config=/pd.toml
   116        - --log-file=/logs/upstream-pd.log
   117        - -L=info
   118      restart: on-failure
   119  
   120    upstream-tikv0:
   121      image: pingcap/tikv:nightly
   122      volumes:
   123        - ./configs/tikv.toml:/tikv.toml:ro
   124        - /data
   125        - ./logs:/logs
   126      command:
   127        - --addr=0.0.0.0:20160
   128        - --advertise-addr=upstream-tikv0:20160
   129        - --data-dir=/data/upstream-tikv0
   130        - --pd=upstream-pd:2379
   131        - --config=/tikv.toml
   132        - --log-file=/logs/upstream-tikv0.log
   133        - --log-level=debug
   134      depends_on:
   135        - "upstream-pd"
   136      restart: on-failure
   137  
   138    upstream-tikv1:
   139      image: pingcap/tikv:nightly
   140      volumes:
   141        - ./configs/tikv.toml:/tikv.toml:ro
   142        - /data
   143        - ./logs:/logs
   144      command:
   145        - --addr=0.0.0.0:20160
   146        - --advertise-addr=upstream-tikv1:20160
   147        - --data-dir=/data/upstream-tikv1
   148        - --pd=upstream-pd:2379
   149        - --config=/tikv.toml
   150        - --log-file=/logs/upstream-tikv1.log
   151        - --log-level=debug
   152      depends_on:
   153        - "upstream-pd"
   154      restart: on-failure
   155  
   156    upstream-tikv2:
   157      image: pingcap/tikv:nightly
   158      volumes:
   159        - ./configs/tikv.toml:/tikv.toml:ro
   160        - /data
   161        - ./logs:/logs
   162      command:
   163        - --addr=0.0.0.0:20160
   164        - --advertise-addr=upstream-tikv2:20160
   165        - --data-dir=/data/upstream-tikv2
   166        - --pd=upstream-pd:2379
   167        - --config=/tikv.toml
   168        - --log-file=/logs/upstream-tikv2.log
   169        - --log-level=debug
   170      depends_on:
   171        - "upstream-pd"
   172      restart: on-failure
   173  
   174    upstream-tidb:
   175      image: pingcap/tidb:nightly
   176      ports:
   177        - "4000:4000"
   178        - "10080:10080"
   179      volumes:
   180        - ./configs/tidb.toml:/tidb.toml:ro
   181        - ./logs:/logs
   182      command:
   183        - --store=tikv
   184        - --path=upstream-pd:2379
   185        - --config=/tidb.toml
   186        - --log-file=/logs/upstream-tidb.log
   187        - --advertise-address=upstream-tidb
   188        - -L=info
   189      depends_on:
   190        - "upstream-tikv0"
   191        - "upstream-tikv1"
   192        - "upstream-tikv2"
   193      restart: on-failure
   194  
   195    downstream-pd:
   196      image: pingcap/pd:nightly
   197      ports:
   198        - "3379:2379"
   199      volumes:
   200        - ./configs/pd.toml:/pd.toml:ro
   201        - /data
   202        - ./logs:/logs
   203      command:
   204        - --name=downstream-pd
   205        - --client-urls=http://0.0.0.0:2379
   206        - --peer-urls=http://0.0.0.0:2380
   207        - --advertise-client-urls=http://downstream-pd:2379
   208        - --advertise-peer-urls=http://downstream-pd:2380
   209        - --initial-cluster=downstream-pd=http://downstream-pd:2380
   210        - --data-dir=/data/downstream-pd
   211        - --config=/pd.toml
   212        - --log-file=/logs/downstream-pd.log
   213        - -L=info
   214      restart: on-failure
   215  
   216    downstream-tikv0:
   217      image: pingcap/tikv:nightly
   218      volumes:
   219        - ./configs/tikv.toml:/tikv.toml:ro
   220        - /data
   221        - ./logs:/logs
   222      command:
   223        - --addr=0.0.0.0:20160
   224        - --advertise-addr=downstream-tikv0:20160
   225        - --data-dir=/data/downstream-tikv0
   226        - --pd=downstream-pd:2379
   227        - --config=/tikv.toml
   228        - --log-file=/logs/downstream-tikv0.log
   229        - --log-level=info
   230      depends_on:
   231        - "downstream-pd"
   232      restart: on-failure
   233  
   234    downstream-tikv1:
   235      image: pingcap/tikv:nightly
   236      volumes:
   237        - ./configs/tikv.toml:/tikv.toml:ro
   238        - /data
   239        - ./logs:/logs
   240      command:
   241        - --addr=0.0.0.0:20160
   242        - --advertise-addr=downstream-tikv1:20160
   243        - --data-dir=/data/downstream-tikv1
   244        - --pd=downstream-pd:2379
   245        - --config=/tikv.toml
   246        - --log-file=/logs/downstream-tikv1.log
   247        - --log-level=info
   248      depends_on:
   249        - "downstream-pd"
   250      restart: on-failure
   251  
   252    downstream-tikv2:
   253      image: pingcap/tikv:nightly
   254      volumes:
   255        - ./configs/tikv.toml:/tikv.toml:ro
   256        - /data
   257        - ./logs:/logs
   258      command:
   259        - --addr=0.0.0.0:20160
   260        - --advertise-addr=downstream-tikv2:20160
   261        - --data-dir=/data/downstream-tikv2
   262        - --pd=downstream-pd:2379
   263        - --config=/tikv.toml
   264        - --log-file=/logs/downstream-tikv2.log
   265        - --log-level=info
   266      depends_on:
   267        - "downstream-pd"
   268      restart: on-failure
   269  
   270    downstream-tidb:
   271      image: pingcap/tidb:nightly
   272      ports:
   273        - "5000:4000"
   274        - "20080:10080"
   275      volumes:
   276        - ./configs/tidb.toml:/tidb.toml:ro
   277        - ./logs:/logs
   278      command:
   279        - --store=tikv
   280        - --path=downstream-pd:2379
   281        - --config=/tidb.toml
   282        - --log-file=/logs/downstream-tidb.log
   283        - --advertise-address=downstream-tidb
   284        - -L=info
   285      depends_on:
   286        - "downstream-tikv0"
   287        - "downstream-tikv1"
   288        - "downstream-tikv2"
   289      restart: on-failure
   290  
   291    # The rest of the file is adapted from https://github.com/confluentinc/demo-scene/blob/master/connect-jdbc/docker-compose.yml
   292  
   293    zookeeper:
   294      image: confluentinc/cp-zookeeper:5.5.1
   295      container_name: zookeeper
   296      environment:
   297        ZOOKEEPER_CLIENT_PORT: 2181
   298        ZOOKEEPER_TICK_TIME: 2000
   299  
   300    kafka:
   301      image: confluentinc/cp-enterprise-kafka:5.5.1
   302      container_name: kafka
   303      depends_on:
   304        - "zookeeper"
   305      ports:
   306        # Exposes 9092 for external connections to the broker
   307        # Use kafka:29092 for connections internal on the docker network
   308        # See https://rmoff.net/2018/08/02/kafka-listeners-explained/ for details
   309        - 9092:9092
   310      environment:
   311        KAFKA_BROKER_ID: 1
   312        KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
   313        KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
   314        KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
   315        KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://kafka:9092
   316        KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
   317        KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
   318        KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
   319        KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100
   320        CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: kafka:29092
   321        CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181
   322        CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
   323        CONFLUENT_METRICS_ENABLE: 'true'
   324        CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'
   325  
   326    canal-adapter:
   327      image: canal-adapter:latest
   328      build:
   329        context: ../../../scripts/canal/docker
   330        dockerfile: ./Dockerfile
   331      ports:
   332        - 8081:8081
   333      volumes:
   334        - ./logs:/root/logs
   335      environment:
   336        KAFKA_SERVER: kafka:9092
   337        ZOOKEEPER_SERVER: zookeeper:2181
   338        DB_NAME: testdb
   339        DOWNSTREAM_DB_HOST: downstream-tidb
   340        DOWNSTREAM_DB_PORT: 4000
   341        USE_FLAT_MESSAGE: ${USE_FLAT_MESSAGE}
   342      depends_on:
   343        - "zookeeper"
   344        - "kafka"
   345        - "upstream-tidb"
   346        - "downstream-tidb"
   347      restart: on-failure