[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-6505":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},6505,"kcat","edenhill\u002Fkcat","edenhill","Generic command line non-JVM Apache Kafka producer and consumer","",null,"C",5761,502,70,137,0,10,39.1,"Other",false,"master",true,[],"2026-06-12 02:01:25","![logo by @dtrapezoid](.\u002Fresources\u002Fkcat_small.png)\n\n# kcat\n\n**kcat is the project formerly known as as kafkacat**\n\nkcat and kafkacat are Copyright (c) 2014-2021 Magnus Edenhill\n\n[https:\u002F\u002Fgithub.com\u002Fedenhill\u002Fkcat](https:\u002F\u002Fgithub.com\u002Fedenhill\u002Fkcat)\n\n*kcat logo by [@dtrapezoid](https:\u002F\u002Ftwitter.com\u002Fdtrapezoid)*\n\n\n## What is kcat\n\n**kcat** is a generic non-JVM producer and consumer for Apache Kafka >=0.8,\nthink of it as a netcat for Kafka.\n\nIn **producer** mode kcat reads messages from stdin, delimited with a\nconfigurable delimiter (-D, defaults to newline), and produces them to the\nprovided Kafka cluster (-b), topic (-t) and partition (-p).\n\nIn **consumer** mode kcat reads messages from a topic and partition and\nprints them to stdout using the configured message delimiter.\n\nThere's also support for the Kafka >=0.9 high-level balanced consumer, use\nthe `-G \u003Cgroup>` switch and provide a list of topics to join the group.\n\nkcat also features a Metadata list (-L) mode to display the current\nstate of the Kafka cluster and its topics and partitions.\n\nSupports Avro message deserialization using the Confluent Schema-Registry,\nand generic primitive deserializers (see examples below).\n\nkcat is fast and lightweight; statically linked it is no more than 150Kb.\n\n## What happened to kafkacat?\n\n**kcat is kafkacat**. The kafkacat project was renamed to kcat in August 2021\nto adhere to the Apache Software Foundation's (ASF) trademark policies.\nApart from the name, nothing else was changed.\n\n\n## Try it out with docker\n\n```bash\n# List brokers and topics in cluster\n$ docker run -it --network=host edenhill\u002Fkcat:1.7.1 -b YOUR_BROKER -L\n```\n\nSee [Examples](#examples) for usage options, and [Running in Docker](#running-in-docker) for more information on how to properly run docker-based clients with Kafka.\n\n\n## Install\n\n### On recent enough Debian systems:\n\n````\napt-get install kafkacat\n````\n\nOn recent openSUSE systems:\n\n```\nzypper addrepo https:\u002F\u002Fdownload.opensuse.org\u002Frepositories\u002Fnetwork:utilities\u002FopenSUSE_Factory\u002Fnetwork:utilities.repo\nzypper refresh\nzypper install kafkacat\n```\n(see [this page](https:\u002F\u002Fsoftware.opensuse.org\u002Fdownload\u002Fpackage?package=kafkacat&project=network%3Autilities) for instructions to install with openSUSE LEAP)\n\n### On Mac OS X with homebrew installed:\n\n````\nbrew install kcat\n````\n\n### On Fedora\n\n```\n# dnf copr enable bvn13\u002Fkcat\n# dnf update\n# dnf install kafkacat\n```\n\nSee [this blog](https:\u002F\u002Frmoff.net\u002F2020\u002F04\u002F20\u002Fhow-to-install-kafkacat-on-fedora\u002F) for how to build from sources and install kafkacat\u002Fkcat on recent Fedora systems.\n\n\n### Otherwise follow directions below\n\n\n## Requirements\n\n * librdkafka - https:\u002F\u002Fgithub.com\u002Fedenhill\u002Flibrdkafka\n * libyajl (for JSON support, optional)\n * libavro-c and libserdes (for Avro support, optional. See https:\u002F\u002Fgithub.com\u002Fconfluentinc\u002Flibserdes)\n\nOn Ubuntu or Debian: `sudo apt-get install librdkafka-dev libyajl-dev`\n\n## Build\n\n    .\u002Fconfigure \u003Cusual-configure-options>\n    make\n    sudo make install\n\n### Build for Windows\n\n    cd win32\n    nuget restore\n    msbuild\n\n**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.\n\n## Quick build\n\nThe bootstrap.sh build script will download and build the required dependencies,\nproviding a quick and easy means of building kcat.\nInternet connectivity and wget\u002Fcurl is required by this script.\nThe resulting kcat binary will be linked statically to avoid runtime\ndependencies.\n**NOTE**: Requires `curl` and `cmake` (for yajl) to be installed.\n\n    .\u002Fbootstrap.sh\n\n\n## Configuration\n\nAny librdkafka [configuration](https:\u002F\u002Fgithub.com\u002Fedenhill\u002Flibrdkafka\u002Fblob\u002Fmaster\u002FCONFIGURATION.md)\nproperty can be set on the command line using `-X property=value`, or in\na configuration file specified by `-F \u003Cconfig-file>`.\n\nIf no configuration file was specified with `-F ..` on the command line,\nkcat will try the `$KCAT_CONFIG` or (deprecated) `$KAFKACAT_CONFIG`\nenvironment variable,\nand then the default configuration file `~\u002F.config\u002Fkcat.conf` or\nthe (deprecated) `~\u002F.config\u002Fkafkacat.conf`.\n\nConfiguration files are optional.\n\n\n## Examples\n\nHigh-level balanced KafkaConsumer: subscribe to topic1 and topic2\n(requires broker >=0.9.0 and librdkafka version >=0.9.1)\n\n    $ kcat -b mybroker -G mygroup topic1 topic2\n\n\nRead messages from stdin, produce to 'syslog' topic with snappy compression\n\n    $ tail -f \u002Fvar\u002Flog\u002Fsyslog | kcat -b mybroker -t syslog -z snappy\n\n\nRead messages from Kafka 'syslog' topic, print to stdout\n\n    $ kcat -b mybroker -t syslog\n\n\nProduce messages from file (one file is one message)\n\n    $ kcat -P -b mybroker -t filedrop -p 0 myfile1.bin \u002Fetc\u002Fmotd thirdfile.tgz\n\n\nProduce messages transactionally (one single transaction for all messages):\n\n    $ kcat -P -b mybroker -t mytopic -X transactional.id=myproducerapp\n\n\nRead the last 2000 messages from 'syslog' topic, then exit\n\n    $ kcat -C -b mybroker -t syslog -p 0 -o -2000 -e\n\n\nConsume from all partitions from 'syslog' topic\n\n    $ kcat -C -b mybroker -t syslog\n\n\nOutput consumed messages in JSON envelope:\n\n    $ kcat -b mybroker -t syslog -J\n\n\nDecode Avro key (`-s key=avro`), value (`-s value=avro`) or both (`-s avro`) to JSON using schema from the Schema-Registry:\n\n    $ kcat -b mybroker -t ledger -s avro -r http:\u002F\u002Fschema-registry-url:8080\n\n\nDecode Avro message value and extract Avro record's \"age\" field:\n\n    $ kcat -b mybroker -t ledger -s value=avro -r http:\u002F\u002Fschema-registry-url:8080 | jq .payload.age\n\n\nDecode key as 32-bit signed integer and value as 16-bit signed integer followed by an unsigned byte followed by string:\n\n    $ kcat -b mybroker -t mytopic -s key='i$' -s value='hB s'\n\n\n*Hint: see `kcat -h` for all available deserializer options.*\n\n\nOutput consumed messages according to format string:\n\n    $ kcat -b mybroker -t syslog -f 'Topic %t[%p], offset: %o, key: %k, payload: %S bytes: %s\\n'\n\n\nRead the last 100 messages from topic 'syslog' with  librdkafka configuration parameter 'broker.version.fallback' set to '0.8.2.1' :\n\n    $ kcat -C -b mybroker -X broker.version.fallback=0.8.2.1 -t syslog -p 0 -o -100 -e\n\n\nProduce a tombstone (a \"delete\" for compacted topics) for key \"abc\" by providing an empty message value which `-Z` interpretes as NULL:\n\n    $ echo \"abc:\" | kcat -b mybroker -t mytopic -Z -K:\n\n\nProduce with headers:\n\n    $ echo \"hello there\" | kcat -b mybroker -P -t mytopic -H \"header1=header value\" -H \"nullheader\" -H \"emptyheader=\" -H \"header1=duplicateIsOk\"\n\n\nPrint headers in consumer:\n\n    $ kcat -b mybroker -C -t mytopic -f 'Headers: %h: Message value: %s\\n'\n\n\nEnable the idempotent producer, providing exactly-once and strict-ordering\n**producer** guarantees:\n\n    $ kcat -b mybroker -X enable.idempotence=true -P -t mytopic ....\n\n\nConnect to cluster using SSL and SASL PLAIN authentication:\n\n    $ kcat -b mybroker -X security.protocol=SASL_SSL -X sasl.mechanism=PLAIN -X sasl.username=myapikey -X sasl.password=myapisecret ...\n\n\nMetadata listing:\n\n```\n$ kcat -L -b mybroker\nMetadata for all topics (from broker 1: mybroker:9092\u002F1):\n 3 brokers:\n  broker 1 at mybroker:9092\n  broker 2 at mybrokertoo:9092\n  broker 3 at thirdbroker:9092\n 16 topics:\n  topic \"syslog\" with 3 partitions:\n    partition 0, leader 3, replicas: 1,2,3, isrs: 1,2,3\n    partition 1, leader 1, replicas: 1,2,3, isrs: 1,2,3\n    partition 2, leader 1, replicas: 1,2, isrs: 1,2\n  topic \"rdkafkatest1_auto_49f744a4327b1b1e\" with 2 partitions:\n    partition 0, leader 3, replicas: 3, isrs: 3\n    partition 1, leader 1, replicas: 1, isrs: 1\n  topic \"rdkafkatest1_auto_e02f58f2c581cba\" with 2 partitions:\n    partition 0, leader 3, replicas: 3, isrs: 3\n    partition 1, leader 1, replicas: 1, isrs: 1\n  ....\n```\n\n\nJSON metadata listing\n\n    $ kcat -b mybroker -L -J\n\n\nPretty-printed JSON metadata listing\n\n    $ kcat -b mybroker -L -J | jq .\n\n\nQuery offset(s) by timestamp(s)\n\n    $ kcat -b mybroker -Q -t mytopic:3:2389238523 -t mytopic2:0:18921841\n\n\nConsume messages between two timestamps\n\n    $ kcat -b mybroker -C -t mytopic -o s@1568276612443 -o e@1568276617901\n\n\n\n## Running in Docker\n\nThe latest kcat docker image is `edenhill\u002Fkcat:1.7.1`, there's\nalso [Confluent's kafkacat docker images on Docker Hub](https:\u002F\u002Fhub.docker.com\u002Fr\u002Fconfluentinc\u002Fcp-kafkacat\u002F).\n\nIf 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](https:\u002F\u002Frmoff.net\u002F2018\u002F08\u002F02\u002Fkafka-listeners-explained\u002F).\n\nHere are two short examples of using kcat from Docker. See the [Docker Hub listing](https:\u002F\u002Fhub.docker.com\u002Fr\u002Fconfluentinc\u002Fcp-kafkacat\u002F) and [kafkacat docs](https:\u002F\u002Fdocs.confluent.io\u002Fcurrent\u002Fapp-development\u002Fkafkacat-usage.html) for more details:\n\n**Send messages using [here doc](http:\u002F\u002Ftldp.org\u002FLDP\u002Fabs\u002Fhtml\u002Fhere-docs.html):**\n\n```\ndocker run -it --rm \\\n        edenhill\u002Fkcat \\\n                -b kafka-broker:9092 \\\n                -t test \\\n                -K: \\\n                -P \u003C\u003CEOF\n\n1:{\"order_id\":1,\"order_ts\":1534772501276,\"total_amount\":10.50,\"customer_name\":\"Bob Smith\"}\n2:{\"order_id\":2,\"order_ts\":1534772605276,\"total_amount\":3.32,\"customer_name\":\"Sarah Black\"}\n3:{\"order_id\":3,\"order_ts\":1534772742276,\"total_amount\":21.00,\"customer_name\":\"Emma Turner\"}\nEOF\n```\n\n**Consume messages:**\n\n```\ndocker run -it --rm \\\n        edenhill\u002Fkcat \\\n           -b kafka-broker:9092 \\\n           -C \\\n           -f '\\nKey (%K bytes): %k\\t\\nValue (%S bytes): %s\\n\\Partition: %p\\tOffset: %o\\n--\\n' \\\n           -t test\n\nKey (1 bytes): 1\nValue (88 bytes): {\"order_id\":1,\"order_ts\":1534772501276,\"total_amount\":10.50,\"customer_name\":\"Bob Smith\"}\nPartition: 0    Offset: 0\n--\n\nKey (1 bytes): 2\nValue (89 bytes): {\"order_id\":2,\"order_ts\":1534772605276,\"total_amount\":3.32,\"customer_name\":\"Sarah Black\"}\nPartition: 0    Offset: 1\n--\n\nKey (1 bytes): 3\nValue (90 bytes): {\"order_id\":3,\"order_ts\":1534772742276,\"total_amount\":21.00,\"customer_name\":\"Emma Turner\"}\nPartition: 0    Offset: 2\n--\n% Reached end of topic test [0] at offset 3\n```\n\n\n## Run a mock Kafka cluster\n\nWith kcat you can spin up an ephemeral in-memory mock Kafka cluster\nthat you you can connect your Kafka applications to for quick\ntesting.\nThe mock cluster supports a reasonable subset of the Kafka\nprotocol, such as:\n\n * Producer\n * Idempotent Producer\n * Transactional Producer\n * Low-level consumer\n * High-level balanced consumer groups with offset commits\n * Topic Metadata and auto creation\n\n\nSpin the cluster by running kcat in the `-M` (for mock) mode:\n\n```bash\n\n# Create mock cluster with 3 brokers\n$ kcat -M 3\n...\nBROKERS=localhost:12345,localhost:46346,localhost:23599\n...\n```\n\nWhile kcat runs, let your Kafka applications connect to the mock cluster\nby configuring them with the `bootstrap.servers` emitted in the `BROKERS`\nline above.\n\nLet kcat run for as long as you need the cluster, then terminate it by\npressing `Ctrl-D`.\n\n\nSince the cluster runs all in memory, with no disk IO, it is quite suitable\nfor performance testing.\n","kcat 是一个基于 C 语言开发的非 JVM 的 Apache Kafka 生产者和消费者命令行工具。它支持从标准输入读取消息并发送到指定的 Kafka 主题，以及从 Kafka 主题消费消息并输出到标准输出。此外，kcat 还提供了对 Kafka >=0.9 版本高级平衡消费者的兼容性、集群元数据列表功能以及 Avro 消息反序列化支持。由于其轻量级设计（静态链接下大小不超过 150Kb）和高性能特性，kcat 非常适合用于 Kafka 数据流处理、测试及监控等场景。",2,"2026-06-11 03:07:20","top_language"]