Search in sources :

Example 1 with NoExitSecurityManager

use of org.apache.hive.hcatalog.NoExitSecurityManager in project hive by apache.

the class TestHCatClient method startMetaStoreServer.

@BeforeClass
public static void startMetaStoreServer() throws Exception {
    hcatConf = new HiveConf(TestHCatClient.class);
    String metastoreUri = System.getProperty("test." + HiveConf.ConfVars.METASTOREURIS.varname);
    if (metastoreUri != null) {
        hcatConf.setVar(HiveConf.ConfVars.METASTOREURIS, metastoreUri);
        useExternalMS = true;
        return;
    }
    // Set proxy user privilege and initialize the global state of ProxyUsers
    Configuration conf = new Configuration();
    conf.set("hadoop.proxyuser." + Utils.getUGI().getShortUserName() + ".hosts", "*");
    ProxyUsers.refreshSuperUserGroupsConfiguration(conf);
    System.setProperty(HiveConf.ConfVars.METASTORE_TRANSACTIONAL_EVENT_LISTENERS.varname, // turn on db notification listener on metastore
    DbNotificationListener.class.getName());
    System.setProperty(MetastoreConf.ConfVars.EVENT_MESSAGE_FACTORY.getHiveName(), JSONMessageEncoder.class.getName());
    msPort = MetaStoreTestUtils.startMetaStoreWithRetry();
    securityManager = System.getSecurityManager();
    System.setSecurityManager(new NoExitSecurityManager());
    Policy.setPolicy(new DerbyPolicy());
    hcatConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + msPort);
    hcatConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
    hcatConf.set(HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK.varname, HCatSemanticAnalyzer.class.getName());
    hcatConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
    hcatConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
    hcatConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    System.setProperty(HiveConf.ConfVars.PREEXECHOOKS.varname, " ");
    System.setProperty(HiveConf.ConfVars.POSTEXECHOOKS.varname, " ");
}
Also used : DerbyPolicy(org.apache.hive.hcatalog.DerbyPolicy) Configuration(org.apache.hadoop.conf.Configuration) JSONMessageEncoder(org.apache.hadoop.hive.metastore.messaging.json.JSONMessageEncoder) HCatSemanticAnalyzer(org.apache.hive.hcatalog.cli.SemanticAnalysis.HCatSemanticAnalyzer) DbNotificationListener(org.apache.hive.hcatalog.listener.DbNotificationListener) HiveConf(org.apache.hadoop.hive.conf.HiveConf) NoExitSecurityManager(org.apache.hive.hcatalog.NoExitSecurityManager) BeforeClass(org.junit.BeforeClass)

Example 2 with NoExitSecurityManager

use of org.apache.hive.hcatalog.NoExitSecurityManager in project hive by apache.

the class TestPermsGrp method setUp.

@Before
public void setUp() throws Exception {
    if (isServerRunning) {
        return;
    }
    hcatConf = new HiveConf(this.getClass());
    MetaStoreTestUtils.startMetaStoreWithRetry(hcatConf);
    isServerRunning = true;
    securityManager = System.getSecurityManager();
    System.setSecurityManager(new NoExitSecurityManager());
    Policy.setPolicy(new DerbyPolicy());
    hcatConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
    hcatConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTFAILURERETRIES, 3);
    hcatConf.setTimeVar(HiveConf.ConfVars.METASTORE_CLIENT_SOCKET_TIMEOUT, 60, TimeUnit.SECONDS);
    hcatConf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    hcatConf.set(HiveConf.ConfVars.METASTOREWAREHOUSE.varname, MetastoreConf.getVar(hcatConf, MetastoreConf.ConfVars.WAREHOUSE));
    hcatConf.set(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname, MetastoreConf.getVar(hcatConf, MetastoreConf.ConfVars.CONNECT_URL_KEY));
    hcatConf.set(HiveConf.ConfVars.METASTOREURIS.varname, MetastoreConf.getVar(hcatConf, MetastoreConf.ConfVars.THRIFT_URIS));
    clientWH = new Warehouse(hcatConf);
    msc = new HiveMetaStoreClient(hcatConf);
}
Also used : DerbyPolicy(org.apache.hive.hcatalog.DerbyPolicy) Warehouse(org.apache.hadoop.hive.metastore.Warehouse) HiveMetaStoreClient(org.apache.hadoop.hive.metastore.HiveMetaStoreClient) HiveConf(org.apache.hadoop.hive.conf.HiveConf) NoExitSecurityManager(org.apache.hive.hcatalog.NoExitSecurityManager) Before(org.junit.Before)

Example 3 with NoExitSecurityManager

use of org.apache.hive.hcatalog.NoExitSecurityManager in project hive by apache.

the class TestHCatPartitionPublish method setup.

@BeforeClass
public static void setup() throws Exception {
    File workDir = handleWorkDir();
    Path tmpDir = new Path(System.getProperty("test.tmp.dir", "target" + File.separator + "test" + File.separator + "tmp"));
    conf.set("yarn.app.mapreduce.am.staging-dir", tmpDir + File.separator + testName + File.separator + "hadoop-yarn" + File.separator + "staging");
    conf.set("yarn.scheduler.capacity.root.queues", "default");
    conf.set("yarn.scheduler.capacity.root.default.capacity", "100");
    conf.set("fs.pfile.impl", "org.apache.hadoop.fs.ProxyLocalFileSystem");
    fs = FileSystem.get(conf);
    System.setProperty("hadoop.log.dir", new File(workDir, "/logs").getAbsolutePath());
    // LocalJobRunner does not work with mapreduce OutputCommitter. So need
    // to use MiniMRCluster. MAPREDUCE-2350
    mrCluster = new MiniMRCluster(1, fs.getUri().toString(), 1, null, null, new JobConf(conf));
    mrConf = mrCluster.createJobConf();
    if (isServerRunning) {
        return;
    }
    hcatConf = new HiveConf(TestHCatPartitionPublish.class);
    MetaStoreTestUtils.startMetaStoreWithRetry(hcatConf);
    isServerRunning = true;
    securityManager = System.getSecurityManager();
    System.setSecurityManager(new NoExitSecurityManager());
    Policy.setPolicy(new DerbyPolicy());
    hcatConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
    hcatConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTFAILURERETRIES, 3);
    hcatConf.setTimeVar(HiveConf.ConfVars.METASTORE_CLIENT_SOCKET_TIMEOUT, 120, TimeUnit.SECONDS);
    hcatConf.set(HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK.varname, HCatSemanticAnalyzer.class.getName());
    hcatConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
    hcatConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
    hcatConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    msc = new HiveMetaStoreClient(hcatConf);
    System.setProperty(HiveConf.ConfVars.PREEXECHOOKS.varname, " ");
    System.setProperty(HiveConf.ConfVars.POSTEXECHOOKS.varname, " ");
    System.setProperty(HiveConf.ConfVars.METASTOREWAREHOUSE.varname, MetastoreConf.getVar(hcatConf, MetastoreConf.ConfVars.WAREHOUSE));
    System.setProperty(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname, MetastoreConf.getVar(hcatConf, MetastoreConf.ConfVars.CONNECT_URL_KEY));
    System.setProperty(HiveConf.ConfVars.METASTOREURIS.varname, MetastoreConf.getVar(hcatConf, MetastoreConf.ConfVars.THRIFT_URIS));
}
Also used : Path(org.apache.hadoop.fs.Path) DerbyPolicy(org.apache.hive.hcatalog.DerbyPolicy) HiveMetaStoreClient(org.apache.hadoop.hive.metastore.HiveMetaStoreClient) HCatSemanticAnalyzer(org.apache.hive.hcatalog.cli.SemanticAnalysis.HCatSemanticAnalyzer) HiveConf(org.apache.hadoop.hive.conf.HiveConf) NoExitSecurityManager(org.apache.hive.hcatalog.NoExitSecurityManager) File(java.io.File) MiniMRCluster(org.apache.hadoop.mapred.MiniMRCluster) JobConf(org.apache.hadoop.mapred.JobConf) BeforeClass(org.junit.BeforeClass)

Aggregations

HiveConf (org.apache.hadoop.hive.conf.HiveConf)3 DerbyPolicy (org.apache.hive.hcatalog.DerbyPolicy)3 NoExitSecurityManager (org.apache.hive.hcatalog.NoExitSecurityManager)3 HiveMetaStoreClient (org.apache.hadoop.hive.metastore.HiveMetaStoreClient)2 HCatSemanticAnalyzer (org.apache.hive.hcatalog.cli.SemanticAnalysis.HCatSemanticAnalyzer)2 BeforeClass (org.junit.BeforeClass)2 File (java.io.File)1 Configuration (org.apache.hadoop.conf.Configuration)1 Path (org.apache.hadoop.fs.Path)1 Warehouse (org.apache.hadoop.hive.metastore.Warehouse)1 JSONMessageEncoder (org.apache.hadoop.hive.metastore.messaging.json.JSONMessageEncoder)1 JobConf (org.apache.hadoop.mapred.JobConf)1 MiniMRCluster (org.apache.hadoop.mapred.MiniMRCluster)1 DbNotificationListener (org.apache.hive.hcatalog.listener.DbNotificationListener)1 Before (org.junit.Before)1