protected static void startHiveMetaStore() throws Exception { final int port = MetaStoreUtils.findFreePort(); hiveConf.set(METASTOREURIS.varname, "thrift://localhost:" + port); MetaStoreUtils.startMetaStore(port, ShimLoader.getHadoopThriftAuthBridge(), hiveConf); }
public MiniHS2(HiveConf hiveConf, FileSystem fs) throws IOException { // MiniHS2 normally only lets you do either "local" mode or normal mode. We couldn't use "local" mode because it forks out // a process to run a shell script (that we don't have) to run Hadoop jobs. And we didn't want to use normal mode because that // creates Mini MR and DFS clusters, which we already have setup for Oozie. Our hacking here involved deleting the Hive Mini // MR/DFS cluster code and passing in our jobConf in the hiveConf so that HS2 would use our Mini MR/DFS cluster. super(hiveConf, "localhost", MetaStoreUtils.findFreePort(), MetaStoreUtils.findFreePort()); baseDir = Files.createTempDir(); baseDfsDir = new Path(new Path(fs.getUri()), "/base"); String metaStoreURL = "jdbc:derby:" + baseDir.getAbsolutePath() + File.separator + "test_metastore-" + hs2Counter.incrementAndGet() + ";create=true"; fs.mkdirs(baseDfsDir); Path wareHouseDir = new Path(baseDfsDir, "warehouse"); fs.mkdirs(wareHouseDir); setWareHouseDir(wareHouseDir.toString()); System.setProperty(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname, metaStoreURL); hiveConf.setVar(HiveConf.ConfVars.METASTORECONNECTURLKEY, metaStoreURL); // reassign a new port, just in case if one of the MR services grabbed the last one setBinaryPort(MetaStoreUtils.findFreePort()); hiveConf.setVar(ConfVars.HIVE_SERVER2_TRANSPORT_MODE, HS2_BINARY_MODE); hiveConf.setVar(ConfVars.HIVE_SERVER2_THRIFT_BIND_HOST, getHost()); hiveConf.setIntVar(ConfVars.HIVE_SERVER2_THRIFT_PORT, getBinaryPort()); hiveConf.setIntVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_PORT, getHttpPort()); Path scratchDir = new Path(baseDfsDir, "scratch"); fs.mkdirs(scratchDir); System.setProperty(HiveConf.ConfVars.SCRATCHDIR.varname, scratchDir.toString()); System.setProperty(HiveConf.ConfVars.LOCALSCRATCHDIR.varname, baseDir.getPath() + File.separator + "scratch"); }
protected static void startHiveMetaStore() throws Exception { final int port = MetaStoreUtils.findFreePort(); hiveConf.set(METASTOREURIS.varname, "thrift://localhost:" + port); MetaStoreUtils.startMetaStore(port, ShimLoader.getHadoopThriftAuthBridge(), hiveConf); }
thriftBinaryPort = MetaStoreUtils.findFreePort(); hiveConf.setIntVar(ConfVars.HIVE_SERVER2_THRIFT_PORT, thriftBinaryPort); hiveConf.setBoolVar(ConfVars.HIVE_CLI_PRINT_HEADER, false);