Ejemplo n.º 1
0
        /* the same as superclass's localTarget, but with the more specfic NN type */
        protected override HAServiceTarget DataToTarget(byte[] data)
        {
            HAZKInfoProtos.ActiveNodeInfo proto;
            try
            {
                proto = HAZKInfoProtos.ActiveNodeInfo.ParseFrom(data);
            }
            catch (InvalidProtocolBufferException)
            {
                throw new RuntimeException("Invalid data in ZK: " + StringUtils.ByteToHexString(data
                                                                                                ));
            }
            NNHAServiceTarget ret = new NNHAServiceTarget(conf, proto.GetNameserviceId(), proto
                                                          .GetNamenodeId());
            IPEndPoint addressFromProtobuf = new IPEndPoint(proto.GetHostname(), proto.GetPort
                                                                ());

            if (!addressFromProtobuf.Equals(ret.GetAddress()))
            {
                throw new RuntimeException("Mismatched address stored in ZK for " + ret + ": Stored protobuf was "
                                           + proto + ", address from our own " + "configuration for this NameNode was " +
                                           ret.GetAddress());
            }
            ret.SetZkfcPort(proto.GetZkfcPort());
            return(ret);
        }
Ejemplo n.º 2
0
 private DFSZKFailoverController(Configuration conf, NNHAServiceTarget localTarget
                                 )
     : base(conf, localTarget)
 {
     this.localNNTarget = localTarget;
     // Setup ACLs
     adminAcl = new AccessControlList(conf.Get(DFSConfigKeys.DfsAdmin, " "));
     Log.Info("Failover controller configured for NameNode " + localTarget);
 }
Ejemplo n.º 3
0
        public static Org.Apache.Hadoop.Hdfs.Tools.DFSZKFailoverController Create(Configuration
                                                                                  conf)
        {
            Configuration localNNConf = DFSHAAdmin.AddSecurityConfiguration(conf);
            string        nsId        = DFSUtil.GetNamenodeNameServiceId(conf);

            if (!HAUtil.IsHAEnabled(localNNConf, nsId))
            {
                throw new HadoopIllegalArgumentException("HA is not enabled for this namenode.");
            }
            string nnId = HAUtil.GetNameNodeId(localNNConf, nsId);

            if (nnId == null)
            {
                string msg = "Could not get the namenode ID of this node. " + "You may run zkfc on the node other than namenode.";
                throw new HadoopIllegalArgumentException(msg);
            }
            NameNode.InitializeGenericKeys(localNNConf, nsId, nnId);
            DFSUtil.SetGenericConf(localNNConf, nsId, nnId, ZkfcConfKeys);
            NNHAServiceTarget localTarget = new NNHAServiceTarget(localNNConf, nsId, nnId);

            return(new Org.Apache.Hadoop.Hdfs.Tools.DFSZKFailoverController(localNNConf, localTarget
                                                                            ));
        }