如何获取Schema Registry URL与API Key?Confluent平台操作疑问
获取Confluent Schema Registry URL与API Key的操作指南
1. 确认环境并启用Schema Registry
- Confluent Cloud(托管服务):
- 登录控制台后进入目标环境(Environment),点击左侧的Cluster进入对应Kafka集群页面
- 顶部导航栏找Schema Registry选项卡——如果看不到,说明该集群未启用此服务,点击Enable Schema Registry完成启用即可
- 自托管Confluent Platform:
- Schema Registry默认随平台部署,直接进入Confluent Control Center即可找到管理入口
2. 获取Schema Registry URL
- Confluent Cloud:启用后在Schema Registry页面的Settings板块,直接显示官方分配的URL
- 自托管环境:查看Schema Registry配置文件
schema-registry.properties,listeners配置项对应的地址就是URL(如http://localhost:8081)
3. 生成/获取API Key
- Confluent Cloud:
- 在Schema Registry页面的API Keys板块,点击Create API Key,填写描述后即可生成Key和Secret(Secret仅显示一次,务必保存)
- 自托管环境:
- 用Confluent CLI执行命令:
confluent api-key create --resource schema-registry - 或在Control Center的Schema Registry管理页,进入Security > API Keys,点击Add API Key生成
- 用Confluent CLI执行命令:
4. Python连接配置示例
使用confluent-kafka库连接的基础代码如下:
from confluent_kafka.schema_registry import SchemaRegistryClient schema_registry_config = { "url": "你的Schema Registry URL", "basic.auth.user.info": "API Key:API Secret" } client = SchemaRegistryClient(schema_registry_config)
内容的提问来源于stack exchange,提问作者Maya Stein
相关产品推荐
相关产品推荐

