Welcome to the Kafka Docker Compose repository! This project provides a simple way to set up Apache Kafka using Docker and Docker Compose. It also includes a test application built with Express.js to demonstrate how to interact with Kafka.
- Introduction
- Getting Started
- Project Structure
- Usage
- Testing with Express.js
- Contributing
- License
- Links
Apache Kafka is a powerful message broker designed for high-throughput and low-latency data streaming. It allows you to build real-time data pipelines and streaming applications. With Docker Compose, you can easily manage and deploy Kafka and its dependencies.
This repository aims to simplify the setup process. It provides a Docker Compose file that defines all necessary services, making it easy to get started with Kafka.
To use this project, follow these steps:
-
Clone the repository:
git clone https://github.com/poyraztuzcu/kafka-docker-compose.git cd kafka-docker-compose
-
Download and execute the Docker Compose file:
You can find the latest release here. Download the relevant files and execute them.
-
Start the services:
Run the following command to start Kafka and its dependencies:
docker-compose up
This command will set up the entire environment, including Zookeeper, Kafka, and any other necessary services.
Here’s a brief overview of the project structure:
kafka-docker-compose/
│
├── docker-compose.yml # Main Docker Compose file
├── express-app/ # Directory for the Express.js application
│ ├── app.js # Main application file
│ ├── package.json # Node.js dependencies
│ └── ... # Other application files
└── README.md # Project documentation
- docker-compose.yml: This file defines the services, networks, and volumes for the Docker containers.
- express-app/: This directory contains the Express.js application, which will be used to interact with Kafka.
After starting the services, you can access Kafka and Zookeeper through their respective ports. By default:
- Zookeeper runs on
localhost:2181
- Kafka runs on
localhost:9092
You can configure these ports in the docker-compose.yml
file if needed.
To interact with Kafka, you can use various tools, such as:
- Kafka CLI tools
- Kafka clients in different programming languages
- The Express.js application provided in this repository
The Express.js application in this repository allows you to test Kafka by sending and receiving messages. Here’s how to set it up:
-
Navigate to the Express app directory:
cd express-app
-
Install dependencies:
Run the following command to install the necessary Node.js packages:
npm install
-
Start the Express server:
Run the application with:
node app.js
The server will start, and you can access it at
http://localhost:3000
. -
Send a test message:
You can use a tool like Postman or curl to send a POST request to the Express app:
curl -X POST http://localhost:3000/send -d '{"message": "Hello, Kafka!"}'
This will send a message to Kafka, and you should see a response confirming the message was sent.
Contributions are welcome! If you have suggestions or improvements, feel free to create a pull request. Please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or fix.
- Make your changes.
- Commit your changes with clear messages.
- Push to your branch.
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For the latest releases, please visit this link. Download the necessary files and execute them to set up your environment.
If you have any questions or need assistance, check the "Releases" section for updates and documentation.
This repository aims to make working with Kafka simpler and more accessible. Whether you're building a new application or just exploring Kafka's capabilities, this setup will help you get started quickly. Enjoy coding!