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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

phoenix 3.1 + hbase 0.94.21 的安装和使用

發(fā)布時間:2024/9/30 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 phoenix 3.1 + hbase 0.94.21 的安装和使用 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Apache Phoenix 是?HBase?的 SQL 驅(qū)動。Phoenix 使得 HBase 支持通過 JDBC 的方式進(jìn)行訪問,并將你的 SQL 查詢轉(zhuǎn)成 HBase 的掃描和相應(yīng)的動作。

兼容性:

  • Phoenix 2.x - HBase 0.94.x

  • Phoenix 3.x - HBase 0.94.x

  • Phoenix 4.x - HBase 0.98.1+


1:hbase 0.94.21 的安裝

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


2:下載phoenix 3.1

[jifeng@jifeng02 ~]# wget http://mirrors.hust.edu.cn/apache/phoenix/phoenix-3.1.0/bin/phoenix-3.1.0-bin.tar.gz --2014-09-12 22:03:44-- http://mirrors.hust.edu.cn/apache/phoenix/phoenix-3.1.0/bin/phoenix-3.1.0-bin.tar.gz 正在解析主機(jī) mirrors.hust.edu.cn... 202.114.18.160 正在連接 mirrors.hust.edu.cn|202.114.18.160|:80... 已連接。 已發(fā)出 HTTP 請求,正在等待回應(yīng)... 200 OK 長度:55480477 (53M) [application/octet-stream] 正在保存至: “phoenix-3.1.0-bin.tar.gz” 2014-09-12 22:16:29 (70.8 KB/s) - 已保存 “phoenix-3.1.0-bin.tar.gz” [55480477/55480477])
3:解壓

[jifeng@jifeng02 ~]$ tar zxf phoenix-3.1.0-bin.tar.gz [jifeng@jifeng02 ~]$ cd phoenix-3.1.0-bin [jifeng@jifeng02 phoenix-3.1.0-bin]$ ls CHANGES common examples hadoop1 hadoop2 LICENSE NOTICE README
4:配置

參考:http://phoenix.apache.org/download.html

我這里使用的是Phoenix 3.x

To install a pre-built phoenix, use these directions:

  • Download and expand the latest phoenix-[version]-bin.tar. Use either hadoop1 and hadoop2 artifacts which match your HBase installation.
  • 下載,根據(jù)安裝的HBase選擇hadoop1或hadoop2
  • Add the phoenix-[version]-server.jar to the classpath of every HBase region server and remove any previous version. An easy way to do this is to copy it into the HBase lib directory (use phoenix-core-[version].jar for Phoenix 3.x)
  • 把phoenix-core-3.1.0.jar復(fù)制到所有HBase region server的lib目錄
  • Restart all region servers.
  • 重啟所有的Hbase?region servers.
  • Add the phoenix-[version]-client.jar to the classpath of any Phoenix client.
  • Phoenix client服務(wù)器的CLASSPATH加上phoenix-3.1.0-client-hadoop1.jar
[jifeng@jifeng02 phoenix-3.1.0-bin]$ cd common [jifeng@jifeng02 common]$ ls phoenix-3.1.0-client-minimal.jar phoenix-3.1.0-client-without-hbase.jar phoenix-core-3.1.0.jar [jifeng@jifeng02 common]$ cp ./phoenix-core-3.1.0.jar /home/jifeng/hbase-0.94.21/lib [jifeng@jifeng02 common]$ scp ./phoenix-core-3.1.0.jar jifeng@jifeng01:/home/jifeng/hbase-0.94.21/lib phoenix-core-3.1.0.jar 100% 2178KB 2.1MB/s 00:00 [jifeng@jifeng02 common]$ cd ..


在配置文件/home/jifeng/.bash_profile中

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:/home/jifeng/phoenix-3.1.0-bin/hadoop1/phoenix-3.1.0-client-hadoop1.jar

然后重啟HBase

[jifeng@jifeng01 hbase-0.94.21]$ bin/stop-hbase.sh stopping hbase................ jifeng01: stopping zookeeper. jifeng02: stopping zookeeper. [jifeng@jifeng01 hbase-0.94.21]$ bin/start-hbase.sh jifeng01: starting zookeeper, logging to /home/jifeng/hbase-0.94.21/bin/../logs/hbase-jifeng-zookeeper-jifeng01.out jifeng02: starting zookeeper, logging to /home/jifeng/hbase-0.94.21/bin/../logs/hbase-jifeng-zookeeper-jifeng02.out starting master, logging to /home/jifeng/hbase-0.94.21/logs/hbase-jifeng-master-jifeng01.out jifeng01: starting regionserver, logging to /home/jifeng/hbase-0.94.21/bin/../logs/hbase-jifeng-regionserver-jifeng01.out jifeng02: starting regionserver, logging to /home/jifeng/hbase-0.94.21/bin/../logs/hbase-jifeng-regionserver-jifeng02.out

5:啟動和簡單操作

[jifeng@jifeng02 bin]$ sqlline.py localhost Setting property: [isolation, TRANSACTION_READ_COMMITTED] issuing: !connect jdbc:phoenix:localhost none none org.apache.phoenix.jdbc.PhoenixDriver Connecting to jdbc:phoenix:localhost Connected to: Phoenix (version 3.1) Driver: org.apache.phoenix.jdbc.PhoenixDriver (version 3.1) Autocommit status: true Transaction isolation: TRANSACTION_READ_COMMITTED Building list of tables and columns for tab-completion (set fastconnect to true to skip)... 59/59 (100%) Done Done sqlline version 1.1.2 0: jdbc:phoenix:localhost> select * from b_month . . . . . . . . . . . . .> ; Error: ERROR 1012 (42M03): Table undefined. tableName=B_MONTH (state=42M03,code=1012) 0: jdbc:phoenix:localhost> create table test (a integer primary key, b integer) ; No rows affected (1.534 seconds) 0: jdbc:phoenix:localhost> UPSERT INTO TEST VALUES (1, 1); 1 row affected (0.018 seconds) 0: jdbc:phoenix:localhost> UPSERT INTO TEST VALUES (2, 12); 1 row affected (0.01 seconds) 0: jdbc:phoenix:localhost> select * from test; +------------+------------+ | A | B | +------------+------------+ | 1 | 1 | | 2 | 12 | +------------+------------+ 2 rows selected (0.056 seconds) 0: jdbc:phoenix:localhost>


6:查看hbase中的表test


[jifeng@jifeng01 hbase-0.94.21]$ hbase shell HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 0.94.21, r83b4a1ee9b9a2fa4c7ae1739259e041cabe8edc2, Fri Jun 27 16:14:16 UTC 2014hbase(main):001:0> list TABLE SYSTEM.CATALOG SYSTEM.SEQUENCE TEST b_month mytable 5 row(s) in 0.6250 secondshbase(main):003:0> scan 'TEST' ROW COLUMN+CELL \x80\x00\x00\x01 column=0:B, timestamp=1410534991931, value=\x80\x00\x00\x01 \x80\x00\x00\x01 column=0:_0, timestamp=1410534991931, value= \x80\x00\x00\x02 column=0:B, timestamp=1410535001115, value=\x80\x00\x00\x0C \x80\x00\x00\x02 column=0:_0, timestamp=1410535001115, value= 2 row(s) in 0.0770 secondshbase(main):004:0>



總結(jié)

以上是生活随笔為你收集整理的phoenix 3.1 + hbase 0.94.21 的安装和使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

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