Zookeeper无法在hbase伪分布式模式中找到主节点

时间:2017-01-02 06:54:03

标签: hbase hdfs distributed-computing

我想在伪分布式模式下运行hbase,从头开始安装 接下来的步骤

  1. 启动HBase。
  2. 启动HBase主服务器
  3. 启动区域服务器a
  4. 启动HBase Shell
  5. 执行列表
  6. Hbase正常启动所以hbase shell。 当我检查zookeeper时,主人和区域所有服务器都启动了。 对于hbase shell提示符的任何查询,我收到此错误。

      

    错误 - 无法从ZooKeeper获取主地址; znode data == null

    import argparse
    import base64
    import json
    
    
    import httplib2
    from googleapiclient import discovery
    from oauth2client.client import GoogleCredentials
    
    
    if __name__ == '__main__':
       parser = argparse.ArgumentParser()
       parser.add_argument('speech_file',help='This is the path of the audio')
       args = parser.parse_args()
       print args.speech_file
       main(args.speech_file)
    
    def main(speech_file):
        with open(speech_file,'rb') as speech:
             speech_content = base64.b64encode(speech.read())
    
        service = get_speech_service()
        service_request = service.speech().syncrecognize(
        body={
            'config':{
                'encoding':'LINEAR16',
                'sampleRate':16000,
                'languageCode':'en-US',
                },
            'audio':{
                'content':speech_content.decode('UTF-8')
                }
            })
        response = service_request.execute()
        print(json.dumps(response))
    DISCOVERY_URL = ('https://speech.googleapis.com/$discovery/rest?/version=v1beta1')
    
    def get_speech_service():
        credentials = GoogleCredentials.get_application_default().create_scoped(
        ['https://www.googleapis.com/auth/cloud-platform'])
        http = httplib2.Http()
        credentials.authorize(http)
        return    discovery.build('speech','v1beta1',http=http,discoveryServiceUrl=DISCOVERY_URL)
    

    以上是我的code- configuration - hbase-site.xml <configuration> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> //Here you have to set the path where you want HBase to store its files. <property> <name>hbase.rootdir</name> <value>hdfs://localhost:8030/hbase</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/hadoop/zookeeper</value> </property> </configuration> 配置 请帮助我理解我所缺少的东西。

2 个答案:

答案 0 :(得分:1)

需要将以下属性添加到/ hbase / conf文件夹中的hbase xml文件中:

&#13;
&#13;
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2222</value>
<description>Property from ZooKeeper's config zoo.cfg.
The port at which the clients will connect.
</description>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/biadmin/my-local-hbase/zookeeper</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>bivm</value>
</property>
&#13;
&#13;
&#13;

还要编辑hbase-env.sh文件。添加正确的JAVA_HOME路径并取消注释

&#13;
&#13;
export HBASE_MANAGES_ZK=true
&#13;
&#13;
&#13;

这应解决上述错误!

答案 1 :(得分:0)

您还需要在hbase-site.xml中设置此属性:

hbase.zookeeper.quorum