edenhill/kcat hiện có 5.8k sao trên GitHub, viết chủ yếu bằng C. Generic command line non-JVM Apache Kafka producer and consumer
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
kcat and kafkacat are Copyright (c) 2014-2021 Magnus Edenhill
https://github.com/edenhill/kcat
kcat logo by @dtrapezoid
What is kcat
kcat is a generic non-JVM producer and consumer for Apache Kafka >=0.8,
think of it as a netcat for Kafka.
In producer mode kcat reads messages from stdin, delimited with a
configurable delimiter (-D, defaults to newline), and produces them to the
provided Kafka cluster (-b), topic (-t) and partition (-p).
In consumer mode kcat reads messages from a topic and partition and
prints them to stdout using the configured message delimiter.
There's also support for the Kafka >=0.9 high-level balanced consumer, use
the -G <group> switch and provide a list of topics to join the group.
kcat also features a Metadata list (-L) mode to display the current
state of the Kafka cluster and its topics and partitions.
Supports Avro message deserialization using the Confluent Schema-Registry,
and generic primitive deserializers (see examples below).
kcat is fast and lightweight; statically linked it is no more than 150Kb.
What happened to kafkacat?
kcat is kafkacat. The kafkacat project was renamed to kcat in August 2021
to adhere to the Apache Software Foundation's (ASF) trademark policies.
Apart from the name, nothing else was changed.
Try it out with docker
# List brokers and topics in cluster
$ docker run -it --network=host edenhill/kcat:1.7.1 -b YOUR_BROKER -L
See Examples for usage options, and Running in Docker for more information on how to properly run docker-based clients with Kafka.
libavro-c and libserdes (for Avro support, optional. See https://github.com/confluentinc/libserdes)
On Ubuntu or Debian: sudo apt-get install librdkafka-dev libyajl-dev
Build
./configure <usual-configure-options>
make
sudo make install
Build for Windows
cd win32
nuget restore
msbuild
NOTE: Requires Build Tools for Visual Studio 2017 with components Windows 8.1 SDK and VC++ 2015.3 v14.00 (v140) toolset to be installed.
Quick build
The bootstrap.sh build script will download and build the required dependencies,
providing a quick and easy means of building kcat.
Internet connectivity and wget/curl is required by this script.
The resulting kcat binary will be linked statically to avoid runtime
dependencies.
NOTE: Requires curl and cmake (for yajl) to be installed.
./bootstrap.sh
Configuration
Any librdkafka configuration
property can be set on the command line using -X property=value, or in
a configuration file specified by -F <config-file>.
If no configuration file was specified with -F .. on the command line,
kcat will try the $KCAT_CONFIG or (deprecated) $KAFKACAT_CONFIG
environment variable,
and then the default configuration file ~/.config/kcat.conf or
the (deprecated) ~/.config/kafkacat.conf.
Configuration files are optional.
Examples
High-level balanced KafkaConsumer: subscribe to topic1 and topic2
(requires broker >=0.9.0 and librdkafka version >=0.9.1)
$ kcat -b mybroker -G mygroup topic1 topic2
Read messages from stdin, produce to 'syslog' topic with snappy compression
The latest kcat docker image is edenhill/kcat:1.7.1, there's
also Confluent's kafkacat docker images on Docker Hub.
If you are connecting to Kafka brokers also running on Docker you should specify the network name as part of the docker run command using the --network parameter. For more details of networking with Kafka and Docker see this post.
Here are two short examples of using kcat from Docker. See the Docker Hub listing and kafkacat docs for more details:
docker run -it --rm \
edenhill/kcat \
-b kafka-broker:9092 \
-C \
-f '\nKey (%K bytes): %k\t\nValue (%S bytes): %s\n\Partition: %p\tOffset: %o\n--\n' \
-t test
Key (1 bytes): 1
Value (88 bytes): {"order_id":1,"order_ts":1534772501276,"total_amount":10.50,"customer_name":"Bob Smith"}
Partition: 0 Offset: 0
--
Key (1 bytes): 2
Value (89 bytes): {"order_id":2,"order_ts":1534772605276,"total_amount":3.32,"customer_name":"Sarah Black"}
Partition: 0 Offset: 1
--
Key (1 bytes): 3
Value (90 bytes): {"order_id":3,"order_ts":1534772742276,"total_amount":21.00,"customer_name":"Emma Turner"}
Partition: 0 Offset: 2
--
% Reached end of topic test [0] at offset 3
Run a mock Kafka cluster
With kcat you can spin up an ephemeral in-memory mock Kafka cluster
that you you can connect your Kafka applications to for quick
testing.
The mock cluster supports a reasonable subset of the Kafka
protocol, such as:
Producer
Idempotent Producer
Transactional Producer
Low-level consumer
High-level balanced consumer groups with offset commits
Topic Metadata and auto creation
Spin the cluster by running kcat in the -M (for mock) mode:
While kcat runs, let your Kafka applications connect to the mock cluster
by configuring them with the bootstrap.servers emitted in the BROKERS
line above.
Let kcat run for as long as you need the cluster, then terminate it by
pressing Ctrl-D.
Since the cluster runs all in memory, with no disk IO, it is quite suitable
for performance testing.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/edenhill/kcat là nguồn chính thức.
edenhill/kcat có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho edenhill/kcat. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
edenhill/kcat có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho edenhill/kcat. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
edenhill/kcat có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho edenhill/kcat. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
edenhill/kcat còn đang phát triển không?
Commit gần nhất trên edenhill/kcat là 2.3 năm trước (theo timestamp GitHub). Repo có 498 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
kcat có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về kcat.