Htable和.add depracated,我应该用什么来代替呢?这是scala中的
我一直在使用下面的函数将数据保存到Hbase中,有人可以帮助我如何使用更新的api或一些示例吗?下面是我的代码:Htable和.add depracated,我应该用什么来代替呢?这是scala中的,scala,hbase,Scala,Hbase,我一直在使用下面的函数将数据保存到Hbase中,有人可以帮助我如何使用更新的api或一些示例吗?下面是我的代码: def getConnection():(Connection, Configuration) ={ val config = HBaseConfiguration.create() config.set("hbase.zookeeper.quorum", "node-01.algo,node-02.algo") config.set("hbase.mast
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已被取消权限,并要求我改用Table。数据帧仅隐式支持 有用于保存到hbase的库,但您必须做大量手动工作 另一个选项是设置