apache kafka – Is there a way to set default compatibility level for Confluent Schema Registry?

Yes, there is a way to set the default compatibility level for Confluent Schema Registry without having to make a REST API call. You can do this by setting the compatibility.level environment variable when you start the Schema Registry container.

For example, if you are using the Confluent Schema Registry image from Docker Hub, you could start the Schema Registry container with the following command:

docker run -p 8081:8081 -e compatibility.level=FORWARD_TRANSITIVE confluentinc/cp-schema-registry:latest

This will start the Schema Registry container with the default compatibility level set to FORWARD_TRANSITIVE.

You can also set the compatibility.level environment variable in the Kubernetes manifest for your Schema Registry deployment. For example, the following Kubernetes manifest deploys a Schema Registry deployment with the default compatibility level set to FORWARD_TRANSITIVE:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: schema-registry
spec:
  replicas: 1
  selector:
    matchLabels:
      app: schema-registry
  template:
    metadata:
      labels:
        app: schema-registry
    spec:
      containers:
      - name: schema-registry
        image: confluentinc/cp-schema-registry:latest
        env:
        - name: compatibility.level
          value: FORWARD_TRANSITIVE
      ports:
      - containerPort: 8081

Whichever method you choose, setting the compatibility.level environment variable is a simple way to set the default compatibility level for Confluent Schema Registry without having to make a REST API call.

Note: It is important to note that changing the default compatibility level can have implications for your Kafka ecosystem. For example, if you change the compatibility level to FORWARD_TRANSITIVE and you have existing consumers that are not able to read schemas from the Schema Registry, those consumers will not be able to read new messages from Kafka. For this reason, it is important to carefully consider the implications of changing the default compatibility level before you do so

Read more here: Source link