git clone https://github.com/confluentinc/schema-registry.git
cd schema-registry
git checkout tags/v2.0.0
mvn clean package -DskipTests
vi config/schema-registry.properties
设置kafkastore.connection.url为zookeeper的连接地址
nohup ./bin/schema-registry-start ./config/schema-registry.properties &
查看schema-registry进程
[adadmin@s11 ~]$ jps
26995 NodeManager
74580 Kafka
61079 SchemaRegistryMain
62615 Jps
126392 Worker
26843 DataNode
118141 QuorumPeerMain
#producer 注意:输入一条数据才enter一次,退出使用ctrl + C
./bin/kafka-avro-console-producer –broker-list 10.121.93.50:9092 –topic test –property value.schema='{“type”:”record”,”name”:”myrecord”,”fields”:[{“name”:”f1″,”type”:”string”}]}’
{“f1”: “value1”}
{“f1”: “value2”}
{“f1”: “value3”}
./bin/kafka-avro-console-consumer –broker-list 10.121.93.50:9092 –topic test-avro –from-beginning