Apache Kafka – Terefas básicas admin, Troubleshooting e Logs



Apache Kafka – Terefas básicas admin, Troubleshooting e Logs

Apache Kafka - Terefas básicas admin, Troubleshooting e Logs

Fundamentos Apache Kafka na visão Admin.

O vídeo foi feito com a idéia de compartilhar o meu conhecimento adquirido, trabalhando com Kafka, para colegas de trabalho e alguns amigos.
Eu mesmo editei o vídeo, sem muito conhecimento na ferramenta.

Entendo na pratica como realizar Troubleshooting, quais logs devemos olhar no nosso Cluster do Kafka, por onde devemos começar.

Gravado com OBS.
SO: Ubuntu 22.04.2 LTS
Editor: Kdenlive

Para facilitar, eu estou publicando todo material no meu github:

https://github.com/mordp1/espetinhodekafka/tree/main/Day10

## Comandos:

Estou utilizando um container neste momento, indico instalar o Docker ou Docker Desktop

### Baixe o repositorio

“`bash
$ git clone https://github.com/mordp1/espetinhodekafka
$ cd espetinhodekafka/day10
“`

### Criando nossa imagem

“`bash
$ docker build -t espetinhokafka:1.0 -f DockerFile .
“`

### Subindo o container

“`bash
$ docker run –rm -it -p 9092:9092 espetinhokafka:1.1
“`

### Iniciar o Zookeeper

“`bash
$ kafka_2.13-3.4.0/bin/zookeeper-server-start.sh -daemon kafka_2.13-3.4.0/config/zookeeper.properties
“`

### Iniciar o Kafka

“`bash
$ kafka_2.13-3.4.0/bin/kafka-server-start.sh -daemon kafka_2.13-3.4.0/config/server.properties
“`

### Criar topico

“`bash
$ kafka_2.13-3.4.0/bin/kafka-topics.sh –bootstrap-server localhost:9092 –topic topic1 –create –partitions 3 –replication-factor 1
“`

### Verificar o diretório de logs

“`bash
$ cd /opt/kafka_2.13-3.4.0/logs
“`

### Criando Cluster

Utilizaremos o exemplo da Conduktor.

https://www.conduktor.io/kafka/how-to-start-kafka-using-docker/

### Subindo
“`bash
$ docker-compose -f zk-multiple-kafka-multiple.yml up -d
“`
### Conectando no shell do container kafka1
“`bash
$ docker exec -it kafka1 /bin/bash
“`
### Criando os 3 topicos dentro do container
“`bash
$ kafka-topics –bootstrap-server kafka1:19092 –topic topic1 –create –partitions 1 –replication-factor 1

$ kafka-topics –bootstrap-server kafka1:19092 –topic topic2 –create –partitions 2 –replication-factor 2

$ kafka-topics –bootstrap-server kafka1:19092 –topic topic3 –create –partitions 3 –replication-factor 3

$ kafka-topics –bootstrap-server kafka1:19092 –topic topic10 –create –partitions 10 –replication-factor 3
“`
### Para executar os comandos fora do container, precisa ter os binários do Kafka:
“`bash
$ wget -c https://dlcdn.apache.org/kafka/3.4.0/kafka_2.13-3.4.0.tgz -O – | tar -xz
$ cd kafka_2.13-3.4.0
“`
### Comandos para cirar topicos fora do container
“`bash
$ bin/kafka-topics.sh –bootstrap-server localhost:9092 –topic topic1 –create –partitions 1 –replication-factor 1

$ bin/kafka-topics.sh –bootstrap-server localhost:9092 –topic topic2 –create –partitions 2 –replication-factor 2

$ bin/kafka-topics.sh –bootstrap-server localhost:9092 –topic topic3 –create –partitions 3 –replication-factor 3

$ bin/kafka-topics.sh –bootstrap-server localhost:9092 –topic topic10 –create –partitions 10 –replication-factor 3
“`

### Describe todos os topicos
“`bash
$ bin/kafka-topics.sh –bootstrap-server localhost:9092 –describe
“`

#apache #kafka #apachekafka #data #datastreams #kafkaadministration #kafkaadmin
#stream #technology #linux #devops #sre #engenharia #engenhariadesoftware #dev #kafkaconnect #troubleshooting