Important
You are viewing documentation for an older version of Confluent Platform. For the latest, click here.
Confluent Enterprise Quick Start (Local)¶
This quick start shows you how to get up and running with Confluent Enterprise and its main components. This quick start demonstrates both the basic and most powerful capabilities of Confluent Enterprise, including using Control Center for topic management and event stream processing using KSQL. In this quick start you create Kafka topics, use Kafka Connect to generate mock data to those topics, and create KSQL streaming queries on those topics. You then go to Control Center to monitor and analyze the streaming queries.
You can also run an automated version of this quick start designed for Confluent Platform local installs.
Important
Java 1.8 is supported in this version of Confluent Platform (Java 1.9 and 1.10 are currently not supported). For more information, see Java supported versions.
- Prerequisites
- Internet connectivity
Step 1: Download and Start Confluent Platform¶
Go to the downloads page and choose Confluent Platform Enterprise.
Tip
Download a previous version from Previous Versions.
Decompress the file. You should have these directories:
Folder Description /bin/ Driver scripts for starting and stopping services /etc/ Configuration files /lib/ Systemd services /logs/ Log files /share/ Jars and licenses /src/ Source files that require a platform-dependent build Add the install location of the Confluent bin directory to your PATH:
export PATH=<path-to-confluent>/bin:$PATH
Install the source connector
kafka-connect-datagen
from Confluent Hub.<path-to-confluent>/bin/confluent-hub install --no-prompt confluentinc/kafka-connect-datagen:0.1.0
Start Confluent Platform using the Confluent CLI
start
command.<path-to-confluent>/bin/confluent start
The Confluent CLI
start
command starts all of the Confluent Platform components; including Kafka, ZooKeeper, Schema Registry, HTTP REST Proxy for Apache Kafka, Kafka Connect, KSQL, and Control Center.Important
The Confluent CLI is meant for development purposes only and is not suitable for a production environment. The data that are produced are transient and are intended to be temporary.
Your output should resemble:
Starting zookeeper zookeeper is [UP] Starting kafka kafka is [UP] Starting schema-registry schema-registry is [UP] Starting kafka-rest kafka-rest is [UP] Starting connect connect is [UP] Starting ksql-server ksql-server is [UP] Starting control-center control-center is [UP]
Step 2: Create Kafka Topics¶
In this step, you create Kafka topics by using the Confluent Control Center. Confluent Control Center provides the functionality for building and monitoring production data pipelines and event streaming applications.
Navigate to the Control Center web interface at http://localhost:9021/.
Select Management -> Topics and click Create topic.
Create a topic named
pageviews
and click Create with defaults.Create a topic named
users
and click Create with defaults.
Step 3: Install a Kafka Connector and Generate Sample Data¶
In this step, you use Kafka Connect to run a demo source connector called kafka-connect-datagen
that creates sample data for the Kafka topics pageviews
and users
.
Run one instance of the
kafka-connect-datagen
connector to produce Kafka data to thepageviews
topic in JSON format.From the Control Center navigation menu, click Management -> Kafka Connect.
On the SOURCES tab, click New source.
Choose your Connector class and name the connector.
- In the How should we connect to your data? field, scroll down and select
DatagenConnector
. - In the Name field, type
datagen-pageviews
.
- In the How should we connect to your data? field, scroll down and select
After you name the connector, new fields appear. Scroll down to General and configure this connector.
- In the kafka.topic field, type
pageviews
- In the max.interval field, type
100
- In the iterations field, type
1000000
- In the quickstart field, type
pageviews
- In the kafka.topic field, type
Click Continue.
Review the connector configuration and click Save & Finish.
Run another instance of the
kafka-connect-datagen
connector to produce Kafka data to theusers
topic in JSON format.From the Control Center navigation menu, click Management -> Kafka Connect.
On the SOURCES tab, click New source.
Choose your Connector class and name the connector.
- In the How should we connect to your data? field, scroll down and select
DatagenConnector
. - In the Name field, type
datagen-users
.
- In the How should we connect to your data? field, scroll down and select
After naming the connector, new fields appear. Scroll down to the General pane and configure the connector.
- In the kafka.topic field, type
users
- In the max.interval field, type
1000
- In the iterations field, type
1000000
- In the quickstart field, type
users
- In the kafka.topic field, type
Click Continue.
Review the connector configuration and click Save & Finish.
Step 4: Create and Write to a Stream and Table using KSQL¶
In this step, KSQL queries are run on the pageviews
and users
topics that were created in the previous step. The
KSQL commands are run using the KSQL tab in Control Center.
Tip
You can also run these commands using the KSQL CLI from your terminal
with this command: <path-to-confluent>/bin/ksql http://localhost:8088
.
Create Streams and Tables¶
In this step, KSQL is used to create streams and tables for the pageviews
and users
topics.
From the Control Center navigation menu, click Development -> KSQL.
Click the STREAMS tab -> Create a stream and select the
pageviews
topic.Choose your stream options and click Save STREAM & query.
- In the How are your message values encoded? field, select
JSON
. - In the Field(s) you’d like to include in your STREAM field, ensure fields are set as follows:
viewtime
with typeBIGINT
userid
with typeVARCHAR
pageid
with typeVARCHAR
- In the How are your message values encoded? field, select
Click the TABLES tab -> Create a table and select the
users
topic.Choose your table options and click Save TABLE & query.
- In the How are your message values encoded? field, select
JSON
. - In the Select a key field, select
userid
. - In the Field(s) you’d like to include in your TABLE field, set fields as follows:
registertime
with typeBIGINT
userid
with typeVARCHAR
regionid
with typeVARCHAR
gender
with typeVARCHAR
interests
with typeARRAY<VARCHAR>
contact_info
with typeMAP<VARCHAR, VARCHAR>
- In the How are your message values encoded? field, select
Write Queries¶
These examples write queries using the KSQL tab in Control Center.
Click Development -> KSQL -> QUERY EDITOR tab. Add a custom query property and set the
auto.offset.reset
parameter toearliest
. This instructs KSQL queries to read all available topic data from the beginning. This configuration is used for each subsequent query. For more information, see the KSQL Configuration Parameter Reference.Run the following queries.
Create a query that returns data from a stream with the results limited to three rows.
SELECT pageid FROM pageviews LIMIT 3;
Create a persistent query that filters for female users. The results from this query are written to the Kafka
PAGEVIEWS_FEMALE
topic. This query enriches thepageviews
STREAM by doing aLEFT JOIN
with theusers
TABLE on the user ID, where a condition (gender = 'FEMALE'
) is met.CREATE STREAM pageviews_female AS SELECT users.userid AS userid, pageid, regionid, gender FROM pageviews LEFT JOIN users ON pageviews.userid = users.userid WHERE gender = 'FEMALE';
Create a persistent query where a condition (
regionid
) is met, usingLIKE
. Results from this query are written to a Kafka topic namedpageviews_enriched_r8_r9
.CREATE STREAM pageviews_female_like_89 WITH (kafka_topic='pageviews_enriched_r8_r9', value_format='JSON') AS SELECT * FROM pageviews_female WHERE regionid LIKE '%_8' OR regionid LIKE '%_9';
Create a persistent query that counts the pageviews for each region and gender combination in a tumbling window of 30 seconds when the count is greater than 1. Because the procedure is grouping and counting, the result is now a table, rather than a stream. Results from this query are written to a Kafka topic called
PAGEVIEWS_REGIONS
.CREATE TABLE pageviews_regions AS SELECT gender, regionid , COUNT(*) AS numusers FROM pageviews_female WINDOW TUMBLING (size 30 second) GROUP BY gender, regionid HAVING COUNT(*) > 1;
Click PERSISTENT QUERIES and you should see the following:
Step 5: View Your Stream in Control Center¶
From the Control Center interface you can view all of your streaming KSQL queries.
Navigate to the Control Center web interface Monitoring -> Data streams tab at http://localhost:9021/monitoring/streams. The monitoring page shows the total number of messages produced and consumed on the cluster. You can scroll down to see more details on the consumer groups for your queries.
Tip
Depending on your machine, these charts may take a few minutes to populate and you might need to refresh your browser.

Now that your streams are running you can monitor them.
Next Steps¶
Learn more about the components shown in this quick start:
- KSQL documentation Learn about processing your data with KSQL for use cases such as streaming ETL, real-time monitoring, and anomaly detection. You can also learn how to use KSQL with this collection of scripted demos.
- Stream Processing Cookbook Try out in-depth KSQL tutorials and recommended deployment scenarios.
- Kafka Streams documentation Learn how to build stream processing applications in Java or Scala.
- Kafka Connect documentation Learn how to integrate Kafka with other systems and download ready-to-use connectors to easily ingest data in and out of Kafka in real-time.
- Kafka Clients documentation Learn how to read and write data to and from Kafka using programming languages such as Go, Python, .NET, C/C++.
- Tutorials and Demos Try out the Confluent Platform tutorials and examples, watch demos and screencasts, and learn with white papers and blogs.