啥也没写
分类: HADOOP
2013-04-03 15:17:49
原文地址:体验一下HBASE集群 作者:tomsyan
由于项目的需要,最近搞了一下HBASE,刚开始搞,走了不少弯路。
下了一个最新版本的hadoop 装了2天没搞好,最后下了一个稳定版本的,半个小时搞定了,哎苦逼啊。
最终采用的版本如下:
[hadoop@hadoop1 ~]$ ls -ltr
total 36
drwxr-xr-x 10 hadoop hadoop 4096 Feb 6 2012 zookeeper-3.4.3
drwxr-xr-x 15 hadoop hadoop 4096 Apr 1 04:37 hadoop-1.0.4
drwxr-xr-x 11 hadoop hadoop 4096 Apr 2 20:40 hbase-0.94.6
下面体验一下HADOOP集群:
HADOOP ZOOKEEPER HBASE都已经启动
NAMENODE :
[hadoop@hadoop1 ~]$ jps
6555 NameNode
6930 QuorumPeerMain
10501 HMaster
6795 JobTracker
10821 Jps
[hadoop@hadoop1 ~]$
DATANODE:
[hadoop@hadoop2 ~]$ jps
7464 HRegionServer
5590 DataNode
7765 Jps
7387 QuorumPeerMain
[hadoop@hadoop3 ~]$ jps
5600 DataNode
8048 QuorumPeerMain
8581 Jps
8264 HRegionServer
在MASTER节点上创建一个表,并插入2条记录:
[hadoop@hadoop1 ~]$ hbase shell
HBase Shell; enter 'help
Type "exit
Version 0.94.6, r1456690, Thu Mar 14 16:32:05 PDT 2013
hbase(main):001:0> list
TABLE
0 row(s) in 1.2000 seconds
hbase(main):002:0> create 'huateng','cf'
0 row(s) in 1.3900 seconds
hbase(main):004:0> put 'huateng',1,'cf:id','001'
0 row(s) in 0.3920 seconds
hbase(main):007:0> put 'huateng',1,'cf:name','yanshoupeng'
0 row(s) in 0.0810 seconds
hbase(main):008:0> scan 'huateng'
ROW COLUMN+CELL
1 column=cf:id, timestamp=1364912587107, value=001
1 column=cf:name, timestamp=1364912614627, value=yanshoupeng
1 row(s) in 0.1210 seconds
hbase(main):009:0>
登陆到其他节点可以看到我们刚刚创建的表和数据:
[hadoop@hadoop2 ~]$ hbase shell
HBase Shell; enter 'help
Type "exit
Version 0.94.6, r1456690, Thu Mar 14 16:32:05 PDT 2013
hbase(main):001:0> list
TABLE
huateng
1 row(s) in 1.0000 seconds
hbase(main):002:0> scan 'huateng'
ROW COLUMN+CELL
1 column=cf:id, timestamp=1364912587107, value=001
1 column=cf:name, timestamp=1364912614627, value=yanshoupeng
1 row(s) in 0.3850 seconds
[hadoop@hadoop3 ~]$ hbase shell
HBase Shell; enter 'help
Type "exit
Version 0.94.6, r1456690, Thu Mar 14 16:32:05 PDT 2013
hbase(main):001:0> list
TABLE
huateng
1 row(s) in 0.9880 seconds
hbase(main):002:0> scan 'huateng'
ROW COLUMN+CELL
1 column=cf:id, timestamp=1364912587107, value=001
1 column=cf:name, timestamp=1364912614627, value=yanshoupeng
1 row(s) in 0.3040 seconds
同时HBASE在HDFS上为我们建立了如下文件:
[hadoop@hadoop1 ~]$ hadoop dfs -ls /hbase
Warning: $HADOOP_HOME is deprecated.
Found 9 items
drwxr-xr-x - hadoop supergroup 0 2013-04-02 20:47 /hbase/-ROOT-
drwxr-xr-x - hadoop supergroup 0 2013-04-02 20:47 /hbase/.META.
drwxr-xr-x - hadoop supergroup 0 2013-04-02 22:00 /hbase/.archive
drwxr-xr-x - hadoop supergroup 0 2013-04-02 21:53 /hbase/.logs
drwxr-xr-x - hadoop supergroup 0 2013-04-02 21:54 /hbase/.oldlogs
drwxr-xr-x - hadoop supergroup 0 2013-04-02 22:01 /hbase/.tmp
-rw-r--r-- 1 hadoop supergroup 38 2013-04-02 20:47 /hbase/hbase.id
-rw-r--r-- 1 hadoop supergroup 3 2013-04-02 20:46 /hbase/hbase.version
drwxr-xr-x - hadoop supergroup 0 2013-04-02 22:01 /hbase/huateng
hbase文件夹就是我们在hbase-site.xml配置文件里的hbase.rootdir的内容。