Search in sources :

Example 1 with QueryServer

use of org.apache.phoenix.queryserver.server.QueryServer in project phoenix by apache.

the class HttpParamImpersonationQueryServerIT method startQueryServer.

private static void startQueryServer() throws Exception {
    PQS = new QueryServer(new String[0], UTIL.getConfiguration());
    // Get the PQS ident for PQS to use
    final UserGroupInformation ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(PQS_PRINCIPAL, KEYTAB.getAbsolutePath());
    PQS_EXECUTOR = Executors.newSingleThreadExecutor();
    // Launch PQS, doing in the Kerberos login instead of letting PQS do it itself (which would
    // break the HBase/HDFS logins also running in the same test case).
    PQS_EXECUTOR.submit(new Runnable() {

        @Override
        public void run() {
            ugi.doAs(new PrivilegedAction<Void>() {

                @Override
                public Void run() {
                    PQS.run();
                    return null;
                }
            });
        }
    });
    PQS.awaitRunning();
    PQS_PORT = PQS.getPort();
    PQS_URL = ThinClientUtil.getConnectionUrl("localhost", PQS_PORT) + ";authentication=SPNEGO";
}
Also used : PrivilegedAction(java.security.PrivilegedAction) QueryServer(org.apache.phoenix.queryserver.server.QueryServer) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Example 2 with QueryServer

use of org.apache.phoenix.queryserver.server.QueryServer in project drill by apache.

the class QueryServerEnvironment method configureAndStartQueryServer.

private void configureAndStartQueryServer(boolean tls) throws Exception {
    PQS = new QueryServer(new String[0], UTIL.getConfiguration());
    // Get the PQS ident for PQS to use
    final UserGroupInformation ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(PQS_PRINCIPAL, KEYTAB.getAbsolutePath());
    PQS_EXECUTOR = Executors.newSingleThreadExecutor();
    // Launch PQS, doing in the Kerberos login instead of letting PQS do it itself (which would
    // break the HBase/HDFS logins also running in the same test case).
    PQS_EXECUTOR.submit(new Runnable() {

        @Override
        public void run() {
            ugi.doAs(new PrivilegedAction<Void>() {

                @Override
                public Void run() {
                    PQS.run();
                    return null;
                }
            });
        }
    });
    PQS.awaitRunning();
    PQS_PORT = PQS.getPort();
    PQS_URL = ThinClientUtil.getConnectionUrl(tls ? "https" : "http", "localhost", PQS_PORT) + ";authentication=SPNEGO" + (tls ? ";truststore=" + TlsUtil.getTrustStoreFile().getAbsolutePath() + ";truststore_password=" + TlsUtil.getTrustStorePassword() : "");
    LOG.debug("Phoenix Query Server URL: {}", PQS_URL);
}
Also used : PrivilegedAction(java.security.PrivilegedAction) QueryServer(org.apache.phoenix.queryserver.server.QueryServer) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Example 3 with QueryServer

use of org.apache.phoenix.queryserver.server.QueryServer in project phoenix by apache.

the class SecureQueryServerIT method startQueryServer.

private static void startQueryServer() throws Exception {
    PQS = new QueryServer(new String[0], UTIL.getConfiguration());
    // Get the PQS ident for PQS to use
    final UserGroupInformation ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(PQS_PRINCIPAL, KEYTAB.getAbsolutePath());
    PQS_EXECUTOR = Executors.newSingleThreadExecutor();
    // Launch PQS, doing in the Kerberos login instead of letting PQS do it itself (which would
    // break the HBase/HDFS logins also running in the same test case).
    PQS_EXECUTOR.submit(new Runnable() {

        @Override
        public void run() {
            ugi.doAs(new PrivilegedAction<Void>() {

                @Override
                public Void run() {
                    PQS.run();
                    return null;
                }
            });
        }
    });
    PQS.awaitRunning();
    PQS_PORT = PQS.getPort();
    PQS_URL = ThinClientUtil.getConnectionUrl("localhost", PQS_PORT) + ";authentication=SPNEGO";
}
Also used : PrivilegedAction(java.security.PrivilegedAction) QueryServer(org.apache.phoenix.queryserver.server.QueryServer) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Aggregations

PrivilegedAction (java.security.PrivilegedAction)3 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)3 QueryServer (org.apache.phoenix.queryserver.server.QueryServer)3