日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Hadoop 2.4.1+HBase 0.98.6.1 分布式安装

發布時間:2024/9/30 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Hadoop 2.4.1+HBase 0.98.6.1 分布式安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

A: 先配置Hadoop2.4.1的集群環境

參考:http://blog.csdn.net/wind520/article/details/38317937


B:配置HBase

參考:http://abloz.com/hbase/book.html#quickstart

? 1:下載?wget http://mirrors.hust.edu.cn/apache/hbase/stable/hbase-0.98.6.1-hadoop2-bin.tar.gz

? ?2: 解壓?tar zxf hbase-0.98.6.1-hadoop2-bin.tar.gz?

? ?3:配置vi?hbase-site.xml

? ?

[jifeng@feng01 conf]$ cat hbase-site.xml <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- /**** Licensed to the Apache Software Foundation (ASF) under one* or more contributor license agreements. See the NOTICE file* distributed with this work for additional information* regarding copyright ownership. The ASF licenses this file* to you under the Apache License, Version 2.0 (the* "License"); you may not use this file except in compliance* with the License. You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/ --> <configuration> <property> <name>hbase.rootdir</name> <value>hdfs://feng01:9000/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.master</name> <value>feng01:60000</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>feng01,feng02,feng03</value> </property> </configuration>?4:配置cat hbase-env.sh

修改的地方
#JDK的安裝目錄
export JAVA_HOME=$HOME/jdk1.7.0_45
#hadoop的配置目錄
export HBASE_CLASSPATH=$HOME/hadoop/hadoop-2.4.1/etc/hadoop/

和最后一行

export HBASE_MANAGES_ZK=true

#true:表示zookeeper交給hbase管理,啟動hbase時,會自動啟動hbase-site.xml里的hbase.zookeeper.quorum屬性中的所有zookeeper實例?#false:表示啟動hbase時,要手動啟動所有zookeeper實例


?5:配置regionservers?

[jifeng@feng01 conf]$ cat regionservers feng01 feng02 feng036:替換lib下jar

替換hbase安裝目錄下的lib中使用的hadoop2.2的jar包,改成2.4.1的

寫一個copy.sh,自動完成這個步驟

[jifeng@feng01 hbase-0.98.6.1-hadoop2]$ cd lib [jifeng@feng01 lib]$ vi copy.sh #! /bin/bashfind -name "hadoop*jar" | sed 's/2.2.0/2.4.1/g' | sed 's/.\///g' > f.log rm ./hadoop*jar cat ./f.log | while read Line do find /home/jifeng/hadoop/hadoop-2.4.1/share/hadoop -name "$Line" | xargs -i cp {} ./ done rm ./f.log [jifeng@feng01 lib]$ chmod 700 copy.sh [jifeng@feng01 lib]$ ./copy.sh /home/jifeng/hadoop/hadoop-2.4.1 是hadoop 2.4.1 的安裝路徑,記得修改為自己的安裝目錄

7:復制hbase到其它節點

scp -r hbase-0.98.6.1-hadoop2 jifeng@feng02:/home/jifeng
scp -r hbase-0.98.6.1-hadoop2 jifeng@feng03:/home/jifeng

8:啟動HBase

[jifeng@feng01 hbase-0.98.6.1-hadoop2]$ bin/start-hbase.sh feng01: zookeeper running as process 4266. Stop it first. feng03: starting zookeeper, logging to /home/jifeng/hbase-0.98.6.1-hadoop2/bin/../logs/hbase-jifeng-zookeeper-feng03.out feng02: starting zookeeper, logging to /home/jifeng/hbase-0.98.6.1-hadoop2/bin/../logs/hbase-jifeng-zookeeper-feng02.out starting master, logging to /home/jifeng/hbase-0.98.6.1-hadoop2/bin/../logs/hbase-jifeng-master-feng01.out feng01: starting regionserver, logging to /home/jifeng/hbase-0.98.6.1-hadoop2/bin/../logs/hbase-jifeng-regionserver-feng01.out feng03: starting regionserver, logging to /home/jifeng/hbase-0.98.6.1-hadoop2/bin/../logs/hbase-jifeng-regionserver-feng03.out feng02: starting regionserver, logging to /home/jifeng/hbase-0.98.6.1-hadoop2/bin/../logs/hbase-jifeng-regionserver-feng02.out
9:查看

<pre name="code" class="plain">[jifeng@feng01 hbase-0.98.6.1-hadoop2]$ bin/hbase shell 2014-10-07 18:18:38,213 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 0.98.6.1-hadoop2, r96a1af660b33879f19a47e9113bf802ad59c7146, Sun Sep 14 21:27:25 PDT 2014hbase(main):001:0> status 2014-10-07 18:18:57,578 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 3 servers, 0 dead, 0.3333 average loadhbase(main):002:0>

hadoop.native.lib 有個提示,先別管這個,后面在解決

C:測試

創建一個名為?test?的表,這個表只有一個 列族 為?cf。可以列出所有的表來檢查創建情況,然后插入些值。

hbase(main):001:0> create 'test', 'cf' 0 row(s) in 1.9310 seconds=> Hbase::Table - test hbase(main):002:0> list TABLE test 1 row(s) in 0.0540 seconds=> ["test"]hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1' 0 row(s) in 0.1120 secondshbase(main):005:0> put 'test', 'row2', 'cf:b', 'value2' 0 row(s) in 0.0100 secondshbase(main):006:0> put 'test', 'row3', 'cf:c', 'value3' 0 row(s) in 0.0080 seconds

以上我們分別插入了3行。第一個行key為row1, 列為?cf:a, 值是?value1。HBase中的列是由 列族前綴和列的名字組成的,以冒號間隔。例如這一行的列名就是a.

檢查插入情況.

Scan這個表,操作如下

hbase(main):007:0> scan 'test' ROW COLUMN+CELL row1 column=cf:a, timestamp=1412690657950, value=value1 row2 column=cf:b, timestamp=1412690667298, value=value2 row3 column=cf:c, timestamp=1412690676484, value=value3 3 row(s) in 0.0500 seconds
Get一行,操作如下

hbase(main):008:0> get 'test', 'row1' COLUMN CELL cf:a timestamp=1412690657950, value=value1 1 row(s) in 0.0200 seconds
disable 再 drop 這張表,可以清除你剛剛的操作

hbase(main):010:0> disable 'test' 0 row(s) in 3.4790 seconds hbase(main):004:0> drop 'test' 0 row(s) in 0.2680 seconds 關閉shell
hbase(main):005:0> exitD:停止 HBase
運行停止腳本來停止HBase.

[jifeng@feng01 hbase-0.98.6.1-hadoop2]$ ./bin/stop-hbase.sh stopping hbase.............. feng01: stopping zookeeper. feng03: stopping zookeeper. feng02: stopping zookeeper.

總結

以上是生活随笔為你收集整理的Hadoop 2.4.1+HBase 0.98.6.1 分布式安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。