hbase 单机安装部署

hbase 单机安装部署hbase 单机安装部署

大家好,又见面了,我是你们的朋友全栈君。

这个困扰了很长时间,之前使用cdh版本的,各种报错各种出问题,最终换成了不是cdh版本的。

下载地址如下:

https://pan.baidu.com/s/14pQ6HbTB-s63cfAbpG50LA

解压

这是我的解压目录:

xiaoye@ubuntu3:~/Downloads/hbase$ pwd
/home/xiaoye/Downloads/hbase

好了后,修改conf目录下的hbase-site.xml 文件

加入以下内容:

<configuration>
<property>
<name>hbase.rootdir</name> 
    <value>file:///home/xiaoye/Downloads/hbase/hbase_tmp</value>
</property>
</configuration>

在有的博文中有介绍说要在/etc/hosts中配置ip与主机名映射。其实这里只要你使用crt远程工具连虚拟机就已经说明,你已经配置了映射。不过这里小编也给出自己的配置。读者朋友可自行跳过,后面报错的话再 试试。

hbase 单机安装部署

只用关注我箭头指的地方就行了。其他请自行忽略。

然后到bin目录下启动hbase

./start-hbase.sh 

最后进入到脚本编辑:

./hbase shell
xiaoye@ubuntu3:~$ hbase shell
2018-07-09 20:49:05,941 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/xiaoye/Downloads/hbase/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/xiaoye/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
Version 1.4.5, rca99a9466415dc4cfc095df33efb45cb82fe5480, Wed Jun 13 15:13:00 EDT 2018

hbase(main):001:0> create 'student',{NAME =>'info'},{NAME => 'data'}
0 row(s) in 2.0760 seconds

=> Hbase::Table - student
hbase(main):002:0> desc 'student'
Table student is ENABLED                                                        
student                                                                         
COLUMN FAMILIES DESCRIPTION                                                     
{NAME => 'data', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATIO
N_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL
 => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY =>
 'false', BLOCKCACHE => 'true'}                                                 
{NAME => 'info', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATIO
N_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL
 => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY =>
 'false', BLOCKCACHE => 'true'}                                                 
2 row(s) in 0.5130 seconds

hbase(main):003:0> put 'student','001','info:name','tom'
0 row(s) in 0.4860 seconds

hbase(main):004:0> get 'student','001'
COLUMN                CELL                                                      
 info:name            timestamp=1531194644784, value=tom                        
1 row(s) in 0.1070 seconds

hbase(main):005:0> scan 'student'
ROW                   COLUMN+CELL                                               
 001                  column=info:name, timestamp=1531194644784, value=tom      
1 row(s) in 0.0310 seconds

hbase(main):006:0>

上面有建表,插入数据,浏览表结构,表内容,获取表数据的命令。

——————————————————————————————-

下面是可有可无的,

配置环境变量:

我习惯在当前用户下设置环境变量:

xiaoye@ubuntu3:~$ vim .bashrc 
export HBASE_HOME=/home/xiaoye/Downloads/hbase
export PATH=$PATH:$HBASE_HOME/bin

保存后,source .bashrc 就行了。

然后就能在当前用户下,任何目录直接使用:hbase -version

hbase shell等命令。比较方便。

————————————————————————————————————————

如果有朋友在使用其他版本的hbase出现,类似:

535)
        at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:112)
        at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:95)
        at org.jruby.runtime.Block.yield(Block.java:130)
        at org.jruby.RubyContinuation.enter(RubyContinuation.java:106)
        at org.jruby.RubyKernel.rbCatch(RubyKernel.java:1212)
        at org.jruby.RubyKernel$s$1$0$rbCatch.call(RubyKernel$s$1$0$rbCatch.gen:65535)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:322)
        at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:178)
        at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:187)
        at home.xiaoye.Downloads.hbase.bin.$_dot_dot_.bin.hirb.method__5$RUBY$start(/home/xiaoye/Downloads/hbase/bin/../bin/hirb.rb:204)
        at home$xiaoye$Downloads$hbase$bin$$_dot_dot_$bin$hirb$method__5$RUBY$start.call(home$xiaoye$Downloads$hbase$bin$$_dot_dot_$bin$hirb$method__5$RUBY$start:65535)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:203)
        at org.jruby.internal.runtime.methods.CompiledMethod.call(CompiledMethod.java:255)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:292)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:135)
        at home.xiaoye.Downloads.hbase.bin.$_dot_dot_.bin.hirb.__file__(/home/xiaoye/Downloads/hbase/bin/../bin/hirb.rb:210)
        at home.xiaoye.Downloads.hbase.bin.$_dot_dot_.bin.hirb.load(/home/xiaoye/Downloads/hbase/bin/../bin/hirb.rb)
        at org.jruby.Ruby.runScript(Ruby.java:697)
        at org.jruby.Ruby.runScript(Ruby.java:690)
        at org.jruby.Ruby.runNormally(Ruby.java:597)
        at org.jruby.Ruby.runFromMain(Ruby.java:446)
        at org.jruby.Main.doRunFromMain(Main.java:369)
        at org.jruby.Main.internalRun(Main.java:258)
        at org.jruby.Main.run(Main.java:224)
        at org.jruby.Main.run(Main.java:208)
        at org.jruby.Main.main(Main.java:188)

这种错误就直接换版本吧,就换成我这个hbase版本的。准行。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/106079.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号