Apache Phoenix on Spark - Unable to insert to Phoenix HBase Tables/Need suggestion for Best practice -
i have table structure below.
trans_count
start_time, end_time, count 00:00:01 00:00:10 1000 00:00:11 00:00:20 800
spark listens events kafka , grouping 10 seconds , have insert phoenix hbase table.
after 10 seconds, have first check if start_time,end_time combination in table. if there, have take existing count , add new count , upsert again.
upsert trans_count(start_time, end_time, count) select start_time, end_time, count? trans_count start_time = ? , end_time = ?
if no rows upserted in above statement, upsert data.
in apache storm, able create phoenix connection object in configure method , able use same connection once every 10 seconds upsert.
in spark, not create connection object , use same object every object in rdd. output spark javadstream> start_time, end_time, count keys in map.
i end creating connection object every iteration of rdd, feel not right way. have read phoenix connections light weight creating connection object every rdd seems not right way.
i read blogs related stuff, not getting going. kindly help.
note : appliation built in java.
solution:
instead of creating connection per objectin rdd, create connection per partition in rdd , use objects.
Comments
Post a Comment