标签:style blog http io color ar os 使用 sp
HBase 安装分为:单击模式,伪分布式,完全分布式,在单机模式中,HBase使用本地文件系统而不是HDFS ,所有的服务和zooKeeper都运作在一个JVM中。本文是安装的伪分布式。
安装步骤如下
1 环境配置
2 安装说明
1 环境配置
1.1 Java JDK 安装,下载JDK,配置环境变量
sudo nano /etc/profile
export JAVA_HOME=/usr/dev/jdk1.7.0_51 export HADOOP_HOME=/home/lcc/software/hadoop/hadoop-2.5.0 export HBASE_HOME=/home/lcc/software/hadoop/hbase-0.99.0 export LD_LIBRARY_PATH=/home/lcc/software/dev/protobuf-2.5.0 export ANT_HOME=/usr/dev/apache-ant-1.9.4 export PATH=$PATH:$ANT_HOME/bin:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HBASE_HOME/bin export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib
1.2 Hadoop安装,可参考其他教程
2 HBase安装
2.1 下载最新发布包http://mirror.bit.edu.cn/apache/hbase/,本文是hbase-0.99.0
2.2 配置环境变量HBASE_HOME
2.3 配置conf/hbase-site.xml,里面参数作用可参考http://hbase.apache.org/book.html?spm=0.0.0.0.kJVi8l#hbase_default_configurations
<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://localhost:9000/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>localhost</value> </property> <property> <name>hbase.tmp.dir</name> <value>file:/home/lcc/software/hadoop/hbase-0.99.0/tmp</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>file:/home/lcc/software/hadoop/hbase-0.99.0/zookeeper</value> </property> </configuration>
2.4 配置conf/hbase-env.sh,里面参数作用可参考http://hbase.apache.org/book.html?spm=0.0.0.0.kJVi8l#hbase_default_configurations
export JAVA_HOME="/usr/dev/jdk1.7.0_51"
export HBASE_MANAGES_ZK=true
2.5 启动hbase,启动之前,需要保证hadoop已经启动
lcc@lcc-HP-Pro-3380-MT:~$ start-hbase.sh
localhost: starting zookeeper, logging to /home/lcc/software/hadoop/hbase-0.99.0/bin/../logs/hbase-lcc-zookeeper-lcc-HP-Pro-3380-MT.out
starting master, logging to /home/lcc/software/hadoop/hbase-0.99.0/logs/hbase-lcc-master-lcc-HP-Pro-3380-MT.out
2.6 连接HBase
lcc@lcc-HP-Pro-3380-MT:~$ hbase shell HBase Shell; enter ‘help<RETURN>‘ for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 0.99.0, r757a0952ce4674704d91a858b42ea94be8199b81, Tue Sep 16 12:58:15 PDT 2014
2.7 停止hbase
lcc@lcc-HP-Pro-3380-MT:~$ stop-hbase.sh
stopping hbase.........
localhost: stopping zookeeper.
-------------------------------------------------------------------------------------------------------------------------------------------------
查看是否启动成功,输入jps,看到有HMaster和HQuorumPeer,浏览器输入http://localhost:16030/master-status,能打开说明成功
hbase(main):001:0> lcc@lcc-HP-Pro-3380-MT:~$ jps
28522 NodeManager
817 Jps
27997 DataNode
28206 SecondaryNameNode
386 HMaster
28380 ResourceManager
27823 NameNode
300 HQuorumPeer
查看端口被哪些进程占用
netstat -pan | grep 16020
安装后因为看到没有HregionServer这个进程,还以为启动不对,就手动启动它
bin/hbase-daemon.sh start regionserver
但是这个命令总是启动不成功,查看日志发现,总是提示端口被占用lem binding to localhost/127.0.0.1:16020 : Address already in use: bind
然后查看被哪个进程占用,发现有好几个,不知道为啥,然后发现了
Start and stop additional RegionServers
The HRegionServer manages the data in its StoreFiles as directed by the HMaster. Generally, one HRegionServer runs per node in the cluster. Running multiple HRegionServers on the same system can be useful for testing in pseudo-distributed mode. The local-regionservers.sh command allows you to run multiple RegionServers. It works in a similar way to the local-master-backup.sh command, in that each parameter you provide represents the port offset for an instance. Each RegionServer requires two ports, and the default ports are 16020 and 16030. However, the base ports for additional RegionServers are not the default ports since the default ports are used by the HMaster, which is also a RegionServer since HBase version 1.0.0. The base ports are 16200 and 16300 instead. You can run 99 additional RegionServers that are not a HMaster or backup HMaster, on a server. The following command starts four additional RegionServers, running on sequential ports starting at 16202/16302 (base ports 16200/16300 plus 2).
$ .bin/local-regionservers.sh start 2 3 4 5
To stop a RegionServer manually, use the local-regionservers.sh command with the stop
parameter and the offset of the server to stop.
$ .bin/local-regionservers.sh stop 3
大概意思是,HMaster占用了16020这个端口,那么再用bin/hbase-daemon.sh start regionserver启动HRegionServer时候,肯定会报错,所以换用下面命令启动时,就没问题了
.bin/local-regionservers.sh start 2 3 4 5
Ubuntu 13.10 下安装伪分布式hbase 0.99.0
标签:style blog http io color ar os 使用 sp
原文地址:http://www.cnblogs.com/liuchangchun/p/4096891.html