If you have successfully configured Hadoop on a single machine in pseudo-distributed mode and looking for some help to use Hbase on top of that then you may find this writeup useful. Please let me know if you face any issue.
Since you are able to use Hadoop, I am assuming you have all the pieces in place . So we'll directly start with Habse configuration. Please follow the steps shown below to do that:
1
- Download the Hbase release from one of the mirrors using the link shown below. Then unzip it at some convenient location (I'll call this location as
HBASE_HOME now on) -
http://apache.techartifact.com/mirror/hbase/
2
- Go to the /conf directory inside the unzipped
HBASE_HOME and do these changes :
- In the hbase-env.sh file modify these line as shown :
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export BASE_REGIONSERVERS
=/PATH_TO_YOUR_HBASE_FOLDER/conf/regionservers
export HBASE_MANAGES_ZK=true
- In the hbase-site.xml add these properties :
<property>
<name>hbase.rootdir</name>
<value>SAME VALUE AS YOUR fs.default.name IN core-site.xml/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/mohammad/hbase/zookeeper</value>
</property>
3
- Now copy the
hadoop-core-*.jar from your
HADOOP_HOME and
commons-collections-3.2.1.jar from
HADOOP_HOME/lib folder into your
HBASE_HOME/lib folder.
4
- Change the line
127.0.1.1 in your
/etc/hosts file to
127.0.0.1. Since this file protected, we need to open it with root privileges. Use the command shown below to that :
mohammad@ubuntu :~
$ sudo gedit /etc/hosts
This will open the /etc/hosts file with root privileges. Modify it, and save it.
5
- Now go to the terminal and change the directory to your
HBASE_HOME and issue this command to start the Hbase processes (your Hadoop processes must be running in advance though) :
mohammad@ubuntu :~/hbase-0.90.4$ bin/start-hbase.sh
If everything was fine then you will see something like this on your terminal :
localhost: starting zookeeper, logging to /home/mohammad/hbase/logs/hbase-mohammad-zookeeper-ubuntu.out
starting master, logging to /home/mohammad/hbase/logs/hbase-mohammad-master-ubuntu.out
localhost: starting regionserver, logging to /home/mohammad/hbase/logs/hbase-mohammad-regionserver-ubuntu.out
mohammad@ubuntu :~/hbase-0.90.4$
NOTE : To verify whether your Hbase processes are running or not do this on your terminal :
mohammad@ubuntu :~/hbase-0.90.4$ jps
This will list down all the process running currently. If your Hbase is running fine you will see something like this :
mohammad@ubuntu :~/hbase-0.90.4$ jps
4585 SecondaryNameNode
4055 NameNode
5674 HRegionServer
5439 HMaster
5388 HQuorumPeer
4939 TaskTracker
4326 DataNode
5852 Jps
4686 JobTracker
Hbase also provides a
WEB-UI which you can visit to see if everything is ok. Point your web browser to this link :
http://localhost:60010
This will show you the Hbase master's web page.
6
- Now go to the Hbase shell and get yourself familiar with a few Hbase commands. To do this issue the follow command :
mohammad@ubuntu :~/hbase-0.90.4$ bin/hbase shell
This command will take you to the Hbase shell. You should be able to see this on your terminal screen by now :
mohammad@ubuntu :~/hbase-0.90.4$ bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.4, r1150278, Sun Jul 24 15:53:29 PDT 2011
hbase(main):001:0>
EXAMPLE COMMANDS :
1 - List the existing tables :
mohammad@ubuntu :~/hbase-0.90.4$ bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.4, r1150278, Sun Jul 24 15:53:29 PDT 2011
hbase(main):001:0>
2 - To create a new table called
table1 having a column family
cf :
hbase(main):001:0> create 'table1', 'cf'
0 row(s) in 1.9500 seconds
hbase(main):002:0> list
TABLE
demo
table1
test3
3 row(s) in 0.0310 seconds
hbase(main):003:0>
** For a complete know how of Hbase please visit the Hbase home page at - http://hbase.apache.org/
后记:
(1)原文来自:HOW TO CONFIGURE HBASE IN PSEUDO DISTRIBUTED MODE ON A SINGLE LINUX BOX
http://cloudfront.blogspot.com/2012/06/how-to-configure-habse-in-pseudo.html
在这里,首先感谢作者的分享。
(2)这个伪分布式的安装问题折腾了我快一周了,花了大量的时间,却一直无法解决,
翻遍了网上的各种所谓教程(大都copy来copy去的文摘),都没有最终的解决方案。
还是看到了这篇,死马当活马医。这里要批评下官方站点,这种安装指南描述的相当模糊,
基本不可用来做指南。。。相当的坑爹!!!
(3)其他一些参考网址:
http://cloudfront.blogspot.com/2012/06/how-to-configure-habse-in-pseudo.html
http://hbase.apache.org/book/standalone_dist.html
http://stones333.blogspot.com/2012/02/install-pseudo-distributed-hbase-with.html
http://ria101.wordpress.com/2010/01/28/setup-hbase-in-pseudo-distributed-mode-and-connect-java-client/
(4)一些维护命令:
#kill hadoop、hbase相关进程:高危慎用!
ps -ef|grep "[j]ava"|awk '{print $2}'|xargs -I {} kill -9 {}
#kill hbase、zookeeper相关进程:高危慎用!
ps -ef|grep "[h]base"|awk '{print $2}'|xargs -I {} kill -9 {}
#启动hadoop集群
cd /home/june/hadoop/hadoop-0.20.203.0/bin
start-all.sh
#启动hbase伪分布式环境
cd /home/june/hadoop/hbase-0.92.2/bin
start-hbase.sh
#官方用法,可以不用理会
local-master-backup.sh start 1
local-regionservers.sh start 1
REF:
http://blog.csdn.net/gudaoqianfu/article/details/7340896