1.准备工作##
文件:hbase-1.1.2-bin.tar.gz
2.正式环境##
设置环境变量
设置文件 .bashrc
export HBASE_HOME=/home/hadoop/bigdata/hbase export PATH=$HBASE_HOME/bin:$PATH
HBASE_HOME 表示HBASE安装目录
使得配置生效
source .bashrc
验证
[hadoop@master ~]$ echo $HBASE_HOME /home/hadoop/bigdata/hbase
拷贝到slave机器
scp .bashrc hadoop@192.168.0.167:/home/hadoop/ scp .bashrc hadoop@192.168.0.168:/home/hadoop/
验证slave
方法同master端
安装目录
cd /home/hadoop/bigdata/ tar -zxf hbase-1.1.2-bin.tar.gz mv hbase-1.1.2-bin hbase
hbase-env配置
cd /home/hadoop/bigdata/hbase/conf export JAVA_HOME=/usr/java/jdk1.8.0_60
hbase-site配置
cd /home/hadoop/bigdata/hbase/conf
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave01,slave02</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property><name>hbase.zookeeper.property.dataDir</name
<value>/home/hadoop/bigdata/zk/zkdata</value
</property>
RegionServer
slave01 slave02
3.启动&验证##
启动master机器 start-hbase.sh
验证master
[hadoop@master bin]$ jps 14423 HMaster 15162 ResourceManager 4939 QuorumPeerMain 14813 NameNode 15007 SecondaryNameNode 14654 Jps
[hadoop@master bin]$ ./hbase shell SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/hadoop/bigdata/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/hadoop/bigdata/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.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] 2016-01-23 13:56:28,572 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 1.1.2, rcc2b70cf03e3378800661ec5cab11eb43fafe0fc, Wed Aug 26 20:11:27 PDT 2015
slave01
[hadoop@slave02 .ssh]$ jps 14160 Jps 5778 DataNode 11924 QuorumPeerMain 13974 HRegionServer 5886 NodeManager
测试代码
创建一个新表
student create ‘student’,’info’
查看所有的表
list
查看 student 的表结构
describe ‘student’
同 student 表中插入一条数据
put ‘student’,’mary’,’info:age’,’19’
从 student 表中取出 mary 的数据
get ‘student’,’mary’
让 student 表失效
disable ‘student’
删除 student 表
drop ‘student’