A Distributed Task Queue is a system that helps manage tasks across multiple computers instead of relying on just one. This project enables efficient and reliable task distribution, ensuring seamless task execution even under high load or when individual systems are unavailable.
- Manage tasks across multiple workers.
- Supports task queuing, distributed execution, and scaling.
- Integration with Kafka and Redis for reliable task processing.
- Download Kafka from the official site.
- Extract the downloaded file:
tar -xzf kafka_2.13-3.8.1.tgz
-
cd kafka_2.13-3.8.1
- Install Homebrew if not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install Redis:
brew install redis
- Update the package list:
sudo apt update
- Install Redis:
sudo apt install redis
- Ensure you have Python and pip installed, then install the project dependencies using:
pip install -r requirements.txt
- Navigate to the Kafka directory:
cd kafka_2.13-3.8.1/
- Start the Kafka server:
bin/kafka-server-start.sh config/kraft/server.properties
- Start Redis:
brew services start redis
- Stop Redis:
brew services stop redis
- Start Redis:
sudo service redis-server start
- Stop Redis:
sudo service redis-server stop
- Changing the Number of Partitions for a Topic:
./kafka-topics.sh --alter --topic tasks --partitions 2 --bootstrap-server 127.0.0.1:9092
- Adding a New Topic:
./kafka-topics.sh --create --topic tasks_add --bootstrap-server 127.0.0.1:9092 --partitions 3 --replication-factor 1 ./kafka-topics.sh --create --topic tasks_sub --bootstrap-server 127.0.0.1:9092 --partitions 3 --replication-factor 1 ./kafka-topics.sh --create --topic tasks_mul --bootstrap-server 127.0.0.1:9092 --partitions 3 --replication-factor 1
Add each topic separately, we have given the command for the task subtraction. Use the syntax task_task_name
for including tasks