hbase1.2.4 偽分布式安裝


注意:在安裝hbase或者hadoop的時候,要注意hadoop和hbase的對應關系。如果版本不對應可能造成系統的不穩定和一些其他的問題。在hbase的lib目錄下可以看到hadoop對應jar文件,默認情況下hbase下lib的jar文件對應hadoop的相對穩定的版本。如果需要使用其他的hadoop版本,需要將hbase  lib下的hadoopjar包,替換掉需要使用的hadoop版本

 
下載: http://archive.apache.org/dist/hbase/stable/(hbase下載歷史版本)
 
配置環境變量
########hbase####################
export HBASE_HOME=/usr/local/development/hbase-1.2.4
export PATH=$HBASE_HOME/bin:$PATH
 
配置hbase-env.sh
export JAVA_HOME=/usr/local/development/jdk1.7.0_15
export HBASE_MANAGES_ZK=false --如果你是使用hbase自帶的zk就是true,如果使用自己的zk就是false
配置hbase-site.xml
    <property>
        <name>hbase.rootdir</name>  --hbase持久保存的目錄
        <value>hdfs://hadoop-node1.com:8020/opt/hbase</value>   
    </property>
    <property>
        <name>hbase.cluster.distributed</name>  --是否是分布式
        <value>true</value>
    </property>
     <property>     
              <name>hbase.zookeeper.property.clientPort</name>    --指定要連接zk的端口
              <value>2181</value>    
    </property>    
    <property>    
              <name>hbase.zookeeper.quorum</name>    --指定要連接zk的節點
              <value>hadoop-node1.com</value>    
    </property>  
    <property>        
              <name>hbase.zookeeper.property.dataDir</name>   
               <value>/home/zhangxs/datainfo/developmentData/hbase/zkData</value>    
    </property>           

 為了防止因為hbase和hadoop版本不一致而出現的問題,可以看下{hbase_home}/lib/下相關hadoop*.jar的jar包,跟你的hadoop是否是同一個版本,如果不是可以從{hadoop_home}/ share/hadoop/ 下復制

 

啟動hbase(啟動的hbase的時候要保證hadoop集群已經啟動)
/hbase/bin/start-hbase.sh
查看hbase的進程
[root@node4 bin]# ./start-hbase.sh
localhost: starting zookeeper, logging to /home/zhangxs/hbase/bin/../logs/hbase-root-zookeeper-node4.out
starting master, logging to /usr/local/development/hbase-1.2.4/logs/hbase-node4-master-node4.out
starting regionserver, logging to /usr/local/development/hbase-1.2.4/logs/hbase-node4-1-regionserver-node4.out
[root@node4 bin]# jps
8057 Jps
3166 NodeManager
7830 HRegionServer
2933 SecondaryNameNode
2561 NameNode
5568 QuorumPeerMain
7706 HMaster
3071 ResourceManager
2650 DataNode
5749 GetConf
輸入hbase shell(進入shell命令行)
[root@node4 bin]# hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/development/hbase-1.2.4/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/development/hadoop-2.6.4/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.4, r67592f3d062743907f8c5ae00dbbe1ae4f69e5af, Tue Oct 25 18:10:20 CDT 2016
 
hbase(main):001:0>
 
通過web頁面訪問hbase
----------------------------安裝hbase完成-----------------------------------
 
 
遇到問題:
1:當我啟動hbase的時候,拋出下面錯誤
HBase does not run after ./start-hbase.sh - Permission Denied?
這問題是因為,我這個版本的hbase下的bin/* 所有以.sh結尾的文件,都不是可執行文件,所以我修改了 /hbase/bin/* 所有以.sh文件結尾的文件屬性
chmod 711 *.sh
修改后的文如下
要將hbase文件也修改為可執行文件(我的hbase文件一開始是不可執行文件)
 
 
2:當我啟動hbase后發現hmaster進程啟動又馬上關閉了,查看hbase日志,這個異常是說hbase鏈接zk訪問被拒絕,我的方法是在我的機器上搭建了zk,然后啟動zk
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2016-12-27 00:26:55,995 INFO [main-SendThread(localhost:2181)] zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2016-12-27 00:26:55,996 WARN [main-SendThread(localhost:2181)] zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2016-12-27 00:26:57,104 INFO [main-SendThread(localhost:2181)] zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

 

2:當我搭建好zk,又出現hmaster進程啟動又馬上關閉的問題,查看日志出現下面錯誤,這個錯誤是說hbase鏈接不到hadoop集群,這個是因為,我hadoop的core-site.xml文件中 nameNode端口配置的是8020,而我hbase的hbase-site.xml 鏈接hadoop的端口配置的是9000,然后我修改了hbase-site.xml
java.net.ConnectException: Call From node4/192.168.177.124 to hadoop-node4.com:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:791)
at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:731)
at org.apache.hadoop.ipc.Client.call(Client.java:1473)
at org.apache.hadoop.ipc.Client.call(Client.java:1400)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:232)
at com.sun.proxy.$Proxy18.setSafeMode(Unknown Source)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.setSafeMode(ClientNamenodeProtocolTranslatorPB.java:647)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:187)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
at com.sun.proxy.$Proxy19.setSafeMode(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM