Creating an Apache Kafka data source
With a Kafka data source, you can process real-time data feeds.
Before you begin
Before you create a new Apache Kafka
data source, install Apache Kafka and
specify the basic authentication.
- Install Apache Kafka and ksqlDB
-
- Install Docker desktop by completing the steps that are described in the Docker documentation.
- Create a directory named <docker>/<ksqldb> and create a file named docker-compose.yml in that directory.
- Copy the Start a Kafka broker for me script from the ksqlDB Quickstart page into the docker-compose.yml file.
- At the command prompt, change the directory to <docker>/<ksqldb> and run the docker compose up -d command.
- Wait for all the containers to start.
- Specify the basic authentication
-
- Open the docker-compose.yml file.
- Add the following code to ksqldb-server: after
environment:
KSQL_SASL_MECHANISM: PLAIN KSQL_OPTS: "-Dauthentication.method=BASIC -Dauthentication.realm=KsqlServer-Props -Dauthentication.roles=admin -Djava.security.auth.login.config=/etc/ksqldb/jaas/jaas_config.file" volumes: - "./etc/ksqldb/jaas:/etc/ksqldb/jaas/" - Create the folders etc/ksqldb/jaas in the directory where docker-compose.yml is stored.
- Create the password and jass_config files in the jaas folder.
- Specify the user details in the password file.
- Enter the following details in the jass_config
file:
KsqlServer-Props {org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required file="/etc/ksqldb/jaas/password-file" debug="false"; }; - At the command prompt, change the directory to <docker>/<ksqldb> and run the following command: docker-compose up -d
- Verify the login by running the following command: docker exec -it ksqldb-cli ksql -u username -p letmein http://ksqldb-server:8088
Note: For advanced steps, refer to the information mentioned in Configure Security for ksqlDB.
About this task
You can connect to Kafka data source by either specifying the host name and the host port or by setting the connection parameters.
To create a Kafka data source, complete the following steps: