Package org.apache.hadoop.conf

Examples of org.apache.hadoop.conf.Configuration


   * @throws IOException
   */
  public synchronized HBaseAdmin getHBaseAdmin()
  throws IOException {
    if (hbaseAdmin == null){
      hbaseAdmin = new HBaseAdmin(new Configuration(getConfiguration()));
    }
    return hbaseAdmin;
  }
View Full Code Here


    if (this.ourClusterKey.equals(otherClusterKey)) {
      LOG.debug("Not connecting to " + peerId + " because it's us");
      return null;
    }
    // Construct the connection to the new peer
    Configuration otherConf = new Configuration(this.conf);
    try {
      ZKUtil.applyClusterKeyToConf(otherConf, otherClusterKey);
    } catch (IOException e) {
      LOG.error("Can't get peer because:", e);
      return null;
View Full Code Here

   */
  @Test
  public void testCleaningRace() throws Exception {
    final long TEST_TIME = 20 * 1000;

    Configuration conf = UTIL.getMiniHBaseCluster().getMaster().getConfiguration();
    Path rootDir = UTIL.getDataTestDir("testCleaningRace");
    FileSystem fs = UTIL.getTestFileSystem();

    Path archiveDir = new Path(rootDir, HConstants.HFILE_ARCHIVE_DIRECTORY);
    Path regionDir = new Path("table", "abcdef");
View Full Code Here

     * hbase/ManyMiniCluster.java
     *
     */
    String hbaseDir = new File(workDir,"hbase").getAbsolutePath();
    String hbaseRoot = "file://" + hbaseDir;
    Configuration hbaseConf =  HBaseConfiguration.create();

    hbaseConf.set(HConstants.HBASE_DIR, hbaseRoot);
    hbaseConf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, 2181);
    hbaseConf.set(HConstants.ZOOKEEPER_QUORUM, "0.0.0.0");
    hbaseConf.setInt("hbase.master.info.port", -1);
    hbaseConf.setInt("hbase.zookeeper.property.maxClientCnxns",500);
    String zookeeperDir = new File(workDir,"zk").getAbsolutePath();
    int zookeeperPort = 2181;
    zookeeperCluster = new MiniZooKeeperCluster();
    Method m;
    Class<?> zkParam[] = {Integer.TYPE};
    try{
      m = MiniZooKeeperCluster.class.getDeclaredMethod("setDefaultClientPort",
          zkParam);
    } catch (NoSuchMethodException e) {
      m = MiniZooKeeperCluster.class.getDeclaredMethod("setClientPort",
          zkParam);
    }

    m.invoke(zookeeperCluster, new Object[] {new Integer(zookeeperPort)});
    zookeeperCluster.startup(new File(zookeeperDir));
    hbaseCluster = new MiniHBaseCluster(hbaseConf, 1);
    HMaster master = hbaseCluster.getMaster();
    Object serverName = master.getServerName();
    String hostAndPort;
    if(serverName instanceof String) {
      System.out.println("Server name is string, using HServerAddress.");
      m = HMaster.class.getDeclaredMethod("getMasterAddress",
          new Class<?>[]{});
      Class<?> clazz = Class.forName("org.apache.hadoop.hbase.HServerAddress");
      /*
       * Call method to get server address
       */
      Object serverAddr = clazz.cast(m.invoke(master, new Object[]{}));
      //returns the address as hostname:port
      hostAndPort = serverAddr.toString();
    } else {
      System.out.println("ServerName is org.apache.hadoop.hbase.ServerName," +
          "using getHostAndPort()");
      Class<?> clazz = Class.forName("org.apache.hadoop.hbase.ServerName");
      m = clazz.getDeclaredMethod("getHostAndPort", new Class<?>[] {});
      hostAndPort = m.invoke(serverName, new Object[]{}).toString();
    }

    hbaseConf.set("hbase.master", hostAndPort);
    testUtility = new HBaseTestingUtility(hbaseConf);
    testUtility.setZkCluster(zookeeperCluster);
    hbaseCluster.startMaster();
    Map<String, String> ctxMap = new HashMap<String, String>();
    ctxMap.put("table", tableName);
View Full Code Here

public final class OozieUtils {

    private OozieUtils() {}

    public static Properties toProperties(String properties) {
        Configuration conf = new Configuration(false);
        conf.addResource(new ByteArrayInputStream(properties.getBytes()));
        Properties jobprops = new Properties();
        for (Map.Entry<String, String> entry : conf) {
            jobprops.put(entry.getKey(), entry.getValue());
        }
        return jobprops;
View Full Code Here

  private void doOpen() throws IOException {
    if ((filePath == null) || (writer == null) || (formatter == null)) {
      throw new IOException("Invalid file settings");
    }

    Configuration config = new Configuration();
    // disable FileSystem JVM shutdown hook
    config.setBoolean("fs.automatic.close", false);

    // Hadoop is not thread safe when doing certain RPC operations,
    // including getFileSystem(), when running under Kerberos.
    // open() must be called by one thread at a time in the JVM.
    // NOTE: tried synchronizing on the underlying Kerberos principal previously
View Full Code Here

    }
    return false;
  }

  private static CompressionCodec getCodec(String codecName) {
    Configuration conf = new Configuration();
    List<Class<? extends CompressionCodec>> codecs = CompressionCodecFactory
        .getCodecClasses(conf);
    // Wish we could base this on DefaultCodec but appears not all codec's
    // extend DefaultCodec(Lzo)
    CompressionCodec codec = null;
View Full Code Here

    assertNotNull(HFileArchiveUtil.getTableArchivePath(new Path("root", new Path("table"))));
  }

  @Test
  public void testGetArchivePath() throws Exception {
    Configuration conf = new Configuration();
    FSUtils.setRootDir(conf, new Path("root"));
    assertNotNull(HFileArchiveUtil.getArchivePath(conf));
  }
View Full Code Here

    assertNotNull(HFileArchiveUtil.getArchivePath(conf));
  }
 
  @Test
  public void testRegionArchiveDir() {
    Configuration conf = null;
    Path tableDir = new Path("table");
    Path regionDir = new Path("region");
    assertNotNull(HFileArchiveUtil.getRegionArchiveDir(conf, tableDir, regionDir));
  }
View Full Code Here

  @Test
  public void testGetStoreArchivePath(){
      byte[] family = Bytes.toBytes("Family");
    Path tabledir = new Path("table");
    HRegionInfo region = new HRegionInfo(Bytes.toBytes("table"));
    Configuration conf = null;
    assertNotNull(HFileArchiveUtil.getStoreArchivePath(conf, region, tabledir, family));
    conf = new Configuration();
    assertNotNull(HFileArchiveUtil.getStoreArchivePath(conf, region, tabledir, family));

    // do a little mocking of a region to get the same results
    HRegion mockRegion = Mockito.mock(HRegion.class);
    Mockito.when(mockRegion.getRegionInfo()).thenReturn(region);
    Mockito.when(mockRegion.getTableDir()).thenReturn(tabledir);

    assertNotNull(HFileArchiveUtil.getStoreArchivePath(null, mockRegion, family));
    conf = new Configuration();
    assertNotNull(HFileArchiveUtil.getStoreArchivePath(conf, mockRegion, family));
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.conf.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.