idea连hbase报错

Exception in thread "main" java.net.SocketTimeoutException: callTimeout=1200000, callDuration=1229322: java.io.IOException: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/master 
    at org.apache.hadoop.hbase.client.RpcRetryingCallerImpl.callWithRetries(RpcRetryingCallerImpl.java:159)
    at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:3089)
    at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:3081)
    at org.apache.hadoop.hbase.client.HBaseAdmin.getNamespaceDescriptor(HBaseAdmin.java:2253)
    at HelloHbase.main(HelloHbase.java:25)
Caused by: org.apache.hadoop.hbase.MasterNotRunningException: java.io.IOException: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/master
 

解决办法:idea 目录里resource里的hbase-site.xml也需要设置zookeeper,追加

        <property>
         <!--hbase依赖的zk地址-->
                <name>hbase.zookeeper.quorum</name>
                <value>master,slave01,slave02,slave03</value>
        </property>
        <property>
            <!--zookeeper的工作目录-->
                <name>hbase.zookeeper.property.dataDir</name>
                <value>/opt/zookeeper/zkData</value>
        </property>
 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐