i have been using below function save data hbase, can me how use updated api or example? given below code:
def getconnection():(connection, configuration) ={ val config = hbaseconfiguration.create() config.set("hbase.zookeeper.quorum", "node-01.algo,node-02.algo") config.set("hbase.master", "node-01.algo:60000") config.set("zk.connectiontimeout.ms", "10000") config.set("hbase.zookeeper.property.clientport", "2181") config.set("zookeeper.znode.parent", "/hbase-unsecure") val connection = connectionfactory.createconnection(config) (connection, config) } def addrecord(tablename: string, rowkey: string, family: string, qualifier: string, value: string) ={ val contuple = getconnection() val connection = contuple._1 val table = new htable(contuple._2, tablename) val theput= new put(bytes.tobytes(rowkey)) theput.add(bytes.tobytes(family), bytes.tobytes(qualifier), bytes.tobytes(value)) table.put(theput) table.close() connection.close() }
htable has been depracated, , asking me use table instead.
data frames implicitly support hive,
there library saving hbase,but have lot manual work spark on hbase
another option setup apache phoenix
Comments
Post a Comment