private static Configuration configureDFSCluster ( Configuration config , String localDFSLocation , String bindIP , int namenodeRpcPort , int namenodeHttpPort , int datanodePort , int datanodeIpcPort , int datanodeHttpPort ) { logger . info ( "HDFS force binding to ip: " + bindIP ) ; config = new KiteCompatibleConfiguration ( config , bindIP , namenodeRpcPort , namenodeHttpPort ) ; config . set ( DFSConfigKeys . FS_DEFAULT_NAME_KEY , "hdfs://" + bindIP + ":" + namenodeRpcPort ) ; config . set ( DFSConfigKeys . DFS_DATANODE_ADDRESS_KEY , bindIP + ":" + datanodePort ) ; config . set ( DFSConfigKeys . DFS_DATANODE_IPC_ADDRESS_KEY , bindIP + ":" + datanodeIpcPort ) ; config . set ( DFSConfigKeys . DFS_DATANODE_HTTP_ADDRESS_KEY , bindIP + ":" + datanodeHttpPort ) ; // When a datanode registers with the namenode, the Namenode do a hostname // check of the datanode which will fail on OpenShift due to reverse DNS // issues with the internal IP addresses. This config disables that check, // and will allow a datanode to connect regardless. config . setBoolean ( "dfs.namenode.datanode.registration.ip-hostname-check" , false ) ; config . set ( "hdfs.minidfs.basedir" , localDFSLocation ) ; // allow current user to impersonate others String user = System . getProperty ( "user.name" ) ; config . set ( "hadoop.proxyuser." + user + ".groups" , "*" ) ; config . set ( "hadoop.proxyuser." + user + ".hosts" , "*" ) ; return config ; }
Configure the DFS Cluster before launching it .