【Hbase学习笔记】1.Hbase单机安装Standalone Mode

今年来以为数据还蛮有意思的,打算往这个方向努力了

这里主要仍是以manjaro为案例进行安装,用了很长时间这个系统,逐渐以为这个发行版确实是比Ubuntu要舒服。html

安装JDK

其实shell命令也不重要,主要是安装JDK,而后设置JAVA_HOME环境变量,虽然在manjaro中默承认以使用java命令,可是安装并无设置JAVA_HOME环境变量,hbase启动脚步仍是经过环境获取java的目录。因此只要在当前执行目录中能获取JAVA_HOME就能够成功启动hbase。java

这个我感受很多程序员都没有真正理解环境变量这玩意,环境变量在平常开发中仍是比较有用的一个东西,在Linux下能够用 env获取当前所有的环境,或者使用echo ${name}, {name}指你须要的获取环境变量名,如 echo $JAVA_HOME,使用echo打印环境变量是一个很基本的操做。
sudo pacman -S jdk8-openjdk

# 在添加java到环境变量中
echo 'export JAVA_HOME=/usr/lib/jvm/java-8-openjdk' >>  conf/hbase-env.sh

下载hbase的二进制压缩包

hbase官方下载地址程序员

下载的话能够根据须要,我以为我的学习仍是下最新的吧,哈哈哈shell

通常来讲都是下载带有releasebin的连接,src表明源码,至于sha512/asc这种就是校验下载是否是完整的。express

下载完成能够解压到你想放的目录,我习惯放在home目录下apache

tar -C $HOME/Bin/ -zxvf hbase-2.2.2-bin.tar.gz

修改配置

进入解压的目录,找到conf/hbase-site.xml的文件,原来的文件应该是app

<?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>
</configuration>

在<configuration>中添加less

<property>
        <name>hbase.rootdir</name>
        <value>file://{pathname}</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>{zookeeper-pathname}</value>
    </property>
    <property>
        <name>hbase.unsafe.stream.capability.enforce</name>
        <value>false</value>
    </property>
讲解下参数
  • hbase.rootdir:hbase写入数据的位置,默认是在/tmp目录下新建,不过这样开关机就会消失,因此须要你指定一个路径,我通常指定home目录下的某个位置,这样启动时不须要目录的权限什么的。
  • hbase.zookeeper.property.dataDir: 这个是zookeeper写入数据的位置
  • hbase.unsafe.stream.capability.enforce: 在local模式下禁用stream.capability (hflush/hsync)的功能,反正单机部署不须要严格数据保证就禁用吧

启动

启动hbase:jvm

./bin/start-hbase.sh

启动shell:oop

➜  bin ./hbase shell
2019-12-15 22:38:39,788 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.2.2, re6513a76c91cceda95dad7af246ac81d46fa2589, Sat Oct 19 10:10:12 UTC 2019
Took 0.0019 seconds                                                                                           
hbase(main):001:0>

关闭hbase:

./bin/stop-hbase.sh

这里就已经能够算是完成了。

相关文章
相关标签/搜索