Check if in Zookeeper the znode /hbase/master is there. You can easily do this by using org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper.readMasterAddressOrThrow(). This method isn't static, you have to create your own instance.
J-D On Tue, May 11, 2010 at 5:38 AM, Al Lias <al.l...@gmx.de> wrote: > Am 29.03.2010 23:35, schrieb Ted Yu: >> https://issues.apache.org/jira/browse/HBASE-2391 has been filed. >> >> We call HBaseAdmin.isMasterRunning() to see if client has connection with >> HBase. If there is a working alternative, we'd love to use it. >> > > Just to catch up on this....what is the recommended way to > programmatically check if Hbase is up (say on 0.20.4)? > > Thx, > > Al > >> ... >> On Mon, Mar 29, 2010 at 2:25 PM, Jean-Daniel Cryans >> <jdcry...@apache.org>wrote: >> >>> I think this method wasn't updated when we moved to Zookeeper (since >>> in pre-0.20, dead master = dead cluster), also looking at when this is >>> called, I only see it from HMerge and HBaseAdmin.isMasterRunning()... >>> which in turn isn't called anywhere in the java code (I think we call >>> it in the shell tho). >>> >>> So we should first consider if this method is useful at all, and if so >>> then what would be the best fix. For example, if you run a HMerge >>> while the master is down but the region servers are up, you're going >>> to end up with something wrong since it expects hbase to be completely >>> down. >>> >>> Can you open a jira to continue discussions there? >>> >>> Thx! >>> >>> J-D >>> >>> On Mon, Mar 29, 2010 at 2:01 PM, Ted Yu <yuzhih...@gmail.com> wrote: >>>> Hi, >>>> While going over TableServers.isMasterRunning() in HConnectionManager, I >>> see >>>> this: >>>> public boolean isMasterRunning() { >>>> if (this.master == null) { >>>> try { >>>> getMaster(); >>>> >>>> } catch (MasterNotRunningException e) { >>>> return false; >>>> } >>>> } >>>> return true; >>>> } >>>> When isMasterRunning() is called the first time, if master is obtained >>>> successfully, master field would contain reference to HMasterInterface. >>>> Subsequent calls to isMasterRunning() wouldn't throw >>>> MasterNotRunningException even if master server stops responding to >>> clients. >>>> >>>> I think master.isMasterRunning() should be called if master isn't null. >>>> >>>> Regards >>>> >>> >> > >