import java.lang.ProcessBuilder
import java.io.PrintWriter
//resets your kerberos login
val p1 = Runtime.getRuntime.exec("kdestroy")
p1.waitFor
//executes kinit,
val p = Runtime.getRuntime.exec("kinit")
val stdin = p.getOutputStream
val pw =new PrintWriter(stdin)
//val pwd = get_password() //get_password() is a function to get your password from a file, or wherever
pw.println(pwd) // you could put your password here , but plain text passwords are generally frowned upon
pw.close
p.waitFor
2条答案
按热度按时间lp0sw83n1#
假设你有一个Spark壳打开,你不想退出,然后重新扭结,你可以这样做:
2w3kk1z52#
您应该在初始化spark shell或提交spark应用程序(spark submit)之前运行kinit命令。另一个选项是使用keytab获取kerberos票证,然后像这样运行spark程序
当做,