進階3: zookeeper-3.4.9.tar.gz和hbase-1.2.4-bin.tar.gz 環境搭建(hbase 偽分布式)


前提條件:

      成功安裝了  jdk1.8,  hadoop2.7.3 

注意條件:

          zookeeper,hbase 版本必須要和hadoop 安裝版本相互兼容,否則容易出問題;

          本次:安裝包 zookeeper-3.4.9.tar.gz          和            hbase-1.2.4-bin.tar.gz

 

 zookeeper   安裝步驟:

        1. 下載安裝包   zookeeper-3.4.9.tar.gz,並上傳到linux 目錄;     

        2.  解壓文件

              tar zxvf zookeeper-3.4.9.tar.gz 

        3.   進入 zookeeper-3.4.9 , 拷貝 conf /zoo_sample.cfg

              cp conf/zoo_sample.cfg conf/zoo.cfg 

         4.  編輯配置文件 conf/zoo.cfg ,如下圖:

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/usr/local/hadoop-soft/etc/zookeeper-3.4.9/zookeeper_data
# the port at which the clients will connect
clientPort=2181
# The number of snapshots to retain in dataDir
autopurge.snapRetainCount=5
# Purge task interval in hours
autopurge.purgeInterval=1

 

              

        5. 配置環境變量:

              a.  進入根目錄,編輯   ./bash_profile 文件,設置環境變量:

                    export ZOO_HOME=/usr/local/hadoop-soft/etc/zookeeper-3.4.9   

                    export PATH=$ZOO_HOME/bin:$PATH   

                  

                 

       6. 啟動zookeeper

            bin/zkServer.sh start 

       7. 驗證啟動zookeeper成功

             a. 驗證進程

                   jps | grep Quorum 

              b. 如果產生如下輸出,則表明進程啟動正常:

                 

 

 HBase  安裝步驟(偽分布式版):

             1.上傳hbase-1.2.4 安裝包到linux ;

             2.進入根目錄,編輯   ./bash_profile 文件,設置HBase 環境變量:  

         export HBASE_HOME=/usr/local/hadoop-soft/etc/hbase-1.2.4 

                 export PATH=$HBASE_HOME/bin:$PATH 

             3.解壓hbase-1.2.4  安裝文件

                  tar zxvf hbase-1.2.4-bin.tar.gz 

              4.編輯 conf/hbash-env.sh 文件,可以添加,也可以松開hbash-env.sh 代碼注解

                 export JAVA_HOME=/usr/java/jdk1.8.0_51 

                 export HBASE_MANAGES_ZK=false             如果你是使用hbase自帶的zk就是true,如果使用自己的zk就是false,此次我們使用的是zoopkeeper 提供的,所以為false

              5.  編輯 conf/hbase-site.xml

<configuration>
  <property>
<!-- 是否分布式--> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property>
<!-- hbase 持久化保存目錄--> <name>hbase.rootdir</name> <value>hdfs://master:9000/hbase</value> </property> <property>
<!-- 指定要連接zk的節點 --> <name>hbase.zookeeper.quorum</name> <value>bigdata</value> </property> </configuration>

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

          6.  編輯conf/regionservers文件

               master 

               該文件表示在哪些主機上啟動RegionServers,每一行表示一個主機名,執行命令的時候需要這些機器上的SSH登陸權限

         7. (如果zookeeper 沒啟動,先啟動zookeeper)啟動HDFS  :

                start-dfs.sh 

                   

                 假如遇到遇到如下問題:如下截圖dataNode   

                 

                 此截圖就沒有啟動DataNode ,解決辦法:將對應的HDFS (hdfs-site.xml) nameNode ,dataNode 節點對應的目錄刪除,重新分區:

                       a 如下圖:將dfs 所有目錄先刪除,然后在將nameNode,dataNode 對應的目錄手動刪除,在手動創建

                           

                      b. 執行hdfs 分區操作: 

                            hdfs namenode -format 

                           

               8.啟動 hbase

                   bin/start-hbase.sh 

             9.  jps ,如果看到如下 進程。

                  

         10. 查看是否啟動成功,     http://master:16010/master-status

                

 

                       

 


免責聲明!

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



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