The “hub to spoke” pattern involves utilizing a single Schema Registry globally in an organization. The data sharing component involves only replicating schemas that are needed (or all) by the “spokes,” or individual business units
docker-compose up -d
Two CP clusters are running:
- Source/Hub Control Center available at http://localhost:19021
- Destination Control Center available at http://localhost:29021
- Source Schema Register availabel at http://localhost:8085
- Destination Contro Center availabel at http://localhost:8086
Three different schemas will be created:
- No context
curl -v -X POST -H "Content-Type: application/json" --data @data/test.avro http://localhost:8085/subjects/donuts/versions
- With
Hub
context (CPD)curl -v -X POST -H "Content-Type: application/json" --data @data/test.avro http://localhost:8085/subjects/:.CPD:orders/versions
- With
Spoke
context (LC)curl -v -X POST -H "Content-Type: application/json" --data @data/test.avro http://localhost:8085/subjects/:.LC:assets/versions
Check the context on the destination/hub Schema Registry
curl --silent -X GET http://localhost:8085/contexts
foo@bar:~$ [".",".CPD",".LC"]%
- Create a config file on Source Schem Registry host.
Docker-compose exec srcSchemaregistry /bin/bash
tee -a ~/config.txt <<EOF
schema.registry.url=http://destSchemaregistry:8086
EOF
- Create the exporter for CPD
schema-exporter --create --name CPD --subjects ":.CPD:*" \
--config-file ~/config.txt \
--schema.registry.url http://srcSchemaregistry:8085 --context-type NONE
- Create the exporter for LC
schema-exporter --create --name LC --subjects ":.LC:*" \
--config-file ~/config.txt \
--schema.registry.url http://srcSchemaregistry:8085 --context-type NONE
- On the container check the list
schema-exporter --list \
--schema.registry.url http://srcSchemaregistry:8085
- check the status
schema-exporter --get-status --name LC --schema.registry.url http://srcSchemaregistry:8085
schema-exporter --get-status --name CPD --schema.registry.url http://srcSchemaregistry:8085
curl --silent -X GET http://localhost:8086/contexts
curl --silent -X GET 'http://localhost:8086/subjects?subjectPrefix=:*:'
- Clean the docker cluster
docker-compose down -v