1) what is the Schema-registry
Hiện giờ mình mình cũng chưa hiểu rõ Schema-registry.
Mình có 1 số link tham khảo:
https://docs.confluent.io/platform/current/schema-registry/index.html#sr-overview
A few words about Avro
By default, Debezium writes the JSON-formatted data. This method is acceptable for sandboxes and small volumes of data but can be a problem in high-load databases. Avro is an excellent alternative to the JSON converter. It can serialize the record keys and values into binary form, which reduces the load on the I/O Apache Kafka subsystem.
However, you have to deploy a separate schema-registry (for storing schemas) to use Avro.
2) Install Schema-registry
2.1) Install Schema-registry On Kubernetes
Helm Chart:
https://github.com/confluentinc/cp-helm-charts
values.yaml
kafka:
bootstrapServers: "kafka-headless:9092"
bootstrapServers: Đây chính là IP hoặc hostname của cluster Kafka.
2.2) Fix error
Lúc mình run lên thì bị lỗi và bên dưới là lỗi
Caused by: io.confluent.kafka.schemaregistry.storage.exceptions.StoreInitializationException: The retention policy of the schema topic _schemas is incorrect. Expected cleanup.policy to be 'compact' but it is delete
giờ bạn chỉ cần change config của topic _schemas
là xong
1 là bạn change trên UI lenses.
mà mình thấy nó ko ăn hihi
2 là bạn exec vào pod kafka.
Sau đó run command bên dưới
kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics --entity-name _schemas --alter --add-config cleanup.policy=compact