解压:
tar -zxvf hbase-1.2.1-bin.tar.gz
配置文件(/usr/local/src/hbase-1.2.1/conf路径下):
vi hbase-env.sh
export JAVA_HOME=/usr/local/src/jdk1.8.0_181/(27)
配置文件:
vi hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>/usr/local/src/hbase-1.2.1/HBASE</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave1,slave2</value>
</property>
</configuration>
分发:
scp -r /usr/local/src/hbase-1.2.1 slave1:/usr/local/src/
scp -r /usr/local/src/hbase-1.2.1 slave2:/usr/local/src/
启动:
zkServer.sh start zoo.cfg
查看状态:
zkServer.sh status
配置环境变量:
vi /etc/profile
export HB_HOME=/usr/local/src/hbase-1.2.1
export PATH=$PATH:$HB_HOME/bin
分发:
scp -r /etc/profile slave1:/etc/profile
scp -r /etc/profile slave2:/etc/profile
刷新:
source /etc/profile
启动hbase:
start-hbase.sh
进入hbase网站:60010 / 16010
进入Hbase:
hbase shell
查询Hbase数据库中的表:
list
Hbase数据库中的表失效(先失效才能删除):
disable 'aa'
Hbase数据库中的表删除:
drop 'aa'
创建表:
create 'student','stu_info'
插入列:
put 'student','row1','stu_info:name','zhangsan'
put 'student','row1','stu_info:sex','nan'
put 'student','row1','stu_info:addr','henan'
扫描文件:
scan 'student'
查看全部列:
get 'student','row1'
查看单列:
get 'student','row1','stu_info:addr'