赞
踩
一、Zookeeper正常部署
首先保证Zookeeper集群的正常部署,并启动(每个节点都要启动)
二、Hadoop正常部署
Hadoop集群的正常部署并启动:start-dfs.sh start-yarn.sh
三、HBase解压
执行:tar -zxvf hbase-1.3.6-bin.tar.gz
四、修改配置文件(/usr/local/hbase-1.3.6/conf)
export JAVA_HOME=/opt/module/jdk1.8.0_144
<value>hdfs://mycentOS601:9000/hbase</value>
<name>hbase.cluster.distributed</name>
<!-- 0.98后的新变动,之前版本没有port,默认端口为60000 -->
<name>hbase.master.port</name>
<name>hbase.zookeeper.quorum</name>
<value>myCentOS601:2181,myCentOS602:2181,myCentOS603:2181</value>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/zookeeper-3.4.14/Data</value>
4)软连接hadoop配置文件到/usr/local/hbase-1.3.6/conf下
[root@mycentOS601 conf]# ln -s /usr/local/hadoop-2.6.4/etc/hadoop/core-site.xml /usr/local/hbase-1.3.6/conf/core-site.xml
[root@mycentOS601 conf]# ln -s /usr/local/hadoop-2.6.4/etc/hadoop/hdfs-site.xml /usr/local/hbase-1.3.6/conf/hdfs-site.xml
蓝色字体:软链接成功后可以执行more查看生成文件 判断是否成功
[root@mycentOS601 conf]# scp -r /usr/local/hbase-1.3.6 mycentOS602:/usr/local/hbase-1.3.6
[root@mycentOS601 conf]# scp -r /usr/local/hbase-1.3.6 mycentOS603:/usr/local/hbase-1.3.6
启动命令:start-hbase.sh 停止命令:stop-hbase.sh
[root@hadoop101 hbase]$ bin/hbase-daemon.sh start master
[root@hadoop101 hbase]$ bin/hbase-daemon.sh start regionserver
提示:如果集群之间的节点时间不同步,会导致regionserver无法启动,抛出ClockOutOfSyncException异常。
b、属性:hbase.master.maxclockskew设置更大的值
<name>hbase.master.maxclockskew</name>
<description>Time difference of regionserver from master</description>
启动成功后,可以通过“host:port”的方式来访问HBase管理页面,例如:
[root@hadoop101 hbase]$ bin/hbase shell
hbase(main):002:0> create 'student','info' (单双引号无所谓)
hbase(main):003:0> put 'student','1001','info:sex','male'
hbase(main):004:0> put 'student','1001','info:age','18'
hbase(main):005:0> put 'student','1002','info:name','Janna'
hbase(main):006:0> put 'student','1002','info:sex','female'
hbase(main):007:0> put 'student','1002','info:age','20'
hbase(main):008:0> scan 'student'
hbase(main):009:0> scan 'student',{STARTROW => '1001', STOPROW => '1002'}
hbase(main):010:0> scan 'student',{STARTROW => '1001'}
hbase(main):011:0> describe 'student'
hbase(main):012:0> put 'student','1001','info:name','Nick'
hbase(main):013:0> put 'student','1001','info:age','100'
hbase(main):014:0> get 'student','1001'
hbase(main):015:0> get 'student','1001','info:name'
hbase(main):021:0> count 'student'
hbase(main):016:0> deleteall 'student','1001'
hbase(main):017:0> delete 'student','1002','info:sex'
hbase(main):018:0> truncate 'student'
提示:清空表的操作顺序为先disable,然后再truncate。
hbase(main):019:0> disable 'student'
hbase(main):020:0> drop 'student'
提示:如果直接drop表,会报错:ERROR: Table student is enabled. Disable it first.
hbase(main):022:0> alter 'student',{NAME=>'info',VERSIONS=>3}
hbase(main):022:0> get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。