前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >hbase 单机安装部署

hbase 单机安装部署

作者头像
全栈程序员站长
发布2022-08-09 15:04:47
6330
发布2022-08-09 15:04:47
举报
文章被收录于专栏:全栈程序员必看

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

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

下载地址如下:

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

解压

这是我的解压目录:

代码语言:javascript
复制
xiaoye@ubuntu3:~/Downloads/hbase$ pwd
/home/xiaoye/Downloads/hbase

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

加入以下内容:

代码语言:javascript
复制
<configuration>
<property>
<name>hbase.rootdir</name> 
    <value>file:///home/xiaoye/Downloads/hbase/hbase_tmp</value>
</property>
</configuration>

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

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

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

然后到bin目录下启动hbase

代码语言:javascript
复制
./start-hbase.sh 

最后进入到脚本编辑:

代码语言:javascript
复制
./hbase shell
代码语言:javascript
复制
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>

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

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

下面是可有可无的,

配置环境变量:

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

代码语言:javascript
复制
xiaoye@ubuntu3:~$ vim .bashrc 
代码语言:javascript
复制
export HBASE_HOME=/home/xiaoye/Downloads/hbase
export PATH=$PATH:$HBASE_HOME/bin

保存后,source .bashrc 就行了。

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

hbase shell等命令。比较方便。

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

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

代码语言:javascript
复制
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版本的。准行。

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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年4月2,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
TDSQL MySQL 版
TDSQL MySQL 版(TDSQL for MySQL)是腾讯打造的一款分布式数据库产品,具备强一致高可用、全球部署架构、分布式水平扩展、高性能、企业级安全等特性,同时提供智能 DBA、自动化运营、监控告警等配套设施,为客户提供完整的分布式数据库解决方案。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档