Schema migration
Replicate schemas to the target Schema Registry.
Avro, Protobuf, and JSON Schema records depend on subjects registered in Schema Registry. A consumer on the target Kafka cluster cannot deserialize replicated data unless the same schemas exist on the target Schema Registry. Schema replication must keep pace with data replication.
Enable features.schemaMapping to copy schemas referenced by replicated records. Configure source.registry and target.registry under Schema Registry connectivity and authentication. Limit schema replication with schemaMappings.topics if needed. For supported types and registry caches, see the Advanced section below.
Prerequisites
Kafka connectivity and authentication configured
Topic selection and data routing configured
Example
Use the following pipeline configuration:
name: "my_pipeline"
features:
schemaMapping: enabled
source:
kafka:
common:
"bootstrap.servers": "source:9092"
consumer:
"group.id": "my-k2k-group"
registry:
config:
"schema.registry.url": "http://source-sr:8081"
target:
kafka:
common:
"bootstrap.servers": "target:9092"
registry:
config:
"schema.registry.url": "http://target-sr:8081"
schemaMappings:
topics:
- pattern: "orders.*"
key: enabled
value: enabled
replication:
- source:
topic: "orders.*"
- sink:
topic: source
partition: sourceConfiguration keys
Feature toggle
features.schemaMapping
Replicate schemas to the target Schema Registry
No
disabled
Replicator
Schema Registry connections
source.registry
Source Schema Registry connection
Conditional
(none)
Replicator
source.registry.config
Schema Registry client properties
Conditional
{}
Replicator
target.registry
Target Schema Registry connection
Conditional
(none)
Replicator
target.registry.config
Schema Registry client properties
Conditional
{}
Replicator
schemaMappings
schemaMappings.topics[].pattern
Regex selecting topics this rule applies to
No
.*
Replicator
schemaMappings.topics[].key
Replicate schemas referenced by record keys
No
enabled
Replicator
schemaMappings.topics[].value
Replicate schemas referenced by record values
No
enabled
Replicator
Schema Registry client properties
Any standard Schema Registry client property can be set under registry.config, prefixed with schema.registry (for example schema.registry.url). For the full property list, see the Schema Registry client configuration reference.
Commonly used keys:
schema.registry.url
Schema Registry URL
schema.registry.basic.auth.credentials.source
Basic auth source (USER_INFO, SASL_INHERIT, etc.)
schema.registry.basic.auth.user.info
Credentials as user:password
schema.registry.ssl.truststore.location
Truststore path for TLS
schema.registry.ssl.truststore.password
Truststore password
Advanced
Supported schema types
Add custom schema types to supportedTypes if your Schema Registry uses formats not in the default list.
schemaMappings.supportedTypes
Schema types K2K can replicate
No
AVRO, JSON, PROTOBUF, YANG
Replicator
Registry caches
K2K caches schemas locally to reduce Schema Registry round trips.
source.registry.cacheSize
Maximum schemas cached locally on the source side
No
31
Replicator
target.registry.cacheSize
Maximum schemas cached locally on the target side
No
31
Replicator
For custom HTTP headers on Schema Registry requests, see Schema Registry connectivity and authentication.
Last updated
Was this helpful?

