Confluent Schema Registry 管理
Schema Registry 为 Kafka 消息提供 Avro/Protobuf/JSON Schema 的集中存储和兼容性检查。它用 REST API 管理 subject、版本和兼容策略,元数据存在 Kafka 内部 topic。
curl -s http://schema-registry:8081/subjects
curl -s http://schema-registry:8081/subjects/app-value/versions
curl -s http://schema-registry:8081/subjects/app-value/versions/latest
curl -s http://schema-registry:8081/schemas/ids/1
curl -s http://schema-registry:8081/config
注册 schema:
curl -X POST http://schema-registry:8081/subjects/app-value/versions \
-H 'Content-Type: application/vnd.schemaregistry.v1+json' \
-d '{"schema":"{\"type\":\"record\",\"name\":\"App\",\"fields\":[{\"name\":\"id\",\"type\":\"int\"}]}"}'
curl -X PUT http://schema-registry:8081/config/app-value \
-H 'Content-Type: application/vnd.schemaregistry.v1+json' \
-d '{"compatibility":"BACKWARD"}'
常见模式:BACKWARD、FORWARD、FULL、NONE。
?permanent=true,且不可恢复。kafka-broker — 底层 Kafkaksql — 使用 schema 的流处理kcat — 消息验证合上页面,先回答,再展开对照。
?permanent=true,且不可恢复。