1.下载,解压,zookeeper 安装省略
2.配置hbase所在用户的 环境变量
sudo vim .profile
export HBASE_HOME=/usr/cdh/hbase
export PATH=$PATH:$MYSQL_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$ZOOKEEPER_HOME/bin:$HIVE_HOME/bin:$SPARK_HOME/bin:$HBASE_HOME/bin
export PATH=$PATH:$KAFKA_HOME/bin:$SCALA_HOME/bin:$JAVA_HOME/bin:$HBASE_HOME/bin
生效 . .profile
3.修改hbase 配置文件
vim $HBASE_HOME/conf/hbase-env.sh
# The java implementation to use. Java 1.7+ required.
export JAVA_HOME=/usr/java
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
#如果集群zookeeper负载过大,可以考虑采用自身zookeeper
#共享hdfs集群zk: false ; 自身zk:true
export HBASE_MANAGES_ZK=false
vim $HBASE_HOME/conf/hbase-site.xml
hbase.rootdir
hdfs://hadoop:8020/hbase
hbase.cluster.distributed
true
hbase.zookeeper.quorum
hadoop
dfs.replication
1
4.启动:
start-hbase.sh
报错:
hadoop: starting zookeeper, logging to /usr/cdh/hbase/bin/../logs/hbase-spark-zookeeper-hadoop.out
hadoop: java.net.BindException: 地址已在使用
hadoop:
at sun.nio.ch.Net.bind0(Native Method)
hadoop:
at sun.nio.ch.Net.bind(Net.java:433)
hadoop:
at sun.nio.ch.Net.bind(Net.java:425)
hadoop:
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
hadoop:
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
hadoop:
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
hadoop:
at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:95)
hadoop:
at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:116)
hadoop:
at org.apache.hadoop.hbase.zookeeper.HQuorumPeer.runZKServer(HQuorumPeer.java:94)
starting master, logging to /usr/cdh/hbase/logs/hbase-spark-master-hadoop.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
starting regionserver, logging to /usr/cdh/hbase/logs/hbase-spark-1-regionserver-hadoop.out
错误原因是:单机伪集群的情况下,使用了hbase 自身zk与 本机的zk端口发生冲突.
解决: 禁止使用 hbase自身的zk
vim $HBASE_HOME/conf/hbase-env.sh
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
#如果集群zookeeper负载过大,可以考虑采用自身zookeeper
export HBASE_MANAGES_ZK=false
解决后又报如下错误:
2016-06-13 20:41:51,409 ERROR [main] master.HMasterCommandLine: Master exiting
java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster
at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:2002)
at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:203)
at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:139)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:126)
at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:2016)
Caused by: java.net.BindException: 地址已在使用
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.hadoop.hbase.ipc.RpcServer.bind(RpcServer.java:2419)
at org.apache.hadoop.hbase.ipc.RpcServer$Listener.
(RpcServer.java:538)
at org.apache.hadoop.hbase.ipc.RpcServer.(RpcServer.java:1917)
at org.apache.hadoop.hbase.regionserver.RSRpcServices.(RSRpcServices.java:812)
at org.apache.hadoop.hbase.master.MasterRpcServices.(MasterRpcServices.java:196)
at org.apache.hadoop.hbase.master.HMaster.createRpcServices(HMaster.java:477)
at org.apache.hadoop.hbase.regionserver.HRegionServer.(HRegionServer.java:492)
at org.apache.hadoop.hbase.master.HMaster.(HMaster.java:333)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1997)
... 5 more
原因:伪集群下HMaster 和 HRegionServer 占用同一个端口:16020
解决:
1.使用local-regionservers.sh start 1 两次进行启动HMaster 和 HRegionServer
local-regionservers.sh start 1 //HMaster
local-regionservers.sh start 1 //HRegionServer
2.集群情况下最好将HMaster 和 HRegionServer 分布在不同的主机上,解决端口冲突,减轻节点负载
解决后查看hbase WebUI,无法打开
2,启动hbase之后,hdfs中运行正常可是web界面(hadoop://master:60010)打不开
错误原因:
1.默认hbase WebUI是不开启的,需要在对应的hbase-site.xml下配置下列属性:
2.由于主机名master映射出现问题。
解决办法:sudo vi /etc/hosts查看映射master对应的ip是否正确。
解决办法:在hbase-site.xml文件中配置中加入:
hbase.master.info.port
60010
查看主机ip映射是否正确