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

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > Ubuntu >内容正文

Ubuntu

Ubuntu 9.0 下之HBase 0.90.4 的安装和使用

發(fā)布時(shí)間:2025/3/21 Ubuntu 53 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Ubuntu 9.0 下之HBase 0.90.4 的安装和使用 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Ubuntu 9.o 下安裝 Hbase
Hbase 下載 地址 http://archive.apache.org/dist/hbase/hbase-0.90.4/
解壓 tar vxf hbase-0.90.4.tar.gz

? ? ? ? ?cd hbase-0.90.4

單機(jī)版的配置

配置一個(gè)目錄?

現(xiàn)在你已經(jīng)可以啟動(dòng)Hbase了。但是你可能需要先編輯?conf/hbase-site.xml?去配置hbase.rootdir,來(lái)選擇Hbase將數(shù)據(jù)寫到哪個(gè)目錄 .

<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration><property><name>hbase.rootdir</name><value>file:///DIRECTORY/hbase</value></property> </configuration>

將?DIRECTORY?替換成你期望寫文件的目錄. 默認(rèn)?hbase.rootdir?是指向?/tmp/hbase-${user.name}?,也就說(shuō)你會(huì)在重啟后丟失數(shù)據(jù)(重啟的時(shí)候操作系統(tǒng)會(huì)清理/tmp目錄)

我配置到 只要指定到一個(gè)目錄下就可以,這個(gè)目錄是用來(lái)保存創(chuàng)建表記錄。

<value>/home/liucheng/hbase0.90.4/hbase</value>


參看http://www.yankay.com/wp-content/hbase/book.html

然后編輯conf/hbase-env.sh,將其中的JAVA_HOME指向到你Java的安裝目錄。

啟動(dòng) HBase

現(xiàn)在啟動(dòng)Hbase:

$ ./bin/start-hbase.sh starting Master, logging to logs/hbase-user-master-example.org.out

shell連接你的Hbase 這個(gè)時(shí)候 估計(jì) 需要 30秒左右,不要 以為死了 關(guān)閉了。

$ ./bin/hbase shell HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version: 0.90.0, r1001068, Fri Sep 24 13:55:42 PDT 2010hbase(main):001:0>

在創(chuàng)建表時(shí) 出現(xiàn)?

ERROR: org.apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to connect to ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default).

具體 方式:

vi /etc/security/limits.conf

在最后添加兩行:

hdfs ?- ? ? ? nofile ?32768
hbase ?- ? ? ? nofile ?32768
?解決方案參看 http://mazd1002.blog.163.com/blog/static/6657496520111121018145/

重啟下 hbase
[root@master bin]# ./stop-hbase.sh?
stopping hbase.............................
[root@master bin]# ./start-hbase.sh
(如果stop-hbase一直處于………………的狀態(tài),怎么辦?我教你一個(gè)方法,先去重新start-hbase,肯定說(shuō)hbase還沒(méi)有停止,需要先停止,給你一個(gè)PID,哈哈,之后你就kill -9 pid,在執(zhí)行start-hbase.sh)
當(dāng)你結(jié)束的時(shí)候,會(huì)提示 hbase 的進(jìn)程號(hào) kill 進(jìn)程號(hào) 就好
在創(chuàng)建表完成 后 顯示表
list 'table'
只會(huì)顯示 TABLE
所以 顯示表 用list 就可以 把剛剛新建的表顯示出來(lái)
/home/liucheng/hbase-0.90.4/
$ ./bin/start-hbase.sh
$ ./bin/stop-hbase.sh
?
九、遇到的問(wèn)題 ?
hbase(main):001:0> create 'test','cf'
?
ERROR: org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException: org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException: Timed out (10000ms)
?
解決方法:修改/etc/hosts。把ubuntu對(duì)應(yīng)的127.0.1.1改成本機(jī)的IP。OK!

參考 http://blog.csdn.net/god_wot/article/details/6829427

Hbase 的基礎(chǔ)命令語(yǔ)法 可以參考?http://blog.csdn.net/scutshuxue/article/details/6988348

我們做一個(gè)測(cè)試;

注意:有些命令是沒(méi)有 ; 號(hào)結(jié)束的。請(qǐng)注意。

第一步:新建一個(gè)學(xué)生表,只有兩列,一列是name,一列是address.

? ? ? ? ? ? ?create 'stu',{name=>'name'},{name=>'address'};

? ? ? ? ? ? 同時(shí)顯示一下,list?


第二步:向?qū)W生表添加一列數(shù)據(jù),

? ? ? ? ? ? ? ? put 'stu','row1','name:1','zs';


第三步:查看一下,建表語(yǔ)句,

? ? ? ? ? ? ? describe ?'stu'


第四步:查看一下表內(nèi)容 scan 'stu'?

??

第五步:通過(guò)key 獲取一行數(shù)據(jù)。

? ? ? ? ? ? ? ?get ?'stu','row1'

注:如果在一個(gè)表中,列族相同,第二個(gè)列就會(huì)覆蓋第一個(gè)列。

結(jié)束,刪除表。

偽分布式的配置

第一步:到hbase 的目錄 conf 下修改hbase-site.xml 配置文件,內(nèi)容如下。
第二步:啟動(dòng) hbase ?./bin/start-hbase.sh 并進(jìn)入shell 命令


在我想看一下表的時(shí)候。輸放list ?但報(bào)錯(cuò)了。 錯(cuò)誤信息是:
ERROR: org.apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to connect to ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default). Consider inspecting your ZK server logs for that error and then make sure you are reusing HBaseConfiguration as often as you can. See HTable's javadoc for more information.
?按這樣修改。
  • ? ?在/etc/hosts 下加放 本機(jī)IP ?hbase

  • 修改 hbase conf目錄下的regionservers 下的loclhost 改成 hbase

  • 把hadoop 目錄下的 hadoop-0.20.2-core.jar hadoop-0.20.2-test.jar 放到hbase 的lib目錄下

  • 重新啟動(dòng) hbase ?./bin/start-hbase.sh

  • Hbase 常用命令:

  • ? COLUMNS 與 COLUMN 的使用區(qū)別。

  • 轉(zhuǎn)載于:https://www.cnblogs.com/java20130726/archive/2013/03/18/3218281.html

    總結(jié)

    以上是生活随笔為你收集整理的Ubuntu 9.0 下之HBase 0.90.4 的安装和使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。