谁能告诉我如何使用kerberos从spark连接到HBase。我正在使用以下代码创建与HBase的连接,但仍然存在问题。
val genericMessage = messages.mapPartitions(iter => {
val context = TaskContext.get
logger.info((s"log - Process for partition: ${context.partitionId} "))
val partitionId: Int = context.partitionId
val conf: Configuration = HBaseConfiguration.create()
conf.set("hbase.zookeeper.quorum", ZOOKEEPER_QOURUM)
conf.set("hbase.rpc.timeout", "1800000")
conf.set("hbase.client.scanner.timeout.period", "1800000")
conf.set("hadoop.security.authentication", "kerberos")
import org.apache.hadoop.security.UserGroupInformation
UserGroupInformation.loginUserFromKeytab("customer@mail.com", keyTab)
val connection: Connection = ConnectionFactory.createConnection(conf)
val custTable Table = connection.getTable(TableName.valueOf("prod:cusotmer"))
val avroMessages = iter.map(msg => (msg._1, enrichment(rec._1, decodeBinaryToAvro(rec._2)))
connection.close()
custTable.close()
avroMessages
})
谢谢