Kafka is a distributed streaming platform used for building real-time data pipelines. It is designed to handle high throughput and low latency, making it ideal for processing large streams of data in real-time.
This project aims at implementing a model of Kafka with Added Fault Tolerance which was not originally proposed by LinkedIn
-
Ensure you have Node.js and npm installed on your machine.
node --version >= v18.13.0 -
Make sure you've set the environment vairables by creating a
.envfile for each of these folders:- Zookeeper
- Brokers
- Config
- Clients
-
Trial values for
.env(can use this for all the above folders)NUM_BROKERS=5 REPLICATION_FACTOR=3 ZOOKEEPER_PORT=8000 ZOOKEEPER_HOST="http://localhost" BROKER_HOST="http://localhost"
Open the zookeeper folder in the root directory, then:
-
Install Dependencies:
npm i
-
Start Zookeeper
node zookeeper.js
If no port is specified in .env it will run on PORT 8000 by default
Open the brokers folder in the root directory, then:
-
Install Dependencies:
npm i
-
Start the Broker
node broker.js <PORT>
Example:
node broker.js 3000
Open the config folder in the root directory, then:
-
Install Dependencies:
npm i
-
To Add Topics
node topics\add-topics.js -
To Remove Topics
node topics\remove-topics.js
Open the clients folder in the root directory, then:
-
Install Dependencies:
npm i
-
To start the Producer
node producer.js
-
To start the Consumer
node consumer.js