Package org.apache.accumulo.core.conf

Examples of org.apache.accumulo.core.conf.AccumuloConfiguration


  /**
   * This method is for logging a server in kerberos. If this is used in client code, it will fail unless run as the accumulo keytab's owner. Instead, use
   * {@link #login(String, String)}
   */
  public static void serverLogin() {
    @SuppressWarnings("deprecation")
    AccumuloConfiguration acuConf = AccumuloConfiguration.getSiteConfiguration();
    String keyTab = acuConf.get(Property.GENERAL_KERBEROS_KEYTAB);
    if (keyTab == null || keyTab.length() == 0)
      return;
   
    usingKerberos = true;
    if (keyTab.contains("$ACCUMULO_HOME") && System.getenv("ACCUMULO_HOME") != null)
      keyTab = keyTab.replace("$ACCUMULO_HOME", System.getenv("ACCUMULO_HOME"));
   
    String principalConfig = acuConf.get(Property.GENERAL_KERBEROS_PRINCIPAL);
    if (principalConfig == null || principalConfig.length() == 0)
      return;
   
    if (login(principalConfig, keyTab)) {
      try {
View Full Code Here


    if (cachedInstance != null)
      return cachedInstance;
    if (mock)
      return cachedInstance = new MockInstance(instance);
    if (siteFile != null) {
      AccumuloConfiguration config = new AccumuloConfiguration() {
        Configuration xml = new Configuration();
        {
          xml.addResource(new Path(siteFile));
        }
       
        @Override
        public Iterator<Entry<String,String>> iterator() {
          TreeMap<String,String> map = new TreeMap<String,String>();
          for (Entry<String,String> props : DefaultConfiguration.getInstance())
            map.put(props.getKey(), props.getValue());
          for (Entry<String,String> props : xml)
            map.put(props.getKey(), props.getValue());
          return map.entrySet().iterator();
        }
       
        @Override
        public String get(Property property) {
          String value = xml.get(property.getKey());
          if (value != null)
            return value;
          return DefaultConfiguration.getInstance().get(property);
        }
      };
      this.zookeepers = config.get(Property.INSTANCE_ZK_HOST);
      Path instanceDir = new Path(config.get(Property.INSTANCE_DFS_DIR), "instance_id");
      @SuppressWarnings("deprecation")
      String instanceIDFromFile = ZooKeeperInstance.getInstanceIDFromHdfs(instanceDir);
      return cachedInstance = new ZooKeeperInstance(UUID.fromString(instanceIDFromFile), zookeepers);
    }
    return cachedInstance = new ZooKeeperInstance(this.instance, this.zookeepers);
View Full Code Here

   * Copy local walogs into HDFS on an upgrade
   *
   */
  public static void recoverLocalWriteAheadLogs(FileSystem fs, ServerConfiguration serverConf) throws IOException {
    FileSystem localfs = FileSystem.getLocal(fs.getConf()).getRawFileSystem();
    AccumuloConfiguration conf = serverConf.getConfiguration();
    String localWalDirectories = conf.get(Property.LOGGER_DIR);
    for (String localWalDirectory : localWalDirectories.split(",")) {
      if (!localWalDirectory.startsWith("/")) {
        localWalDirectory = System.getenv("ACCUMULO_HOME") + "/" + localWalDirectory;
      }
     
View Full Code Here

  }
 
  private final AtomicInteger logIdGenerator = new AtomicInteger();
 
  public int createLogId(KeyExtent tablet) {
    AccumuloConfiguration acuTableConf = getTableConfiguration(tablet);
    if (acuTableConf.getBoolean(Property.TABLE_WALOG_ENABLED)) {
      return logIdGenerator.incrementAndGet();
    }
    return -1;
  }
View Full Code Here

 
  @Override
  public RecordWriter<Key,Value> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException {
    // get the path of the temporary output file
    final Configuration conf = job;
    final AccumuloConfiguration acuConf = getAccumuloConfiguration(job);
   
    final String extension = acuConf.get(Property.TABLE_FILE_TYPE);
    final Path file = new Path(getWorkOutputPath(job), getUniqueName(job, "part") + "." + extension);
   
    final LRUMap validVisibilities = new LRUMap(1000);
   
    return new RecordWriter<Key,Value>() {
View Full Code Here

    return addEs(name, new ThreadPoolExecutor(min, max, timeout, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamingThreadFactory(name)));
  }
 
  public TabletServerResourceManager(Instance instance, FileSystem fs) {
    this.conf = new ServerConfiguration(instance);
    final AccumuloConfiguration acuConf = conf.getConfiguration();
   
    long maxMemory = acuConf.getMemoryInBytes(Property.TSERV_MAXMEM);
    boolean usingNativeMap = acuConf.getBoolean(Property.TSERV_NATIVEMAP_ENABLED) && NativeMap.loadedNativeLibraries();
   
    long blockSize = acuConf.getMemoryInBytes(Property.TSERV_DEFAULT_BLOCKSIZE);
    long dCacheSize = acuConf.getMemoryInBytes(Property.TSERV_DATACACHE_SIZE);
    long iCacheSize = acuConf.getMemoryInBytes(Property.TSERV_INDEXCACHE_SIZE);
   
    _iCache = new LruBlockCache(iCacheSize, blockSize);
    _dCache = new LruBlockCache(dCacheSize, blockSize);
   
    Runtime runtime = Runtime.getRuntime();
    if (!usingNativeMap && maxMemory + dCacheSize + iCacheSize > runtime.maxMemory()) {
      throw new IllegalArgumentException(String.format(
          "Maximum tablet server map memory %,d and block cache sizes %,d is too large for this JVM configuration %,d", maxMemory, dCacheSize + iCacheSize,
          runtime.maxMemory()));
    }
    runtime.gc();

    // totalMemory - freeMemory = memory in use
    // maxMemory - memory in use = max available memory
    if (!usingNativeMap && maxMemory > runtime.maxMemory() - (runtime.totalMemory() - runtime.freeMemory())) {
      log.warn("In-memory map may not fit into local memory space.");
    }
   
    minorCompactionThreadPool = createEs(Property.TSERV_MINC_MAXCONCURRENT, "minor compactor");
   
    // make this thread pool have a priority queue... and execute tablets with the most
    // files first!
    majorCompactionThreadPool = createEs(Property.TSERV_MAJC_MAXCONCURRENT, "major compactor", new CompactionQueue());
    rootMajorCompactionThreadPool = createEs(0, 1, 300, "md root major compactor");
    defaultMajorCompactionThreadPool = createEs(0, 1, 300, "md major compactor");
   
    splitThreadPool = createEs(1, "splitter");
    defaultSplitThreadPool = createEs(0, 1, 60, "md splitter");
   
    defaultMigrationPool = createEs(0, 1, 60, "metadata tablet migration");
    migrationPool = createEs(Property.TSERV_MIGRATE_MAXCONCURRENT, "tablet migration");
   
    // not sure if concurrent assignments can run safely... even if they could there is probably no benefit at startup because
    // individual tablet servers are already running assignments concurrently... having each individual tablet server run
    // concurrent assignments would put more load on the metadata table at startup
    assignmentPool = createEs(1, "tablet assignment");
   
    assignMetaDataPool = createEs(0, 1, 60, "metadata tablet assignment");
   
    readAheadThreadPool = createEs(Property.TSERV_READ_AHEAD_MAXCONCURRENT, "tablet read ahead");
    defaultReadAheadThreadPool = createEs(Property.TSERV_METADATA_READ_AHEAD_MAXCONCURRENT, "metadata tablets read ahead");
   
    tabletResources = new HashSet<TabletResourceManager>();
   
    int maxOpenFiles = acuConf.getCount(Property.TSERV_SCAN_MAX_OPENFILES);
   
    fileManager = new FileManager(conf, fs, maxOpenFiles, _dCache, _iCache);
   
    try {
      Class<? extends MemoryManager> clazz = AccumuloVFSClassLoader.loadClass(acuConf.get(Property.TSERV_MEM_MGMT), MemoryManager.class);
      memoryManager = clazz.newInstance();
      memoryManager.init(conf);
      log.debug("Loaded memory manager : " + memoryManager.getClass().getName());
    } catch (Exception e) {
      log.error("Failed to find memory manger in config, using default", e);
View Full Code Here

   * @throws TableNotFoundException
   *           if the table does not exist
   */
  @Override
  public Map<String,Set<Text>> getLocalityGroups(String tableName) throws AccumuloException, TableNotFoundException {
    AccumuloConfiguration conf = new ConfigurationCopy(this.getProperties(tableName));
    Map<String,Set<ByteSequence>> groups = LocalityGroupUtil.getLocalityGroups(conf);
   
    Map<String,Set<Text>> groups2 = new HashMap<String,Set<Text>>();
    for (Entry<String,Set<ByteSequence>> entry : groups.entrySet()) {
     
View Full Code Here

  @Test
  public void testFindOverlappingTablets() throws Exception {
    TCredentials credentials = null;
    MockTabletLocator locator = new MockTabletLocator();
    FileSystem fs = FileSystem.getLocal(CachedConfiguration.getInstance());
    AccumuloConfiguration acuConf = AccumuloConfiguration.getDefaultConfiguration();
    String file = "target/testFile.rf";
    fs.delete(new Path(file), true);
    FileSKVWriter writer = FileOperations.getInstance().openWriter(file, fs, fs.getConf(), acuConf);
    writer.startDefaultLocalityGroup();
    Value empty = new Value(new byte[] {});
View Full Code Here

*/
public class LocalWALRecovery implements Runnable {
  private static final Logger log = Logger.getLogger(LocalWALRecovery.class);

  public static void main(String[] args) throws IOException {
    AccumuloConfiguration configuration = SiteConfiguration.getInstance(SiteConfiguration.getDefaultConfiguration());

    LocalWALRecovery main = new LocalWALRecovery(configuration);
    main.parseArgs(args);
    main.run();
  }
View Full Code Here

  }

  private final AtomicInteger logIdGenerator = new AtomicInteger();

  public int createLogId(KeyExtent tablet) {
    AccumuloConfiguration acuTableConf = getTableConfiguration(tablet);
    if (acuTableConf.getBoolean(Property.TABLE_WALOG_ENABLED)) {
      return logIdGenerator.incrementAndGet();
    }
    return -1;
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.conf.AccumuloConfiguration

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.