{"id":19154015,"url":"https://github.com/cjimti/notes-kafka","last_synced_at":"2025-08-14T12:36:43.730Z","repository":{"id":101890086,"uuid":"123243177","full_name":"cjimti/notes-kafka","owner":"cjimti","description":"Getting started with Kafka on Docker","archived":false,"fork":false,"pushed_at":"2018-02-28T16:55:08.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-12T04:12:26.909Z","etag":null,"topics":["docker","kafka","kafka-container","mq","tutorial"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cjimti.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":"2018-02-28T06:55:44.000Z","updated_at":"2019-07-15T12:20:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"23b4da55-6c26-4582-b492-cddd6783cf94","html_url":"https://github.com/cjimti/notes-kafka","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cjimti/notes-kafka","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjimti%2Fnotes-kafka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjimti%2Fnotes-kafka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjimti%2Fnotes-kafka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjimti%2Fnotes-kafka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cjimti","download_url":"https://codeload.github.com/cjimti/notes-kafka/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjimti%2Fnotes-kafka/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270421650,"owners_count":24580813,"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","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["docker","kafka","kafka-container","mq","tutorial"],"created_at":"2024-11-09T08:25:10.043Z","updated_at":"2025-08-14T12:36:43.679Z","avatar_url":"https://github.com/cjimti.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kafka Notes\n\nI do nearly all my development with local [Docker containers](https://hub.docker.com/u/cjimti/) these days.\nI moved from big bulky Vagrant managed VirtualBoxs to small simple\nDocker containers about a year ago and have not looked back. I run\ncontainers with individual `docker run` commands or use `docker-compose`\nfor slightly more complex setups.\n\nMy notes for getting started with [Kafka](https://kafka.apache.org/) on\na Mac. This is for development and testing. After experimenting with a\nfew other options [Confluent](https://www.confluent.io/) / [Confluent\nOpen Source](https://www.confluent.io/product/confluent-open-source/)\nseems to provide the best setup for my taste.\n\n### Architecture\n\n```plain\n     Stream Processors\n           \\ /\n Producers \u003c-\u003e Consumers\n           / \\\n        Connectors\n```\n\n### Setup\n\nRun [Zookeeper](https://zookeeper.apache.org/) , Kafka and\n[Schema-registry](https://docs.confluent.io/current/schema-registry/docs/index.html) as seperate Docker containers:\n\n```bash\ndocker run -d --name zookeeper \\\n    -p 2181:2181 \\\n    confluent/zookeeper\n    \ndocker run -d --name kafka \\\n    -p 9092:9092 \\\n    --link zookeeper:zookeeper \\\n    confluent/kafka\n    \ndocker run -d --name schema-registry \\\n    -p 8081:8081 --link zookeeper:zookeeper \\\n    --link kafka:kafka \\\n    confluent/schema-registry\n```\n\nOpen a shell into the running Kafka container\n\n`docker exec -it kafka`\n\nFrom inside the new Kafka container make a **test** topic:\n\n```bash\n/usr/bin/kafka-topics --create \\\n    --zookeeper zookeeper:2181 \\\n    --replication-factor 1 \\\n    --partitions 1 \\\n    --topic test\n```\n\nList available topics:\n\n```bash\n/usr/bin/kafka-topics --list \\\n    --zookeeper zookeeper:2181\n```\n\n### Test\n\nOpen two more terminals on your Mac. One will be used for a consumer and one will be used for a publisher\n\n##### Kafka Consumer\n\nListen for messages on the new **test** topic.\n\n```bash\ndocker exec -it kafka bash\n\n/usr/bin/kafka-console-consumer --zookeeper zookeeper:2181 \\\n    --topic test\n\n```\n\n##### Kafka Producer\n\nProduce messages for the test topic in a seperate terminal.\n\n```bash\ndocker exec -it kafka bash\n\n/usr/bin/kafka-console-producer --broker-list localhost:9092 \\\n    --topic test\n```\n\n## Docker Compose\n\nThe following is Docker compose version of this setup:\n\n```yaml\nversion: \"3.2\"\n\nnetworks:\n  kafkanet:\n    driver: bridge\n\nservices:\n  zookeeper:\n    image: \"confluent/zookeeper\"\n    container_name: \"zookeeper\"\n    networks:\n      - kafkanet\n    ports:\n      - 2881:2181\n\n  kafka:\n    image: \"confluent/kafka\"\n    container_name: \"kafka\"\n    depends_on:\n      - zookeeper\n    networks:\n      - kafkanet\n    ports:\n      - 9092:9092\n\n  schema-registry:\n    image: \"confluent/schema-registry\"\n    container_name: \"schema-registry\"\n    depends_on:\n      - kafka\n    networks:\n      - kafkanet\n    ports:\n      - 8081:8081\n         \n```\n\nThis Kafka notes repository contains a compose file. Clone and\nrun this stack with `docker-compose`.\n\n```bash\ngit clone git@github.com:cjimti/notes-kafka.git\n\ncd notes-kafka\n\ndocker-compose up\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjimti%2Fnotes-kafka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcjimti%2Fnotes-kafka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjimti%2Fnotes-kafka/lists"}