HBase exception: Java.io.IOException:Unable to determine ZooKeeper ensemble

Source: Internet
Author: User

In the project to use HBase, sometimes may report some anomalies, such as java.io.IOException:Unable to determine ZooKeeper ensemble and so on, when this problem occurs, such as the project in the use of thread pool caused by the problem, However, after viewing the exception, it is not related to the thread pool, the exception information is as follows:

java.io.IOException:Unable to determine ZooKeeper ensemble at Org.apache.hadoop.hbase.zookeeper.ZKUtil.connect ( Zkutil.java:120) at Org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init> (zookeeperwatcher.java:165) at Org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init> (zookeeperwatcher.java:134) at org.apache.hadoop.hbase.client.ZooKeeperKeepAliveConnection.<init> (zookeeperkeepaliveconnection.java:43) at org.apache.hadoop.hbase.client.hconnectionmanager$ Hconnectionimplementation.getkeepalivezookeeperwatcher (Hconnectionmanager.java:1710) at Org.apache.hadoop.hbase.client.ZooKeeperRegistry.isTableOnlineState (Zookeeperregistry.java:100) at org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.istabledisabled ( Hconnectionmanager.java:879) at Org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.relocateregion ( Hconnectionmanager.java:1032) at Org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.locateregioninmeta ( Hconnectionmanager.java:1255) at Org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.locateregion ( Hconnectionmanager.java:1059) at Org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.locateregion ( Hconnectionmanager.java:1016) at Org.apache.hadoop.hbase.client.HTable.finishSetup (Htable.java:326) at org.apache.hadoop.hbase.client.HTable.<init> (htable.java:310) at Org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.gettable ( Hconnectionmanager.java:712) at Org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.gettable ( Hconnectionmanager.java:694) at Org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.gettable ( Hconnectionmanager.java:684) at Net.shgaoxin.eastdaytoprankblack.db.HbaseConnEastdayminisite.gethbasetable ( Hbaseconneastdayminisite.java:80) at Net.shgaoxin.eastdaytoprankblack.db.LinkDBeastdayminisite.checkpageinhbase (Linkdbeastdayminisite.java: 195) at Net.shgaoxin.eastdaytoprankblack.db.HbasePersistent.execute (Hbasepersistent.java:41) at Net.shgaoxin.eastdaytoprankblack.servlet.ToprankblackServlet.doPost (Toprankblackservlet.java:61) at Net.shgaoxin.eastdaytoprankblack.servlet.ToprankblackServlet.doGet (Toprankblackservlet.java:33) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:624) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:731) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:303) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:208) at Org.apache.tomcat.websocket.server.WsFilter.doFilter (Wsfilter.java:52) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:241) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:208) at Org.apache.catalina.core.StandardWrapperValve.invoke (Standardwrappervalve.java:220) at Org.apache.catalina.core.StandardContextValve.invoke (Standardcontextvalve.java:122) at Org.apache.catalina.authenticator.AuthenticatorBase.invoke (Authenticatorbase.java:505) at Org.apache.catalina.core.StandardHostValve.invoke (Standardhostvalve.java:170) at Org.apache.catalina.valves.ErrorReportValve.invoke (Errorreportvalve.java:103) at Org.apache.catalina.valves.AccessLogValve.invoke (Accesslogvalve.java:957) at Org.apache.catalina.core.StandardEngineValve.invoke (Standardenginevalve.java:116) at Org.apache.catalina.connector.CoyoteAdapter.service (Coyoteadapter.java:423) at Org.apache.coyote.http11.AbstractHttp11Processor.process (Abstracthttp11processor.java:1079) at Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (Abstractprotocol.java:620) at Org.apache.tomcat.util.net.jioendpoint$socketprocessor.run (Jioendpoint.java:316) at Java.util.concurrent.ThreadPoolExecutor.runWorker (Threadpoolexecutor.java:1145) at Java.util.concurrent.threadpoolexecutor$worker.run (Threadpoolexecutor.java:615) at Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (Taskthread.java:61)

View Source Zookeeperwatcher class:

1    PublicZookeeperwatcher (Configuration conf, String identifier,2Abortable abortable,BooleanCancreatebaseznode)3   throwsIOException, zookeeperconnectionexception {4      This. conf =conf;5     //Capture a stack trace now. Would print it out later if problem so we can6     //Distingush amongst the myriad Zkws.7     Try {8       Throw NewException ("ZKW CONSTRUCTOR STACK TRACE for debugging");9}Catch(Exception e) {Ten        This. Constructorcaller =e; One     } A      This. Quorum =zkconfig.getzkquorumserversstring (conf); -     //Identifier'll get the SessionID appended later below down when we -     //Handle the Syncconnect event. the      This. identifier =identifier; -      This. abortable =abortable; - setnodenames (conf); -      This. Recoverablezookeeper = Zkutil.connect (conf, quorum, This, identifier); +     if(cancreatebaseznode) { - createbaseznodes (); +     } A}

From the source can be learned that there is a problem with zookeeper address, and then look at the Zkconfig class amount method:

1   Public StaticString getzkquorumserversstring (Properties properties) {2String ClientPort =NULL;3list<string> servers =NewArraylist<string>();4 5     //The ClientPort option may be come after the server. X hosts, so we need to6     //grab everything and then create the final host:port comma separated list.7     BooleanAnyvalid =false;8      for(entry<object,object>Property:properties.entrySet ()) {9String key =Property.getkey (). toString (). Trim ();TenString value =Property.getvalue (). toString (). Trim (); One       if(Key.equals ("ClientPort")) { AClientPort =value; -       } -       Else if(Key.startswith ("Server."))) { theString host = value.substring (0, Value.indexof (': '))); - Servers.add (host); -         Try { -           //noinspection resultofmethodcallignored + Inetaddress.getbyname (host); -Anyvalid =true; +}Catch(unknownhostexception e) { A Log.warn (Stringutils.stringifyexception (e)); at         } -       } -     } -  -     if(!anyvalid) { -Log.error ("No valid quorum servers found in" +hconstants.zookeeper_config_name); in       return NULL; -     } to  +     if(ClientPort = =NULL) { -Log.error ("No clientport found in" +hconstants.zookeeper_config_name); the       return NULL; *     } $ Panax Notoginseng     if(Servers.isempty ()) { -Log.fatal ("No servers were found in provided ZooKeeper configuration." + the"HBase must has a ZooKeeper cluster configured for it" + +"Operation. Ensure that ' ve configured ' + AHconstants.zookeeper_quorum + "' properly."); the       return NULL; +     } -  $StringBuilder Hostportbuilder =NewStringBuilder (); $      for(inti = 0; I < servers.size (); ++i) { -String host =Servers.get (i); -       if(I > 0) { theHostportbuilder.append (', '); -       }Wuyi Hostportbuilder.append (host); theHostportbuilder.append (': ')); - hostportbuilder.append (clientport); Wu     } -  About     returnhostportbuilder.tostring (); $}

It is basically possible to determine that the corresponding address of the zookeeper is inaccessible. Not the thread pool problem, with the program used in the thread pool is not a half-dime relationship, this argument is terrible ah ...

HBase exception: Java.io.IOException:Unable to determine ZooKeeper ensemble

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.