Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问一下用spark跨集群的访问开启了kerberos的hbase #33

Open
ighack opened this issue Aug 23, 2021 · 0 comments
Open

请问一下用spark跨集群的访问开启了kerberos的hbase #33

ighack opened this issue Aug 23, 2021 · 0 comments

Comments

@ighack
Copy link

ighack commented Aug 23, 2021

请问一下。如果想把集群B的hbase的数据读取到集群A中该怎么操作啊

我想到的是

sparkSession.sparkContext.addFile("hdfs://nameservice1/krb5B.conf")
sparkSession.sparkContext.addFile("hdfs://nameservice/clusterB.keytab")

val krb5Path = SparkFiles.get("krb5B.conf")
val principal = config.getJSONObject("auth").getString("principal")
val keytab = SparkFiles.get("clusterB.keytab")

System.setProperty("java.security.krb5.conf", krb5Path);
Configuration conf = new Configuration();
conf.set("hadoop.security.authentication", "Kerberos");
UserGroupInformation.setConfiguration(conf);
UserGroupInformation.loginUserFromKeytab(principal, keytabPath)

在读取集群B的之前先loginUserFromKeytab一下。这里使用集群B的配制
在读取成一个dataframe之后。在用集群A的配制loginUserFromKeytab一下。

不知道这样是否可行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant