Create topic on Kafka with partition count, 카프카 토픽 생성하기

To create a Kafka topic with 100 partitions, you can use the Kafka command-line tool (kafka-topics.sh or kafka-topics.bat for Windows). When creating a topic, you can specify the number of partitions and the replication factor.

Here’s how to create a topic with 100 partitions:

Step-by-step instructions:

  1. Open a terminal on your machine where Kafka is installed.

  2. Run the kafka-topics.sh command with the necessary options to create the topic:

    kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 100 --topic <topic_name>
    
    • --bootstrap-server localhost:9092: Specifies the Kafka broker (or cluster) address. Replace localhost:9092 with your actual Kafka broker address if it’s different.
    • --replication-factor 1: Specifies the number of replicas for each partition. In this example, it's set to 1, but in a production environment, you’ll want a higher replication factor for redundancy.
    • --partitions 100: Specifies the number of partitions (in this case, 100).
    • --topic <topic_name>: Replace <topic_name> with the name of the topic you want to create.

Example:

kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 100 --topic my-large-topic

3. Verify the Topic Creation

After running the command, you can verify that the topic was created successfully and that it has 100 partitions:

kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic my-large-topic

This will give you a detailed description of the topic, including the number of partitions and replication factor.

Notes:

  • Replication factor: In a production Kafka setup with multiple brokers, you'll usually want to set a replication factor higher than 1 for fault tolerance.
  • Number of partitions: More partitions allow for greater parallelism in Kafka but require more resources. Make sure to tune the number of partitions based on your expected workload and cluster size.

댓글

이 블로그의 인기 게시물

To switch to a specific tag in a Git repository

How to checkout branch of remote git, 깃 리모트 브랜치 체크아웃

Using the MinIO API via curl

To download a file from MinIO using Spring Boot, 스프링부트 Minio 사용하기

리눅스의 부팅과정 (프로세스, 서비스 관리)

Chromium 개발 환경 세팅, 크로미움 개발 준비하기

Joining an additional control plane node to an existing Kubernetes cluster

urllib3 with proxy settings

CDPEvents in puppeteer

Avro + Grpc in python