이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 2. Installing Debezium connectors


Install Debezium connectors through AMQ Streams by extending Kafka Connect with connector plug-ins. Following a deployment of AMQ Streams, you can deploy Debezium as a connector configuration through Kafka Connect.

2.1. Prerequisites

A Debezium installation requires the following:

  • An OpenShift cluster
  • A deployment of AMQ Streams with Kafka Connect
  • A user on the OpenShift cluster with cluster-admin permissions to set up the required cluster roles and API services
Note

Java 8 or later is required to run the Debezium connectors.

To install Debezium, the OpenShift Container Platform command-line interface (CLI) is required. For information about how to install the CLI for OpenShift 4.7, see the OpenShift Container Platform 4.7 documentation.

Additional resources

2.2. Kafka topic creation recommendations

Debezium stores data in multiple Kafka topics. The topics must either be created in advance by an administrator, or you can configure Kafka Connect to configure topics automatically.

The following list describes limitations and recommendations to consider when creating topics:

Database history topics for MySQL, SQL Server, Db2, and Oracle connectors
  • Infinite or very long retention.
  • Replication factor of at least three in production environments.
  • Single partition.
Other topics
  • When you enable Kafka log compaction so that only the last change event for a given record is saved, set the following topic properties in Apache Kafka:

    • min.compaction.lag.ms
    • delete.retention.ms

      To ensure that consumers have enough time to receive all events and delete markers, specify values for the preceding properties that are larger than the maximum downtime that you expect for your sink connectors. For example, consider the downtime that might occur when you apply updates to sink connectors.

  • Replicated in production.
  • Single partition.

    You can relax the single partition rule, but your application must handle out-of-order events for different rows in the database. Events for a single row are still totally ordered. If you use multiple partitions, the default behavior is that Kafka determines the partition by hashing the key. Other partition strategies require the use of single message transformations (SMTs) to set the partition number for each record.

2.3. Deploying Debezium with AMQ Streams

To set up connectors for Debezium on Red Hat OpenShift Container Platform, deploy a Kafka cluster to OpenShift, download and configure Debezium connectors, and deploy Kafka Connect with the connectors.

Prerequisites

  • You used Red Hat AMQ Streams to set up Apache Kafka and Kafka Connect on OpenShift. AMQ Streams offers operators and images that bring Kafka to OpenShift.
  • Podman or Docker is installed.

Procedure

  1. Deploy your Kafka cluster. If you already have a Kafka cluster deployed, skip the following three sub-steps.

    1. Install the AMQ Streams operator by following the steps in Installing AMQ Streams and deploying components.
    2. Select the desired configuration and deploy your Kafka Cluster.
    3. Deploy Kafka Connect.

    You now have a working Kafka cluster that is running in OpenShift with Kafka Connect.

  2. Check that your pods are running. The pod names correspond with your AMQ Streams deployment.

    $ oc get pods
    
    NAME                                               READY STATUS
    <cluster-name>-entity-operator-7b6b9d4c5f-k7b92    3/3   Running
    <cluster-name>-kafka-0                             2/2   Running
    <cluster-name>-zookeeper-0                         2/2   Running
    <cluster-name>-operator-97cd5cf7b-l58bq            1/1   Running

    In addition to running pods, you should have a DeploymentConfig associated with Kafka Connect.

  3. Go to the Red Hat Integration download site.
  4. Download the Debezium connector archive(s) for your database(s).
  5. Extract the archive(s) to create a directory structure for the connector plug-in(s). If you downloaded and extracted multiple archives, the structure looks like this:

    $ tree ./my-plugins/
    ./my-plugins/
    ├── debezium-connector-db2
    |   ├── ...
    ├── debezium-connector-mongodb
    |   ├── ...
    ├── debezium-connector-mysql
    │   ├── ...
    ├── debezium-connector-postgres
    │   ├── ...
    └── debezium-connector-sqlserver
        ├── ...
  6. Create a new Dockerfile by using registry.redhat.io/amq7/amq-streams-kafka-28-rhel8:1.8.0 as the base image:

    FROM registry.redhat.io/amq7/amq-streams-kafka-28-rhel8:1.8.0
    USER root:root
    COPY ./my-plugins/ /opt/kafka/plugins/
    USER 1001
  7. Build the container image. If the Dockerfile you created in the previous step is in the current directory, enter one of the following commands:

    podman build -t my-new-container-image:latest .
    docker build -t my-new-container-image:latest .
  8. Push your custom image to your container registry. Enter one of the following commands:

    podman push my-new-container-image:latest
    docker push my-new-container-image:latest
  9. Point to the new container image. Complete one of the following tasks to specify the name of the image that you created to run your Debezium connector:

    • Edit the spec.image field of the KafkaConnect custom resource.

      If you set this property, the value overrides the STRIMZI_DEFAULT_KAFKA_CONNECT_IMAGE variable in the cluster Operator. For example:

      apiVersion: kafka.strimzi.io/v1beta2
      kind: KafkaConnect
      metadata:
        name: my-connect-cluster
        annotations: strimzi.io/use-connector-resources: "true"
      spec:
        #...
        image: my-new-container-image
    • In the install/cluster-operator/050-Deployment-strimzi-cluster-operator.yaml file, edit the STRIMZI_DEFAULT_KAFKA_CONNECT_IMAGE variable to point to the new container image and reinstall the Cluster Operator. If you edit this file you will need to apply it to your OpenShift cluster.

    The Kafka Connect deployment starts to use the new image.

Next steps

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.