Sparkcode 将 Hive 与 kerberos keytab 连接
我正在尝试使用 Spark 2.4.5 使用 kerberos keytab 身份验证连接到 Hive 到目前为止,我已经开发了以下代码,我想将其转换为数据帧。 我该如何做到这一点,除此之外还有其他方法可以使用 kerberos keytab 连接到 Hive 吗?
val conf: org.apache.hadoop.conf.Configuration = new org.apache.hadoop.conf.Configuration()
System.setProperty("java.security.krb5.conf", krbloc)
conf.set("hadoop.security.authentication", "kerberos")
conf.set("hadoop.security.authorization", "true")
UserGroupInformation.setConfiguration(conf)
UserGroupInformation.loginUserFromKeytab("[email protected]",
keytab_path)
Class.forName("org.apache.hive.jdbc.HiveDriver")
val con = DriverManager.getConnection(url3)
con.prepareStatement("select * from table").executeQuery
I am trying to connect to Hive using kerberos keytab authentication using spark 2.4.5
Till now i have developed the below code and i want to convert the same to a dataframe.
How can i do that and is there any other approach to connect to Hive with kerberos keytab apart from this?
val conf: org.apache.hadoop.conf.Configuration = new org.apache.hadoop.conf.Configuration()
System.setProperty("java.security.krb5.conf", krbloc)
conf.set("hadoop.security.authentication", "kerberos")
conf.set("hadoop.security.authorization", "true")
UserGroupInformation.setConfiguration(conf)
UserGroupInformation.loginUserFromKeytab("[email protected]",
keytab_path)
Class.forName("org.apache.hive.jdbc.HiveDriver")
val con = DriverManager.getConnection(url3)
con.prepareStatement("select * from table").executeQuery
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论