简体   繁体   English

kafka连接HDFS接收器连接器失败

[英]kafka connect hdfs sink connector is failing

I'm trying to use Kafka connect sink to write files from Kafka to HDFS. 我正在尝试使用Kafka connect sink将文件从Kafka写入HDFS。

My properties looks like: 我的属性如下:

connector.class=io.confluent.connect.hdfs.HdfsSinkConnector
flush.size=3
format.class=io.confluent.connect.hdfs.parquet.ParquetFormat
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
schema.compatability=BACKWARD
key.converter.schemas.enabled=false
value.converter.schemas.enabled=false
schemas.enable=false

And When I'm trying to run the connector I got the following exception: 当我尝试运行连接器时,出现以下异常:

org.apache.kafka.connect.errors.DataException: JsonConverter with schemas.enable requires "schema" and "payload" fields and may not contain additional fields. org.apache.kafka.connect.errors.DataException:具有schemas.enable的JsonConverter需要“ schema”和“ payload”字段,并且可能不包含其他字段。 If you are trying to deserialize plain JSON data, set schemas.enable=false in your converter configuration. 如果尝试反序列化纯JSON数据,请在转换器配置中设置schemas.enable = false。

I'm using Confluent version 4.0.0. 我正在使用Confluent版本4.0.0。

Any suggestions please? 有什么建议吗?

My understanding of this issue is that if you set schemas.enable=true, you tell kafka that you would like to include the schema into messages that kafka must transfer. 我对这个问题的理解是,如果您设置schemas.enable = true,则会告诉kafka您希望将架构包含在kafka必须传输的消息中。 In this case, a kafka message does not have a plain json format. 在这种情况下,kafka消息没有纯json格式。 Instead, it first describes the schema and then attaches the payload (ie, the actual data) that corresponds to the schema (read about AVRO formatting). 相反,它首先描述架构,然后附加与该架构相对应的有效负载(即,实际数据)(请参阅有关AVRO格式的信息)。 And this leads to the conflict: On the one hand you've specified JsonConverter for your data, on the other hand you ask kafka to include the schema into messages. 这导致了冲突:一方面,您为数据指定了JsonConverter,另一方面,您要求kafka将模式包含在消息中。 To fix this, you can either use AvroConverter with schemas.enable = true or JsonCOnverter with schemas.enable=false. 要解决此问题,可以将AvroConverter与schemas.enable = true一起使用,也可以将JsonCOnverter与schemas.enable = false一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM