The node /hbase-unsecure is not in ZooKeeper.

重点内容

首先先确认您的Hadoop版本与Hbase是否兼容,否则一切都是扯淡
各hbase版本对hadoop各版本的支持情况

之前以为单机式Hadoop不需要配置hbase.cluster.distributed,遂在hbase-site.xml中将其删除导致以下错误:

2016-08-15 23:20:36,028 ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase-unsecure is not in ZooKeeper. It shoulne configured in the master.

或者

2016-08-15 22:53:06,127 ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.

解决方法:
将hbase-site.xml修改如下:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<configuration>
    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://hadoop.master:9000/hbase</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>/home/hadoop/zookeeper/data</value>
    </property>
**<property>  
    <name>hbase.cluster.distributed</name>  
    <value>true</value>  
  </property>**
    <property>
        <name>hbase.zookeeper.property.clientPort</name>
        <value>2181</value>
    </property>
     <property>
        <name>zookeeper.znode.parent</name>
        <value>/hbase-unsecure</value>
    </property>
    <property>
         <name>hbase.zookeeper.quorum</name>
         <value>localhost</value>
    </property>
    <property>
         <name>dfs.replication</name>
         <value>1</value>
    </property>
    <property>
         <name>hbase.zookeeper.quorum</name>
         <value>localhost</value>
    </property>
    <property>
        <name>hbase.master</name> 
        <value>hadoop.master:60000</value>
        </property>
</configuration>

重点内容
验证:
1.启动HBASE
2.JPS

[root@hadoop hbase]# bin/start-hbase.sh
starting master, logging to /usr/hbase/bin/../logs/hbase-root-master-hadoop.master.out
hadoop.master: starting regionserver, logging to /usr/hbase/bin/../logs/hbase-root-regionserver-hadoop.master.out
[root@hadoop hbase]# jps
26704 OperateTable
15185 ResourceManager
23522 QuorumPeerMain
14195 NameNode
14323 DataNode
15283 NodeManager
14486 SecondaryNameNode
26472 OperateTable
30730 Jps
18366 org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
30446 HMaster
### 解决 HBase 配置文件权限不足的问题 在 Linux 系统上操作 HBase 的配置文件时,如果遇到权限不足的问题,可以通过调整文件的权限或切换到具有适当权限的用户来解决问题。 #### 调整文件权限 可以使用 `chmod` 和 `chown` 命令更改文件的权限和所属用户组。以下是具体方法: 1. **查看当前文件权限** 使用以下命令检查 `hbase-site.xml` 文件的当前权限: ```bash ls -l conf/hbase-site.xml ``` 2. **修改文件权限** 如果发现权限不足,可以增加读写权限给特定用户或用户组: ```bash chmod 644 conf/hbase-site.xml ``` 这条命令将设置文件权限为 `-rw-r--r--`,即文件拥有者可读写,其他用户只可读[^1]。 3. **更改文件所有者** 将文件的所有权更改为运行 HBase 的用户(例如 `hbase` 用户): ```bash chown hbase:hbase conf/hbase-site.xml ``` 此命令会将文件的所有者和组都设为 `hbase` 用户[^5]。 #### 切换至正确用户 另一种解决方案是切换到有权访问该文件的用户账户。假设 HBase 是由 `hbase` 用户安装并运行,则可以执行以下命令切换用户: ```bash su - hbase ``` 之后再尝试编辑 `conf/hbase-site.xml` 文件即可正常操作。 #### 编辑配置文件 完成上述步骤后,可以直接通过文本编辑器打开并修改 `hbase-site.xml` 文件的内容。例如: ```bash vi conf/hbase-site.xml ``` 或者使用其他编辑工具如 nano 或 gedit 完成编辑工作。 #### 启动与验证 当成功保存修改后的配置文件后,记得重新启动 HBase 服务使改动生效: ```bash ./bin/start-hbase.sh ``` 同样,在结束测试前也可以利用脚本安全地停止服务: ```bash ./bin/stop-hbase.sh ``` 以上过程确保了整个环境的一致性和稳定性[^4]。 --- ### 注意事项 - 在生产环境中应谨慎授予过高权限以免引发安全隐患。 - 推荐始终以最小化原则分配必要的访问级别而非完全开放模式。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值