{"id":15343683,"url":"https://github.com/spacewander/kafka-cli","last_synced_at":"2026-03-06T18:39:22.599Z","repository":{"id":43471132,"uuid":"230066991","full_name":"spacewander/kafka-cli","owner":"spacewander","description":"Fork from github.com/shafreeck/kafka-cli. The origin one doesn't continue so I fork it. Have no plan to submit back so I don't use the Fork button to fork it.","archived":false,"fork":false,"pushed_at":"2024-12-12T02:56:32.000Z","size":288,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-12T03:29:21.308Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spacewander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-25T08:06:05.000Z","updated_at":"2024-12-12T02:56:30.000Z","dependencies_parsed_at":"2024-04-22T04:39:24.301Z","dependency_job_id":"01af5a4b-0190-467e-8a2b-03db09152f0c","html_url":"https://github.com/spacewander/kafka-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Fkafka-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Fkafka-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Fkafka-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Fkafka-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacewander","download_url":"https://codeload.github.com/spacewander/kafka-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230510528,"owners_count":18237535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T10:48:33.386Z","updated_at":"2026-03-06T18:39:22.472Z","avatar_url":"https://github.com/spacewander.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kafka-cli\n\n## Install\n\n```\ngo get github.com/spacewander/kafka-cli\n```\n\n## Usage\n\n```\nkafka-cli is a console util tool to access kafka cluster\n\nUsage:\n  kafka-cli [command]\n\nAvailable Commands:\n  consume     consume topic from kafka\n  monitor     display kafka cluster metrics, TODO\n  produce     produce message\n  topics      list all topics\n\nFlags:\n      --brokers string                    broker list, delimited by comma (default \"127.0.0.1:9092\")\n      --buffersize int                    internal channel buffer size (default 256)\n      --clientid string                   a user-provided string sent with every request to the brokers for logging debugging, and auditing purposes (default \"kafka-cli\")\n      --config string                     config file (default is $HOME/.kafka-cli.yaml)\n      --metadata.refresh duration         metadata refresh frequency (default 10m0s)\n      --metadata.retry.backoff duration   backoff between retrying (default 250ms)\n      --metadata.retry.max int            total number to request metadata when the cluster has a leader election (default 3)\n      --net.dialtimeout duration          timeout of dialing to brokers (default 30s)\n      --net.keepalive duration            keepalive period, 0 means disabled\n      --net.maxopenrequests int           how many outstanding requests a connection is allowed to have before sending on it blocks (default 5)\n      --net.readtimeout duration          timeout of reading messages (default 30s)\n      --net.writetimeout duration         timeout of writing messages (default 30s)\n  -v, --verbose                           print log messages\n      --zookeepers string                 zookeeper server list, delimited by comma, only use when operate topic (default \"127.0.0.1:9093\")\n\nUse \"kafka-cli [command] --help\" for more information about a command.\n```\n\n## Authentication\n\nSeveral environment variables can be used to authentica the client.\n* `KAFKA_CLI_USER`: username for SASL/PLAIN  or SASL/SCRAM authentication\n* `KAFKA_CLI_PASSWORD`: password  for SASL/PLAIN  or SASL/SCRAM authentication\n* `KAFKA_CLI_CLIENT_ID`: the client ID, default to `kafka-cli`, this variable can be overwrited by --connectid option\n\n## List all topics\n\n```\n./kafka-cli --brokers 127.0.0.1:9092 topics\ntopic           partition[replicaid...]:offset ...\n--------------------------------------------------\nunexpected-logs 0[0]:12285581\noutput-pod2     0[0]:9725580\ndefault-topic   0[0]:13971093\ntest            0[0]:5\nfilebeats       0[0]:12488893   1[0]:11301355   2[0]:11301353   3[0]:11301197   4[0]:11301197   5[0]:11301197   6[0]:11301200   7[0]:11301356\n```\n\n## Create topics\n\n```\n./kafka-cli --brokers 127.0.0.1:9092 --zookeepers 127.0.0.1:2181 topics create  t1 t2 t3 --partitions 10 --replicas 3\n```\n\n## Delete topics\n\n```\n./kafka-cli --brokers 127.0.0.1:9092 --zookeepers 127.0.0.1:2181 topics delete  t1 t2 t3\n```\n\n## Consume topics\n\n```\n./kafka-cli --brokers 127.0.0.1:9092 consume default-topic unexpected-logs\n```\n\n## Produce messages\n\n```\n./kafka-cli --brokers=127.0.0.1:9092 produce test /tmp/x.txt [key]\n```\n\nRead bytes from the given file (/tmp/x.txt) and send them to topic (test).\nThe optional key argument can be specified after the filename.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacewander%2Fkafka-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacewander%2Fkafka-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacewander%2Fkafka-cli/lists"}