HBase搭建,HBase Shell命令

[root@master ~]# jps
53559 ResourceManager
53181 NameNode
105100 Jps
53390 SecondaryNameNode
105070 QuorumPeerMain
[root@master ~]# hdfs dfsadmin -safemode leave
Safe mode is OFF
[root@master ~]# cd /usr/local/soft/packages/
[root@master packages]# ls
apache-hive-1.2.1-bin.tar.gz  redis-6.2.6.tar.gz
hadoop-2.7.6.tar.gz           zookeeper-3.4.6.tar.gz
[root@master packages]# rz -E
rz waiting to receive.
[root@master packages]# ls
apache-hive-1.2.1-bin.tar.gz  redis-6.2.6.tar.gz
hadoop-2.7.6.tar.gz           zookeeper-3.4.6.tar.gz
hbase-1.4.6-bin.tar.gz
[root@master packages]# tar -zxvf hbase-1.4.6-bin.tar.gz -C /usr/local/soft
[root@master packages]# cd ..
[root@master soft]# ls
0??           hive-1.2.1    redis-6.2.6  test.txt
A??           jars          scripts      zookeeper-3.4.6
data          jdk1.8.0_171  shell
hadoop-2.7.6  packages      shell01
hbase-1.4.6   redis         show
[root@master soft]# cd hbase-1.4.6/
[root@master hbase-1.4.6]# pwd
/usr/local/soft/hbase-1.4.6
[root@master hbase-1.4.6]# vim /etc/profile
[root@master hbase-1.4.6]# source /etc/profile
[root@master hbase-1.4.6]# hbase
hbase             hbase-config.sh   hbase-jruby
hbase-cleanup.sh  hbase-daemon.sh   
hbase-common.sh   hbase-daemons.sh  
[root@master hbase-1.4.6]# cd bin/
[root@master bin]# ls
draining_servers.rb     master-backup.sh
get-active-master.rb    region_mover.rb
graceful_stop.sh        regionservers.sh
hbase                   region_status.rb
hbase-cleanup.sh        replication
hbase.cmd               rolling-restart.sh
hbase-common.sh         shutdown_regionserver.rb
hbase-config.cmd        start-hbase.cmd
hbase-config.sh         start-hbase.sh
hbase-daemon.sh         stop-hbase.cmd
hbase-daemons.sh        stop-hbase.sh
hbase-jruby             test
hirb.rb                 thread-pool.rb
local-master-backup.sh  zookeepers.sh
local-regionservers.sh
[root@master bin]# pwd
/usr/local/soft/hbase-1.4.6/bin
[root@master bin]# cd ..
[root@master hbase-1.4.6]# ls
bin          conf  hbase-webapps  lib          NOTICE.txt
CHANGES.txt  docs  LEGAL          LICENSE.txt  README.txt

修改hbase-env.sh文件
增加java配置
export JAVA_HOME=/usr/local/soft/jdk1.8.0_171

关闭默认zk配置
export HBASE_MANAGES_ZK=false

修改hbase-site.xml文件

   <property> 
      <name>hbase.rootdir</name> 
      <value>hdfs://master:9000/hbase</value> 
   </property> 
   <property> 
      <name>hbase.cluster.distributed</name> 
      <value>true</value> 
   </property> 
   <property> 
      <name>hbase.zookeeper.quorum</name> 
      <value>node1,node2,master</value> 
   </property> 


修改regionservers文件
增加
node1
node2

[root@master conf]# vim hbase-env.sh
[root@master conf]# vim hbase-env.sh
[root@master conf]# vim regionservers 
[root@master conf]# vim hbase-site.xml 
[root@master conf]# cd ..
[root@master hbase-1.4.6]# cd ..
[root@master soft]# ls
0??           hive-1.2.1    redis-6.2.6  test.txt
A??           jars          scripts      zookeeper-3.4.6
data          jdk1.8.0_171  shell
hadoop-2.7.6  packages      shell01
hbase-1.4.6   redis         show
[root@master soft]# scp -r hbase-1.4.6/ node1:`pwd`
[root@master soft]# scp -r hbase-1.4.6/ node2:`pwd`
[root@master soft]# cd hbase-1.4.6/
[root@master hbase-1.4.6]# ls
bin          conf  hbase-webapps  lib          NOTICE.txt
CHANGES.txt  docs  LEGAL          LICENSE.txt  README.txt
[root@master hbase-1.4.6]# start-hbase.sh
running master, logging to /usr/local/soft/hbase-1.4.6/bin/../logs/hbase-root-master-master.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
node2: running regionserver, logging to /usr/local/soft/hbase-1.4.6/bin/../logs/hbase-root-regionserver-node2.out
node1: running regionserver, logging to /usr/local/soft/hbase-1.4.6/bin/../logs/hbase-root-regionserver-node1.out
node2: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
node2: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
node1: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
node1: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
[root@master hbase-1.4.6]# jps
106066 Jps
53559 ResourceManager
105798 HMaster
53181 NameNode
53390 SecondaryNameNode
105070 QuorumPeerMain

master:16010

[root@master hbase-1.4.6]# ls
bin          docs           lib          NOTICE.txt
CHANGES.txt  hbase-webapps  LICENSE.txt  README.txt
conf         LEGAL          logs
[root@master hbase-1.4.6]# cd logs/
[root@master logs]# ls
hbase-root-master-master.log  SecurityAuth.audit
hbase-root-master-master.out
[root@master logs]# hbase shell
hbase(main):002:0> create 'tb1','cf1'
0 row(s) in 2.4550 seconds

=> Hbase::Table - tb1
hbase(main):003:0> list
TABLE                                                           
tb1                                                             
1 row(s) in 0.0160 seconds

=> ["tb1"]
hbase(main):004:0> disable 'tb1'
0 row(s) in 2.2600 seconds

hbase(main):005:0> enable 'tb1'
0 row(s) in 1.2600 seconds

hbase(main):006:0> create
create             create_namespace

hbase(main):007:0> create_namespace 'ns1'
0 row(s) in 0.8860 seconds

hbase(main):008:0> list
list                         list_deadservers
list_labels                  list_namespace
list_namespace_tables        list_peer_configs
list_peers                   list_procedures
list_quotas                  list_regions
list_replicated_tables       list_rsgroups
list_security_capabilities   list_snapshots
list_table_snapshots
hbase(main):008:0> list_namespace
list_namespace          list_namespace_tables
hbase(main):008:0> list_namespace
NAMESPACE                                                       
default                                                         
hbase                                                           
ns1                                                             
3 row(s) in 0.0240 seconds

hbase(main):009:0> create 'tb2','cf1'
0 row(s) in 2.2460 seconds

=> Hbase::Table - tb2
hbase(main):010:0> create 'ns1:tb3','cf1'
0 row(s) in 2.2450 seconds

=> Hbase::Table - ns1:tb3
hbase(main):011:0> list_namespace
list_namespace          list_namespace
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值