/** * Get all edits dirs which are required. If any shared edits dirs are * configured, these are also included in the set of required dirs. * * @param conf the HDFS configuration. * @return all required dirs. */ public static Collection<URI> getRequiredNamespaceEditsDirs(Configuration conf) { Set<URI> ret = new HashSet<URI>(); ret.addAll(getStorageDirs(conf, DFS_NAMENODE_EDITS_DIR_REQUIRED_KEY)); ret.addAll(getSharedEditsDirs(conf)); return ret; }
/** * Constructor for FSEditLog. Underlying journals are constructed, but * no streams are opened until open() is called. * * @param conf The namenode configuration * @param storage Storage object used by namenode * @param editsDirs List of journals to use */ FSEditLog(Configuration conf, NNStorage storage, List<URI> editsDirs) { isSyncRunning = false; this.conf = conf; this.storage = storage; metrics = NameNode.getNameNodeMetrics(); lastPrintTime = monotonicNow(); // If this list is empty, an error will be thrown on first use // of the editlog, as no journals will exist this.editsDirs = Lists.newArrayList(editsDirs); this.sharedEditsDirs = FSNamesystem.getSharedEditsDirs(conf); }
/** * Construct the NNStorage. * @param conf Namenode configuration. * @param imageDirs Directories the image can be stored in. * @param editsDirs Directories the editlog can be stored in. * @throws IOException if any directories are inaccessible. */ public NNStorage(Configuration conf, Collection<URI> imageDirs, Collection<URI> editsDirs) throws IOException { super(NodeType.NAME_NODE); // this may modify the editsDirs, so copy before passing in setStorageDirectories(imageDirs, Lists.newArrayList(editsDirs), FSNamesystem.getSharedEditsDirs(conf)); //Update NameDirSize metric value after NN start updateNameDirSize(); }
FSNamesystem.getRequiredNamespaceEditsDirs(conf); final Collection<URI> sharedEditsDirs = FSNamesystem.getSharedEditsDirs(conf);
List<URI> sharedDirs = getSharedEditsDirs(conf);
editUrisToFormat = FSNamesystem.getNamespaceEditsDirs( conf, false); sharedEditsUris = FSNamesystem.getSharedEditsDirs(conf);
List<URI> sharedDirs = FSNamesystem.getSharedEditsDirs(conf); List<URI> dirsToPrompt = new ArrayList<URI>(); dirsToPrompt.addAll(nameDirsToFormat);
NamespaceInfo nsInfo = existingStorage.getNamespaceInfo(); List<URI> sharedEditsDirs = FSNamesystem.getSharedEditsDirs(conf);
/** * Get all edits dirs which are required. If any shared edits dirs are * configured, these are also included in the set of required dirs. * * @param conf the HDFS configuration. * @return all required dirs. */ public static Collection<URI> getRequiredNamespaceEditsDirs(Configuration conf) { Set<URI> ret = new HashSet<URI>(); ret.addAll(getStorageDirs(conf, DFS_NAMENODE_EDITS_DIR_REQUIRED_KEY)); ret.addAll(getSharedEditsDirs(conf)); return ret; }
/** * Get all edits dirs which are required. If any shared edits dirs are * configured, these are also included in the set of required dirs. * * @param conf the HDFS configuration. * @return all required dirs. */ public static Collection<URI> getRequiredNamespaceEditsDirs(Configuration conf) { Set<URI> ret = new HashSet<URI>(); ret.addAll(getStorageDirs(conf, DFS_NAMENODE_EDITS_DIR_REQUIRED_KEY)); ret.addAll(getSharedEditsDirs(conf)); return ret; }
/** * Construct the NNStorage. * @param conf Namenode configuration. * @param imageDirs Directories the image can be stored in. * @param editsDirs Directories the editlog can be stored in. * @throws IOException if any directories are inaccessible. */ public NNStorage(Configuration conf, Collection<URI> imageDirs, Collection<URI> editsDirs) throws IOException { super(NodeType.NAME_NODE); storageDirs = new CopyOnWriteArrayList<StorageDirectory>(); // this may modify the editsDirs, so copy before passing in setStorageDirectories(imageDirs, Lists.newArrayList(editsDirs), FSNamesystem.getSharedEditsDirs(conf)); }
/** * Constructor for FSEditLog. Underlying journals are constructed, but * no streams are opened until open() is called. * * @param conf The namenode configuration * @param storage Storage object used by namenode * @param editsDirs List of journals to use */ FSEditLog(Configuration conf, NNStorage storage, List<URI> editsDirs) { isSyncRunning = false; this.conf = conf; this.storage = storage; metrics = NameNode.getNameNodeMetrics(); lastPrintTime = monotonicNow(); // If this list is empty, an error will be thrown on first use // of the editlog, as no journals will exist this.editsDirs = Lists.newArrayList(editsDirs); this.sharedEditsDirs = FSNamesystem.getSharedEditsDirs(conf); }
/** * Construct the NNStorage. * @param conf Namenode configuration. * @param imageDirs Directories the image can be stored in. * @param editsDirs Directories the editlog can be stored in. * @throws IOException if any directories are inaccessible. */ public NNStorage(Configuration conf, Collection<URI> imageDirs, Collection<URI> editsDirs) throws IOException { super(NodeType.NAME_NODE); storageDirs = new CopyOnWriteArrayList<StorageDirectory>(); // this may modify the editsDirs, so copy before passing in setStorageDirectories(imageDirs, Lists.newArrayList(editsDirs), FSNamesystem.getSharedEditsDirs(conf)); }
List<URI> sharedDirs = getSharedEditsDirs(conf);
FSNamesystem.getRequiredNamespaceEditsDirs(conf); final Collection<URI> sharedEditsDirs = FSNamesystem.getSharedEditsDirs(conf);
/** * Constructor for FSEditLog. Underlying journals are constructed, but * no streams are opened until open() is called. * * @param conf The namenode configuration * @param storage Storage object used by namenode * @param editsDirs List of journals to use */ FSEditLog(Configuration conf, NNStorage storage, List<URI> editsDirs) { isSyncRunning = false; this.conf = conf; this.storage = storage; metrics = NameNode.getNameNodeMetrics(); lastPrintTime = monotonicNow(); // If this list is empty, an error will be thrown on first use // of the editlog, as no journals will exist this.editsDirs = Lists.newArrayList(editsDirs); this.sharedEditsDirs = FSNamesystem.getSharedEditsDirs(conf); }
List<URI> sharedDirs = getSharedEditsDirs(conf);
private void parseConfAndFindOtherNN() throws IOException { Configuration conf = getConf(); nsId = DFSUtil.getNamenodeNameServiceId(conf); if (!HAUtil.isHAEnabled(conf, nsId)) { throw new HadoopIllegalArgumentException( "HA is not enabled for this namenode."); } nnId = HAUtil.getNameNodeId(conf, nsId); NameNode.initializeGenericKeys(conf, nsId, nnId); if (!HAUtil.usesSharedEditsDir(conf)) { throw new HadoopIllegalArgumentException( "Shared edits storage is not enabled for this namenode."); } Configuration otherNode = HAUtil.getConfForOtherNode(conf); otherNNId = HAUtil.getNameNodeId(otherNode, nsId); otherIpcAddr = NameNode.getServiceAddress(otherNode, true); Preconditions.checkArgument(otherIpcAddr.getPort() != 0 && !otherIpcAddr.getAddress().isAnyLocalAddress(), "Could not determine valid IPC address for other NameNode (%s)" + ", got: %s", otherNNId, otherIpcAddr); final String scheme = DFSUtil.getHttpClientScheme(conf); otherHttpAddr = DFSUtil.getInfoServerWithDefaultHost( otherIpcAddr.getHostName(), otherNode, scheme).toURL(); dirsToFormat = FSNamesystem.getNamespaceDirs(conf); editUrisToFormat = FSNamesystem.getNamespaceEditsDirs( conf, false); sharedEditsUris = FSNamesystem.getSharedEditsDirs(conf); }
private void parseConfAndFindOtherNN() throws IOException { Configuration conf = getConf(); nsId = DFSUtil.getNamenodeNameServiceId(conf); if (!HAUtil.isHAEnabled(conf, nsId)) { throw new HadoopIllegalArgumentException( "HA is not enabled for this namenode."); } nnId = HAUtil.getNameNodeId(conf, nsId); NameNode.initializeGenericKeys(conf, nsId, nnId); if (!HAUtil.usesSharedEditsDir(conf)) { throw new HadoopIllegalArgumentException( "Shared edits storage is not enabled for this namenode."); } Configuration otherNode = HAUtil.getConfForOtherNode(conf); otherNNId = HAUtil.getNameNodeId(otherNode, nsId); otherIpcAddr = NameNode.getServiceAddress(otherNode, true); Preconditions.checkArgument(otherIpcAddr.getPort() != 0 && !otherIpcAddr.getAddress().isAnyLocalAddress(), "Could not determine valid IPC address for other NameNode (%s)" + ", got: %s", otherNNId, otherIpcAddr); final String scheme = DFSUtil.getHttpClientScheme(conf); otherHttpAddr = DFSUtil.getInfoServerWithDefaultHost( otherIpcAddr.getHostName(), otherNode, scheme).toURL(); dirsToFormat = FSNamesystem.getNamespaceDirs(conf); editUrisToFormat = FSNamesystem.getNamespaceEditsDirs( conf, false); sharedEditsUris = FSNamesystem.getSharedEditsDirs(conf); }
List<URI> sharedDirs = FSNamesystem.getSharedEditsDirs(conf); List<URI> dirsToPrompt = new ArrayList<URI>(); dirsToPrompt.addAll(nameDirsToFormat);