1

我们目前正在尝试从 schema-registry 1.0.1 升级到 2.0.1。我们看到这在升级之前使用以下版本工作:kafka_2.10 版本 0.9.0.2.4.0.0、kafka-avro-serializer 版本 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

4

0 回答 0