Home > HOWTOs > HBase on HDFS Single Node

HBase on HDFS Single Node

Setting up Local HBase on Top of HDFS.
First lets setup the Hbase Configuration Files.
————–
hbase-site.xml
————–

 
    hbase.rootdir
    hdfs://localhost:9000/hbase
 
 
 hbase.zookeeper.property.clientPort
 2181
 
 
    hbase.cluster.distributed
    true
 
 
      hbase.zookeeper.quorum
      localhost
   
If  you are running zookeeper seperatly then make the line below as ‘false’.
————–
hbase-env.sh
————–
export HBASE_MANAGES_ZK=false
Next creating a zoo.cfg for the zookeeper.
————
zoo.cfg
————

 # The number of milliseconds of each tick
 tickTime=2000
 # The number of ticks that the initial
 # synchronization phase can take
 initLimit=20
 # The number of ticks that can pass between
 # sending a request and getting an acknowledgement
 syncLimit=10
 # the directory where the snapshot is stored.
 dataDir=/opt/mapr/zkdata
 # the port at which the clients will connect
 clientPort=2181
 # max number of client connections
 maxClientCnxns=100
 maxSessionTimeout=300000
Now lets create the HDFS configuration files.
————-
core-site.xml
————-

hdfs://localhost:9000


————-
hdfs.site.xml
————-
dfs.replication
1

dfs.namenode.name.dir
file:///root/hadoop-2.5.1/yarn_data/hdfs/namenode

dfs.datanode.data.dir
file:///root/hadoop-2.5.1/yarn_data/hdfs/datanode
————-
mapred-site.xml
————-
yarn
Add ‘localhost’ in slaves files.
————–
yarn-site.xml
————–

yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.nodemanager.aux-services.mapreduce.shuffle.class
org.apache.hadoop.mapred.ShuffleHandler
Now That we are ready lets start the services.
ahmed@master:~ ]# ./hdfs namenode -format

This will start DFS (NameNode, SecondaryNameNode, DataNode)
ahmed@master:~ ]# ./start-dfs.sh
This will start Yarn service (Resource Manager and Node Manager)
ahmed@master:~ ]# ./start-yarn.sh
Here is the command output.
ahmed@master:~ ]# jps
43655 Jps
12018 Bootstrap
31585 NameNode
32114 SecondaryNameNode
31798 DataNode
32494 NodeManager
Lets Do a HDFS Test.
ahmed@master:~]# hadoop jar /root/hadoop-2.5.1/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.5.1-tests.jar TestDFSIO -write -nrFiles 10 -fileSize 100
Next Lets start HBase services.
First Start the zookeeper.
ahmed@master:~]# ./hbase-daemon.sh –config ../conf/zoo.cfg start zookeeper
Next start RegionServer
ahmed@master:~]# ./hbase-daemon.sh start regionserver
Then we start the master
ahmed@master:~]# ./hbase-daemon.sh start master
ahmed@master:~] # jps
43655 Jps
12018 Bootstrap
40171 HQuorumPeer
40425 HRegionServer
31585 NameNode
32114 SecondaryNameNode
41509 HMaster
31798 DataNode
32494 NodeManager
32277 ResourceManager
Now Lets do a basic test. 
ahmed@master:~] # hbase shell
2014-12-30 20:04:15,116 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter ‘help’ for list of supported commands.
Type “exit” to leave the HBase Shell
Version 0.98.1-hadoop2, r1583035, Sat Mar 29 17:19:25 PDT 2014

hbase(main):001:0> list
TABLE
test
1 row(s) in 2.3090 seconds

=> [“test”]
hbase(main):002:0> scan ‘test’
ROW                                  COLUMN+CELL
 row                                 column=test_fam:, timestamp=1419947982152, value=NewValue
1 row(s) in 0.4890 seconds

hbase(main):003:0> put ‘test’, ‘row2’, ‘test_fam’, ‘SecondValue’
0 row(s) in 0.1110 seconds

hbase(main):004:0> scan ‘test’
ROW                                  COLUMN+CELL
 row                                 column=test_fam:, timestamp=1419947982152, value=NewValue
 row2                                column=test_fam:, timestamp=1419950094363, value=SecondValue
2 row(s) in 0.0260 seconds

hbase(main):005:0>
More information on this can be found below links here.
Advertisements
Categories: HOWTOs
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: