hbase 安装与启动

前提:已经安装hadoop(本文版本1.0.1)

1.
解压hbase包,无需安装
tar xfz hbase-0.94.0.tar.gz


2.
在conf/hbase-site.xml,设置存储位置,可以是hdfs,也可以是本地文件系统

<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
<!-- <value>file:///home/hbase</value> -->
</property>
</configuration>

3.
为了方便,导入环境变量
export HBASE_HOME=/usr/hbase-0.94.0
export PATH=$PATH:$HBASE_HOME/bin


4.
消除slf4j的包冲突
mv slf4j-api-1.5.8.jar slf4j-api-1.5.8.jar.bak
mv slf4j-log4j12-1.5.8.jar slf4j-log4j12-1.5.8.jar.bak

5.
启动hbase
start-hbase.sh

必须先启动hadoop-dfs ,版本1.0.1

日志:/安装目录/logs


6.
通过命令行链接hbase
hbase shell

7.
帮助命令 help

提示:
HBase Shell, version 0.94.0, r1332822, Tue May 1 21:43:54 UTC 2012
Type 'help "COMMAND"', (e.g. 'help "get"' -- the quotes are necessary) for help on a specific command.
Commands are grouped. Type 'help "COMMAND_GROUP"', (e.g. 'help "general"') for help on a command group.

COMMAND GROUPS:
Group name: general
Commands: status, version

Group name: ddl
Commands: alter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, is_disabled, is_enabled, list, show_filters

Group name: dml
Commands: count, delete, deleteall, get, get_counter, incr, put, scan, truncate

Group name: tools
Commands: assign, balance_switch, balancer, close_region, compact, flush, hlog_roll, major_compact, move, split, unassign, zk_dump

Group name: replication
Commands: add_peer, disable_peer, enable_peer, list_peers, remove_peer, start_replication, stop_replication

Group name: security
Commands: grant, revoke, user_permission

SHELL USAGE:
Quote all names in HBase Shell such as table and column names. Commas delimit
command parameters. Type <RETURN> after entering a command to run it.
Dictionaries of configuration used in the creation and alteration of tables are
Ruby Hashes. They look like this:

{'key1' => 'value1', 'key2' => 'value2', ...}

and are opened and closed with curley-braces. Key/values are delimited by the
'=>' character combination. Usually keys are predefined constants such as
NAME, VERSIONS, COMPRESSION, etc. Constants do not need to be quoted. Type
'Object.constants' to see a (messy) list of all constants in the environment.

If you are using binary keys or values and need to enter them in the shell, use
double-quote'd hexadecimal representation. For example:

hbase> get 't1', "key\x03\x3f\xcd"
hbase> get 't1', "key\003\023\011"
hbase> put 't1', "test\xef\xff", 'f1:', "\x01\x33\x40"

The HBase shell is the (J)Ruby IRB with the above HBase-specific commands added.
For more on the HBase Shell, see http://hbase.apache.org/docs/current/book.html

例如:help "create"


8.
创建名为test的表,表有一个列族cf。

create 'test', 'cf'
put 'test', 'row1', 'cf:a', 'value1'
put 'test', 'row2', 'cf:b', 'value2'
put 'test', 'row3', 'cf:c', 'value3'


查询表
scan 'test'


获取单独的一行
get 'test', 'row1'

禁用和删除 表
disable 'test'
drop 'test'

9.
退出命令行
exit


10.
web用户界面
http://ip:60010/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值