Esempio n. 1
0
        /// <exception cref="System.IO.IOException"/>
        private void ParseConfAndFindOtherNN()
        {
            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.Port != 0 && !otherIpcAddr.Address.IsAnyLocalAddress
                                            (), "Could not determine valid IPC address for other NameNode (%s)" + ", got: %s"
                                        , otherNNId, otherIpcAddr);
            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);
        }