我是靠谱客的博主 洁净小土豆,最近开发中收集的这篇文章主要介绍一键启动Debezium+Kafka+Flink编写配置文件docker-compose.yml将kafka对外开放,方便调试启动,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

编写配置文件docker-compose.yml

version: "3.3"
services:
  database:
    image: debezium/postgres:11
    container_name: database
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_PASSWORD=mima

  zookeeper:
    image: debezium/zookeeper:0.10
    container_name: zookeeper
    ports:
      - "2181:2181"
      - "2888:2888"
      - "3888:3888"
  kafka:
    image: debezium/kafka:0.10
    container_name: kafka
    ports:
      - "9092:9092"
    depends_on:
      - zookeeper
    links:
      - "zookeeper:zookeeper"
    environment:
      - BROKER_ID=1
      - ZOOKEEPER_CONNECT=zookeeper
      - ADVERTISED_HOST_NAME=kafka

  connector:
    image: debezium/connect:0.10
    container_name: connector
    expose:
      - "8083"
    depends_on:
      - kafka
      - database
    links:
      - "zookeeper:zookeeper"
      - "kafka:kafka"
      - "database:database"
    environment:
      - GROUP_ID=1
      - CONFIG_STORAGE_TOPIC=my-connect-configs
      - OFFSET_STORAGE_TOPIC=my-connect-offsets
  connector-config:
    image: curlimages/curl
    depends_on:
      - connector
    links:
      - "connector:connector"
    command: ["curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" connector:8083/connectors/ -d '{ "name": "connector", "config": { "connector.class": "io.debezium.connector.postgresql.PostgresConnector", "tasks.max": "1", "database.hostname": "database", "database.port": "5432", "database.user": "postgres", "database.password": "mima","database.dbnam
e":"postgres", "database.server.name": "postgres"} }'"]

  jobmanager:
    image: flink
    expose:
      - "6123"
    ports:
      - "8081:8081"
    command: jobmanager
    environment:
      - JOB_MANAGER_RPC_ADDRESS=jobmanager
  taskmanager:
    image: flink
    expose:
      - "6121"
      - "6122"
    depends_on:
      - jobmanager
    command: taskmanager
    links:
      - "jobmanager:jobmanager"
      - "zookeeper:zookeeper"
      - "kafka:kafka"
    environment:
      - JOB_MANAGER_RPC_ADDRESS=jobmanager

将kafka对外开放,方便调试

sed -i 's/ADVERTISED_HOST_NAME=kafka/ADVERTISED_HOST_NAME='$(ip a|grep 192.168|awk '{print $2}'|awk -F / '{print $1}')'/g' docker-compose.yml

其中192.168是根据自己的网络环境修改

启动

docker-compose up

最后

以上就是洁净小土豆为你收集整理的一键启动Debezium+Kafka+Flink编写配置文件docker-compose.yml将kafka对外开放,方便调试启动的全部内容,希望文章能够帮你解决一键启动Debezium+Kafka+Flink编写配置文件docker-compose.yml将kafka对外开放,方便调试启动所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(36)

评论列表共有 0 条评论

立即
投稿
返回
顶部