Discover Excellence

Install Apache Kafka Using Docker Compose Laptrinhx

deploy apache kafka With docker compose laptrinhx
deploy apache kafka With docker compose laptrinhx

Deploy Apache Kafka With Docker Compose Laptrinhx Step 2: run docker compose. open a terminal in the directory where the docker compose.yml file is located and run the following command to start the kafka and zookeeper containers: docker compose. Let’s start the kafka server by spinning up the containers using the docker compose command: $ docker compose up d. creating network "kafka default" with the default driver. creating kafka zookeeper 1 done. creating kafka kafka 1 done. now, let’s use the nc command to verify that both the servers are listening on the respective ports:.

install Apache Kafka Using Docker Compose Laptrinhx
install Apache Kafka Using Docker Compose Laptrinhx

Install Apache Kafka Using Docker Compose Laptrinhx To consume messages from the topic, you can use the kafka console consumer. run the following command: docker compose exec kafka kafka console consumer topic test topic from beginning bootstrap server localhost:9092. this command will output the messages sent to ‘test topic’, including the message we sent earlier:. And you should see the following: copy. all streams. lead to kafka. enter a ctrl c to close the consumer and then type exit to close the docker shell. to shut down the container, run. copy. docker compose down v. in this tutorial, learn how to run a kafka broker locally on your laptop, with step by step instructions and supporting code. Connect to kafka shell. once zookeeper and kafka containers are running, you can execute the following terminal command to start a kafka shell: docker exec it kafka bin sh. just replace kafka with the value of container name, if you’ve decided to name it differently in the docker compose.yml file. Step 2: start kafka containers. open a terminal and navigate to the directory where your docker compose.yml file is located. run the following command to start the kafka containers: docker compose up d. the d flag runs the containers in detached mode, allowing you to continue working in the same terminal.

Comments are closed.