近期版本(2024)
7.7.0 版的 schema-registry
操作参考:https://github.com/confluentinc/rest-utils/issues/367
schema-registry 需要 rest-utils,rest-utils 需要 common,common 需要 kafka
编译顺序:kafka -> common -> rest-utils -> schema-registry
1. 下载源码
到 rest-utils 的 pom.xml 中查看需要的 common 版本,到对应版本的 common 的 pom.xml 中查看需要的 kafka 版本——kafka 的版本在 gradle.properties 中,下载对应版本的 common 和 kafka,否则可能编译失败
git clone --depth 1 https://github.com/confluentinc/schema-registry.git
git clone --depth 1 https://github.com/confluentinc/rest-utils.git
git clone --branch v7.7.0-XXX --depth 1 https://github.com/confluentinc/common.git
git clone --branch v7.7.0-XXX-ccs --depth 1 https://github.com/confluentinc/kafka.git
2. 编译
-
kafka:
./gradlewAll publishToMavenLocal
若出现报错Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
,访问:https://raw.githubusercontent.com/gradle/gradle/v8.5.0/gradle/wrapper/gradle-wrapper.jar
,将下载的 jar 包放入./gradle/wrapper/
目录
-
common:
mvn install -Dmaven.test.skip=true
-
rest-utils:
mvn install -Dmaven.test.skip=true
-
schema-registry:
mvn package -DskipTests
3. 启动
- 修改 schema-registry 的配置文件
./config/schema-registry.properties
中的 kafka 地址
kafkastore.bootstrap.servers=PLAINTEXT://localhost:9092
- 在 schema-registry 目录中执行启动脚本
./bin/schema-registry-start ./config/schema-registry.properties
- 发送请求检查是否启动成功:
curl -X GET http://localhost:8081/subjects
早期版本(2020)
5.3.2 版的 schema-registry
操作参考:https://blog.csdn.net/weixin_41609807/article/details/105275389
schema-registry 需要 rest-utils,rest-utils 需要 common
编译顺序:common -> rest-utils -> schema-registry
1. 下载源码
git clone --branch 5.3.2-post --depth 1 https://github.com/confluentinc/common.git
git clone --branch 5.3.2-post --depth 1 https://github.com/confluentinc/rest-utils.git
git clone --branch 5.3.2-post --depth 1 https://github.com/confluentinc/schema-registry.git
2. 编译
-
common:
mvn install -Dmaven.test.skip=true
-
rest-utils:
mvn install -Dmaven.test.skip=true
-
schema-registry:
mvn install -Dmaven.test.skip=true
3. 启动
- 修改 schema-registry 目录下的配置文件
./config/schema-registry.properties
中的 zookeeper 地址
kafkastore.connection.url=localhost:2181
- 在 schema-registry 目录中执行启动脚本
./bin/schema-registry-start ./config/schema-registry.properties
- 发送请求检查是否启动成功:
curl -X GET http://localhost:8081/subjects