配置单元的kerberos模拟(直线)

f3temu5u  于 2021-06-28  发布在  Hive
关注(0)|答案(1)|浏览(392)

我试图模拟kerberos以连接到配置单元,但它给出了gss init异常。

UserGroupInformation ugi = kinit.generateKerberosTicket(configResources, keytab, principal);
serGroupInformation ugiProxy =  UserGroupInformation.createProxyUser("shashi", ugi.getCurrentUser());

ugiProxy.doAs( new PrivilegedExceptionAction<Void>(){
            @Override
            public Void run() throws Exception {
                Connection con = DriverManager.getConnection("jdbc:hive2://quickstart.cloudera:10000/default;principal=hive/quickstart.cloudera@CLOUDERA", "shashi", "");
                Statement stmt = con.createStatement();
                String sql = "show databases ";
                ResultSet res = stmt.executeQuery(sql);
                if (res.next()) {
                    System.out.println("DB names ---- >" +res.getString(1));
                }

                makeHiveJdbcConnection();
                return null;
            }

但有以下例外。

java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://quickstart.cloudera:10000/default;principal=hive/quickstart.cloudera@CLOUDERA: GSS initiate failed

关于这个问题有什么线索吗?

pu3pd22g

pu3pd22g1#

先取消设置hadoop代理用户,如果不先取消设置,beeline将失败

相关问题