hbase

  
       <name>hbase.zookeeper.quorum</name>
       <value>hadoop.datanode3.com,hadoop.datanode2.com,hadoop.datanode5.com</value>
   </property>
   <property>
        <name>hbase.master.distributed.log.splitting</name>
        <value>false</value>
   </property>
    <property>
      <name>hbase.zookeeper.property.clientPort</name>
      <value>4181</value>
      <description>Property from ZooKeeper's config zoo.cfg.
      The port at which the clients will connect.
      </description>
    </property>
 <property>
   <name>hbase.coprocessor.region.classes</name>
   <value>org.apache.hadoop.hbase.coprocessor.AggregateImplementation</value>
   <description>set coprocessor</description>
 </property>

<property>
        <name>zookeeper.session.timeout</name>
        <value>90000</value>
        <description>ZooKeeper session timeout.
                HBase passes this to the zk quorum as suggested maximum time for a
                session.  See http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html#ch_zkSessions
                “The client sends a requested timeout, the server responds with the
                timeout that it can give the client. The current implementation
                requires that the timeout be a minimum of 2 times the tickTime
                (as set in the server configuration) and a maximum of 20 times
                the tickTime.” Set the zk ticktime with hbase.zookeeper.property.tickTime.
                In milliseconds.
        </description>
</property>
<property>
        <name>hbase.regionserver.restart.on.zk.expire</name>
        <value>true</value>
        <description>
                Zookeeper session expired will force regionserver exit.
                Enable this will make the regionserver restart.
        </description>

</property>




補充說明:

1 修改 linux 系統參數 
    Linux系統最大可打開文件數一般默認的參數值是1024,如果你不進行修改併發量上來的時候會出現“Too Many Open Files”的錯誤,導致整個HBase不可運行,你可以用ulimit -n 命令進行修改,或者修改/etc/security/limits.conf 和/proc/sys/fs/file-max  的參數,具體如何修改可以去Google 關鍵字 “linux limits.conf ”

2JVM 配置  
修改 hbase-env.sh 文件中的配置參數,根據你的機器硬件和當前操作系統的JVM(32/64位)配置適當的參數
    HBASE_HEAPSIZE 4000   HBase使用的 JVM 堆的大小
    HBASE_OPTS  "‐server ‐XX:+UseConcMarkSweepGC"JVM GC 選項
    HBASE_MANAGES_ZKfalse   是否使用Zookeeper進行分佈式管理

3 HBase持久化
重啓操作系統後HBase中數據全無,你可以不做任何修改的情況下,創建一張表,寫一條數據進行,然後將機器重啓,重啓後你再進入HBase的shell中使用 list 命令查看當前所存在的表,一個都沒有了。是不是很杯具?沒有關係你可以在hbase/conf/hbase-default.xml中設置hbase.rootdir的值,來設置文件的保存位置指定一個文件夾 ,例如:<value>file:///you/hbase-data/path</value>,你建立的HBase中的表和數據就直接寫到了你的磁盤上,如圖所示:
同樣你也可以指定你的分佈式文件系統HDFS的路徑例如: hdfs://NAMENODE_SERVER:PORT/HBASE_ROOTDIR,這樣就寫到了你的分佈式文件系統上了。

4配置HBase運行參數 
其次就需要對hbase/conf/hbase-default.xml 文件進行配置,以下是我認爲比較重要的配置參數

hbase.client.write.buffer    
描述:這個參數可以設置寫入數據緩衝區的大小,當客戶端和服務器端傳輸數據,服務器爲了提高系統運行性能開闢一個寫的緩衝區來處理它, 這個參數設置如果設置的大了,將會對系統的內存有一定的要求,直接影響系統的性能。

hbase.master.meta.thread.rescanfrequency  
描述:多長時間 HMaster對系統表 root 和 meta 掃描一次,這個參數可以設置的長一些,降低系統的能耗。

hbase.regionserver.handler.count  
描述:由於HBase/Hadoop的Server是採用Multiplexed, non-blocking I/O方式而設計的,所以它可以透過一個Thread來完成處理,但是由於處理Client端所呼叫的方法是Blocking I/O,所以它的設計會將Client所傳遞過來的物件先放置在Queue,並在啓動Server時就先產生一堆Handler(Thread),該Handler會透過Polling的方式來取得該物件並執行對應的方法,默認爲25,根據實際場景可以設置大一些。
 
hbase.regionserver.thread.splitcompactcheckfrequency 
描述:這個參數是表示多久去RegionServer服務器運行一次split/compaction的時間間隔,當然split之前會先進行一個compact操作.這個compact操作可能是minor compact也可能是major compact.compact後,會從所有的Store下的所有StoreFile文件最大的那個取midkey.這個midkey可能並不處於全部數據的mid中.一個row-key的下面的數據可能會跨不同的HRegion。

hbase.hregion.max.filesize
描述:HRegion中的HStoreFile最大值,任何表中的列族一旦超過這個大小將會被切分,而HStroeFile的默認大小是256M。

hfile.block.cache.size   
描述:指定 HFile/StoreFile 緩存在JVM堆中分配的百分比,默認值是0.2,意思就是20%,而如果你設置成0,就表示對該選項屏蔽。

hbase.zookeeper.property.maxClientCnxns     
描述: 這項配置的選項就是從zookeeper中來的,表示ZooKeeper客戶端同時訪問的併發連接數,ZooKeeper對於HBase來說就是一個入口這個參數的值可以適當放大些。

hbase.regionserver.global.memstore.upperLimit
描述:在Region Server中所有memstores佔用堆的大小參數配置,默認值是0.4,表示40%,如果設置爲0,就是對選項進行屏蔽。

hbase.hregion.memstore.flush.size 
描述:Memstore中緩存的內容超過配置的範圍後將會寫到磁盤上,例如:刪除操作是先寫入MemStore裏做個標記,指示那個value, column 或 family等下是要刪除的,HBase會定期對存儲文件做一個major compaction,在那時HBase會把MemStore刷入一個新的HFile存儲文件中。如果在一定時間範圍內沒有做major compaction,而Memstore中超出的範圍就寫入磁盤上了。

5 HBase中log4j的日誌 
HBase中日誌輸出等級默認狀態下是把debug、 info 級別的日誌打開的,可以根據自己的需要調整log級別,HBase的log4j日誌配置文件在 hbase\conf\log4j.properties 目錄下。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章