DEV Community


Running Flink SQL Against Kafka Using a Schema Registry Catalog

tspannhw profile image Timothy Spann Originally published at on ・2 min read

[FLaNK]: Running Apache Flink SQL Against Kafka Using a Schema Registry Catalog

There are a few things you can do when you are sending data from Apache NiFi to Apache Kafka to maximize it's availability to Flink SQL queries through the catalogs.



Producing Kafka Messages

Make sure you set AvroRecordSetWriter and set a Message Key Field.

A great way to work with Flink SQL is to connect to the Cloudera Schema Registry. It let's you define your schema once them use it in Apache NiFi, Apache Kafka Connect, Apache Spark, Java Microservices




Make sure you setup your HDFS directory for use by Flink which keeps history and other important information in HDFS.

HADOOP_USER_NAME=hdfs hdfs dfs -mkdir /user/root

HADOOP_USER_NAME=hdfs hdfs dfs -chown root:root /user/root


| configuration: |
| | yarn-session |
| | |
| | catalogs: |
| | - name: registry |
| | type: cloudera-registry |
| | # Registry Client standard properties |
| | http://edge2ai-1.dim.local:7788/api/v1 |
| | # |
| | # Registry Client SSL properties |
| | # Kafka Connector properties |
| | edge2ai-1.dim.local:9092 |
| | connector.startup-mode: earliest-offset |
| | - name: kudu |
| | type: kudu |
| | kudu.masters: edge2ai-1.dim.local:7051 |


flink-sql-client embedded -e sql-env.yaml

We now have access to Kudu and Schema Registry catalogs of tables. This let's use start querying, joining and filtering any of these multiple tables without having to recreate or redefine them.

SELECT * FROM events


Discussion (0)

Editor guide