升级到schema registry 2.0.1时出现问题

cuxqih21  于 2021-06-08  发布在  Kafka
关注(0)|答案(0)|浏览(351)

我们目前正在尝试从schema registry 1.0.1升级到2.0.1。我们看到,这是工作之前的升级与以下版本:Kafka2.10版本0.9.0.2.4.0.0,Kafkaavro序列化版本2.0.1,avro版本1.7.7
升级后,先前成功的相同请求现在失败,出现http 404错误:

[2016-07-26 10:11:05,748] INFO  - - [26/Jul/2016:10:11:05 +0000] "POST //subjects/thing-avro-key/versions HTTP/1.1" 404 49  4 (io.confluent.rest-utils.requests:77)

2016-07-26 11:23:00.908 b.s.d.executor [ERROR] 
org.apache.kafka.common.errors.SerializationException: Error registering Avro schema: "string"
Caused by: io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: HTTP 404 Not Found; error code: 404
        at io.confluent.kafka.schemaregistry.client.rest.RestService.sendHttpRequest(RestService.java:157) ~[stormjar.jar:?]

我们使用curl进行了检查,并能够使用以下示例发布模式:

curl -X POST -i -H "Content-Type: application/vnd.schemaregistry.v1+json"  --data '{"schema": "{\"type\": \"string\"}"}' http://localhost:8081/subjects/Kafka-value/versions

然后我们认为avro schema:“string”可能是问题所在,因此创建了thingkey schema,但仍然得到了类似的错误:

2016-07-26 11:47:31.347 b.s.d.executor [ERROR]
org.apache.kafka.common.errors.SerializationException: Error registering Avro schema: {"type":"record","name":"ThingKey","namespace":"com.x.platform.messages","doc":"A thing identifier for partitioning","fields":[{"name":"thing_id","type":{"type":"string","avro.java.string":"String"},"doc":"Thing identifier"}]}
Caused by: io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: HTTP 404 Not Found; error code: 404

我们正在使用以下代码发布消息:

ProducerRecord<String, SpecificRecordBase> producerRecord = new ProducerRecord<>(topic, getMessageKey(msg), extractAvroMessage(msg));
producer.send(producerRecord);

public SpecificRecordBase extractAvroMessage(KafkaMessage msg) 
public String getMessageKey(KafkaMessage msg)

非常感谢您的任何意见或建议。
谢谢,罗斯
更新:已修复-该问题是由于请求路径中的附加斜杠导致的,该斜杠在版本2.0.1中由于更严格的验证而导致失败。详细信息:https://github.com/confluentinc/schema-registry/issues/388

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题