我想将kafka日志文件移动到hadoop日志文件。所以我遵循HDFS连接器配置
/quickstart-hdfs.properties
name=hdfs-sink
connector.class=io.confluent.connect.hdfs.HdfsSinkConnector
tasks.max=1
topics=kafka_log_test
hdfs.url=hdfs://10.100.216.60:9000
flush.size=100000
hive.integration=true
hive.metastore.uris=thrift://localhost:9083
schema.compatibility=BACKWARD
format.class=io.confluent.connect.hdfs.parquet.ParquetFormat
partitioner.class=io.confluent.connect.hdfs.partitioner.HourlyPartitioner
/connect-avro-standalone.properties
bootstrap.servers=localhost:9092
key.converter=io.confluent.connect.avro.AvroConverter
key.converter.schema.registry.url=http://localhost:8081
value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schema.registry.url=http://localhost:8081
internal.key.converter=org.apache.kafka.connect.json.JsonConverter
internal.value.converter=org.apache.kafka.connect.json.JsonConverter
internal.key.converter.schemas.enable=false
internal.value.converter.schemas.enable=false
offset.storage.file.filename=/tmp/connect.offsets
当我运行HDFS连接器时,只需在.avro文件中写入avro架构。不是数据。
/kafka_log_test+0+0000000018+0000000020.avro
avro.schema {"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}],"connect.version":1,"connect.name":"myrecord"}
主题有大量数据,但汇合的hdfs连接器不会将数据移动到hdfs。
我该怎么做才能解决这个问题?
答案 0 :(得分:0)
根据定义,除非以其他方式压缩消息或使消息在偏移量18与20之间到期,否则包含名称0+0000000018+0000000020
的文件将具有2个分区0的记录。
您应该使用tojson
的{{1}}命令而不是avro-tools
。
或者您可以使用Spark或Pig读取该文件。
您可能还想验证连接器在启动后是否继续运行,因为在不是Hive Metastore Server的计算机上设置getmeta
会导致Connect任务失败。就像您为NameNode做的一样,URI应该是Hive的实际主机。
此外,无论如何都无法获得带有hive.metastore.uris=thrift://localhost:9083
的{{1}}文件扩展名,因此您可能要验证自己是否在正确的HDFS路径中查找。注意:在写入最终输出文件之前,将写入暂时连接到.avro
位置。