What we do in HBase is the following:

this.fs = FileSystem.get(conf);
if (this.fs instanceof DistributedFileSystem) {
  // Make sure dfs is not in safe mode
  String message = "Waiting for dfs to exit safe mode...";
  while (((DistributedFileSystem) fs).setSafeMode(
    FSConstants.SafeModeAction.SAFEMODE_GET)) {
    LOG.info(message);
    try {
      Thread.sleep(this.threadWakeFrequency);
    } catch (InterruptedException e) {
      //continue
    }
  }
}

In Hadoop 0.16, this will fail if you are running with
privileges enabled and your application is not running
as Superuser. However, querying the namenode state does
not require privileges in Hadoop 0.17


---
Jim Kellerman, Senior Engineer; Powerset


> -----Original Message-----
> From: Andy Li [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2008 11:54 PM
> To: [email protected]
> Subject: Re: how to find out name node is running
>
> I believe this class is the one you are looking for.
>
> org.apache.hadoop.dfs.namenode.metrics.NameNodeStatistics
>
> I just went through the API list from the website 0.16.0 and
> found this one.
> A blunt guess is that if you can invoke these method and get
> a response, then you can probably assume the namenode is
> alive.  But you will need to do some code hacking to figure
> out how to use it and study it a little bit to understand
> what is going on underneath to confirm.  Just a reference.
>
> -Andy
>
> On Tue, Mar 25, 2008 at 11:16 PM, Ipraveen
> <[EMAIL PROTECTED]> wrote:
>
> >
> > yes you are right Andy , i want to know is there is any
> hadoop library
> > api which can trace name node or datnode  ?
> >
> >
> > Andy Li-3 wrote:
> > >
> > > That's relying on Java Virtual Machine process status
> tool, similar
> > > to
> > 'ps
> > > aux|grep java' on a Linux?
> > >
> > > I think the question is whether there is any API from
> Hadoop library
> > which
> > > can monitor the namenode
> > > through a Java API without relying 3rd party utility
> tool.  Am I right?
> > >
> > > -Andy
> > >
> > > On Tue, Mar 25, 2008 at 6:26 AM, Zhu Huijun <[EMAIL PROTECTED]>
> > wrote:
> > >
> > >> Type the command "jps" in your command window. If your
> name node is
> > >> running, there will be an output item of "Namenode". Or
> check the
> > >> web page at http://localhost:50070 if you did not change the
> > >> default server host
> > and
> > >> port of the web.
> > >>
> > >> 2008/3/25, Ipraveen <[EMAIL PROTECTED]>:
> > >> >
> > >> >
> > >> > hi
> > >> > how would i know whether a name node is runnning or not?
> > >> > by using hadoop API for java.
> > >> >
> > >> > regards
> > >> > praveen jain
> > >> > --
> > >> > View this message in context:
> > >> >
> > >>
> >
> http://www.nabble.com/how-to-find-out-name-node-is-running-tp16274770p
> > 16274770.html
> > >> > Sent from the Hadoop core-dev mailing list archive at
> Nabble.com.
> > >> >
> > >> >
> > >>
> > >
> > >
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/how-to-find-out-name-node-is-running-tp16274770p
> > 16296276.html Sent from the Hadoop core-dev mailing list archive at
> > Nabble.com.
> >
> >
>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.519 / Virus Database: 269.22.0/1344 - Release
> Date: 3/26/2008 8:52 AM
>
>

No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.0/1344 - Release Date: 3/26/2008 8:52 
AM

Reply via email to