void initSecondary ( Configuration conf ) throws IOException { fsName = AvatarNode . getRemoteNamenodeHttpName ( conf , avatarNode . getInstanceId ( ) ) ; // Initialize other scheduling parameters from the configuration checkpointEnabled = conf . getBoolean ( "fs.checkpoint.enabled" , false ) ; checkpointPeriod = conf . getLong ( "fs.checkpoint.period" , 3600 ) ; checkpointTxnCount = NNStorageConfiguration . getCheckpointTxnCount ( conf ) ; delayedScheduledCheckpointTime = conf . getBoolean ( "fs.checkpoint.delayed" , false ) ? AvatarNode . now ( ) + checkpointPeriod * 1000 : 0 ; // initialize the webserver for uploading files. String infoAddr = NetUtils . getServerAddress ( conf , "dfs.secondary.info.bindAddress" , "dfs.secondary.info.port" , "dfs.secondary.http.address" ) ; InetSocketAddress infoSocAddr = NetUtils . createSocketAddr ( infoAddr ) ; String infoBindIpAddress = infoSocAddr . getAddress ( ) . getHostAddress ( ) ; int tmpInfoPort = infoSocAddr . getPort ( ) ; infoServer = new HttpServer ( "secondary" , infoBindIpAddress , tmpInfoPort , tmpInfoPort == 0 , conf ) ; infoServer . setAttribute ( "name.system.image" , fsImage ) ; this . infoServer . setAttribute ( "name.conf" , conf ) ; infoServer . addInternalServlet ( "getimage" , "/getimage" , GetImageServlet . class ) ; infoServer . start ( ) ; avatarNode . httpServer . setAttribute ( "avatar.node" , avatarNode ) ; avatarNode . httpServer . addInternalServlet ( "outstandingnodes" , "/outstandingnodes" , OutStandingDatanodesServlet . class ) ; // The web-server port can be ephemeral... ensure we have the correct info infoPort = infoServer . getPort ( ) ; conf . set ( "dfs.secondary.http.address" , infoBindIpAddress + ":" + infoPort ) ; LOG . info ( "Secondary Web-server up at: " + infoBindIpAddress + ":" + infoPort ) ; LOG . warn ( "Checkpoint Period :" + checkpointPeriod + " secs " + "(" + checkpointPeriod / 60 + " min)" ) ; if ( delayedScheduledCheckpointTime > 0 ) { LOG . warn ( "Standby: Checkpointing will be delayed by: " + checkpointPeriod + " seconds" ) ; } LOG . warn ( "Log Size Trigger :" + checkpointTxnCount + " transactions." ) ; }
Initialize the webserver so that the primary namenode can fetch transaction logs from standby via http .