use of org.apache.hive.service.server.HiveServer2 in project hive by apache.
the class TestCustomAuthentication method setUp.
@BeforeClass
public static void setUp() throws Exception {
hiveConf = new HiveConf();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
hiveConf.writeXml(baos);
baos.close();
hiveConfBackup = baos.toByteArray();
hiveConf.set("hive.server2.authentication", "CUSTOM");
hiveConf.set("hive.server2.custom.authentication.class", "org.apache.hive.service.auth.TestCustomAuthentication$SimpleAuthenticationProviderImpl");
FileOutputStream fos = new FileOutputStream(new File(hiveConf.getHiveSiteLocation().toURI()));
hiveConf.writeXml(fos);
fos.close();
hiveserver2 = new HiveServer2();
hiveserver2.init(hiveConf);
hiveserver2.start();
Thread.sleep(1000);
System.out.println("hiveServer2 start ......");
}
use of org.apache.hive.service.server.HiveServer2 in project hive by apache.
the class TestRetryingThriftCLIServiceClient method startHiveServer.
private void startHiveServer() throws InterruptedException {
// Start hive server2
server = new HiveServer2();
server.init(hiveConf);
server.start();
Thread.sleep(5000);
System.out.println("## HiveServer started");
}
use of org.apache.hive.service.server.HiveServer2 in project hive by apache.
the class TestHs2Hooks method setUpBeforeClass.
/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
HiveConf hiveConf = new HiveConf();
hiveConf.setVar(ConfVars.PREEXECHOOKS, PreExecHook.class.getName());
hiveConf.setVar(ConfVars.POSTEXECHOOKS, PostExecHook.class.getName());
hiveConf.setVar(ConfVars.SEMANTIC_ANALYZER_HOOK, SemanticAnalysisHook.class.getName());
hiveConf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
hiveServer2 = new HiveServer2();
hiveServer2.init(hiveConf);
hiveServer2.start();
Thread.sleep(2000);
}
use of org.apache.hive.service.server.HiveServer2 in project hive by apache.
the class TestServerSpecificConfig method testHiveMetastoreRemoteConfig.
/**
* Test to ensure that HiveConf does not try to load hivemetastore-site.xml,
* when remote metastore is used.
*
* @throws IOException
* @throws Throwable
*/
@Test
public void testHiveMetastoreRemoteConfig() throws IOException, Throwable {
// switch to hive-site.xml with remote metastore
setHiveSiteWithRemoteMetastore();
// Set HiveConf statics to default values
resetDefaults();
// create hiveconf again to run initialization code, to see if value changes
HiveConf conf = new HiveConf();
// check the properties expected in hive client without metastore
verifyMetastoreConfNotLoaded(conf);
assertEquals("from.hive-site.xml", conf.get("hive.dummyparam.test.server.specific.config.override"));
// get HS2 site.xml loaded
new HiveServer2();
conf = new HiveConf();
verifyHS2ConfParams(conf);
verifyMetastoreConfNotLoaded(conf);
}
use of org.apache.hive.service.server.HiveServer2 in project hive by apache.
the class MiniHS2 method start.
public void start(Map<String, String> confOverlay) throws Exception {
if (isMetastoreRemote) {
MetaStoreTestUtils.startMetaStoreWithRetry(getHiveConf());
}
// Set confOverlay parameters
for (Map.Entry<String, String> entry : confOverlay.entrySet()) {
setConfProperty(entry.getKey(), entry.getValue());
}
Exception hs2Exception = null;
boolean hs2Started = false;
for (int tryCount = 0; (tryCount < MetaStoreTestUtils.RETRY_COUNT); tryCount++) {
try {
hiveServer2 = new HiveServer2();
if (pamAuthenticator != null) {
hiveServer2.setPamAuthenticator(pamAuthenticator);
}
hiveServer2.init(getHiveConf());
hiveServer2.start();
hs2Started = true;
break;
} catch (Exception t) {
hs2Exception = t;
if (usePortsFromConf) {
hs2Started = false;
break;
} else {
HiveConf.setIntVar(getHiveConf(), HiveConf.ConfVars.HIVE_SERVER2_THRIFT_PORT, MetaStoreTestUtils.findFreePort());
HiveConf.setIntVar(getHiveConf(), HiveConf.ConfVars.HIVE_SERVER2_THRIFT_HTTP_PORT, MetaStoreTestUtils.findFreePort());
}
}
}
if (!hs2Started) {
throw (hs2Exception);
}
waitForStartup();
setStarted(true);
}
Aggregations