2025年flume读取kafka写hive

flume读取kafka写hive注意 需要提前创建 hive 接收信息的表 test0617 否则报错 Caused by NoSuchObject message rt1 cr kafka t test0707 table not found 配置文件 localAgent sources skafka localAgent sinks

大家好,我是讯享网,很高兴认识大家。

注意:需要提前创建hive接收信息的表--test0617

否则报错:

Caused by: NoSuchObjectException(message:rt1.cr_kafka_t_test0707 table not found)

讯享网

配置文件

localAgent.sources = skafka
localAgent.sinks = shive
localAgent.channels = k2h

#k2h shive
localAgent.sinks.shive.channel = k2h
#skafka k2h
localAgent.sources.skafka.channels = k2h

 

#describe the source
localAgent.sources.skafka.type = org.apache.flume.source.kafka.KafkaSource
localAgent.sources.skafka.zookeeperConnect = localhost:2181
localAgent.sources.skafka.batchSize = 1000
localAgent.sources.skafka.batchDurationMillis = 500

localAgent.sources.skafka.kafka.bootstrap.servers = localhost:9092
localAgent.sources.skafka.kafka.topics = mytopic0617
localAgent.sources.skafka.kafka.consumer.group.id = kafka007
localAgent.sources.skafka.kafka.consumer.auto.offset.reset = earliest

 

#use a channel which buffers events in memory
localAgent.channels.k2h.type = memory
localAgent.channels.k2h.capacity = 1000

localAgent.channels.k2h.transactionCapacity = 1000


讯享网

 

#sinks type  hive
localAgent.sinks.shive.type = hive
localAgent.sinks.shive.channel = k2h
localAgent.sinks.shive.hive.metastore = thrift://localhost:9083
localAgent.sinks.shive.hive.database = database1
localAgent.sinks.shive.hive.table = test0617
localAgent.sinks.shive.hive.partition = %Y-%m-%d
localAgent.sinks.shive.batchSize = 500
localAgent.sinks.shive.useLocalTimeStamp = true
localAgent.sinks.shive.round = true
localAgent.sinks.shive.roundValue = 24
localAgent.sinks.shive.roundUnit = hour
localAgent.sinks.shive.serializer = JSON

启动异常:

org.apache.flume.ChannelException: Put queue for MemoryTransaction of capacity 1000 full, consider committing more frequently, increasing capacity or increasing thread count

 

解决,入上配置中标红部分修改之后,异常解决。

需要启动hdfs、hive、mysql、zk、kafka、flume,注意启动顺序。

 

小讯
上一篇 2025-04-07 14:36
下一篇 2025-01-08 14:20

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/59529.html