hbase 0.94 + thrift 0.7.0 安裝 (1)

上一篇文章中, 我們介紹了如何用java來存取hbase叢集,
在這一文章中, 我們介紹如何建立thrift的環境,
要注意的是: 這一篇文章是以hbase 0.94作為範例,
在其他版本(0.96)上是否需要其他設定, 則需要再試看看,

考慮到hbase原生只支援java與shell方式存取,
對於其他程式語言, 尤其是網頁界面而言, 就成了很大的障礙,
thrift就提供了解決方案, 讓像是PHP的網頁語言也可以使用,


thrift不像hbase和hadoop一樣有編譯好的執行檔,
因此要預先建立編譯的環境, 以下是thrift所需要的基本編譯環境:

Basic requirements
A relatively POSIX-compliant *NIX system
Cygwin or MinGW can be used on Windows
g++ 4.2
boost 1.53.0
Runtime libraries for lex and yacc might be needed for the compiler.

Requirements for building from source
GNU build tools:
autoconf 2.65
automake 1.9
libtool 1.5.24
pkg-config autoconf macros (pkg.m4)
lex and yacc (developed primarily with flex and bison)
libssl-dev

在ubuntu下用以下指令建立環境:

$ sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev

安裝好環境後, 要安裝thrift所支援的程式語言,
以PHP為例, 可以用下列的指令建立PHP的編譯環境:

$ sudo apt-get install php5-dev php5-cli phpunit

如果需要其他語言, 可以參考這裡,
完成後, 我們去下載thrift的程式, 並且解壓縮至thrift資料夾,
和之前操作一樣, 我們都在/opt資料夾下進行,

$ cd /opt
$ wget http://archive.apache.org/dist/thrift/0.7.0/thrift-0.7.0.tar.gz
$ tar -zxf thrift-0.7.0.tar.gz
$ mv thrift-0.7.0 thrift

完成後進入thrift資料夾中輸入 ./configure
[note: 2016/05/09]如果出現權限問題, 請用chmod -R 777 /opt/thrift 更改權限
這個指令將確認thrift的安裝環境是否完整,
最終輸出以下的結果:

thrift 0.7.0

Building code generators ..... : cpp c_glib java as3 csharp py rb perl php erl cocoa st ocaml hs xsd html js javame go

Building C++ Library ......... : yes
Building C (GLib) Library .... : no
Building Java Library ........ : yes
Building C# Library .......... : no
Building Python Library ...... : yes
Building Ruby Library ........ : no
Building Haskell Library ..... : no
Building Perl Library ........ : no
Building PHP Library ......... : yes
Building Erlang Library ...... : no
Building Go Library .......... : no

Building TZlibTransport ...... : yes
Building TNonblockingServer .. : yes

Using javac .................. : javac
Using java ................... : java
Using ant .................... : /usr/bin/ant

Using Python ................. : /usr/bin/python

Using php-config ............. : /usr/bin/php-config

這裡的yes和no代表是否支援此程式語言,
在我們的環境中, 可以看到PHP顯示為yes,
因此, 繼續在thrift資料夾下執行make和make install,

$ make
$ sudo make install

這裡要等待一段時間,
完成後, 就完成了thrift 0.7.0的安裝.

參考資料:
http://thrift.apache.org/
http://thrift.apache.org/docs/install/debian
https://sites.google.com/site/waue0920/Home/hbase/hadoop-hbase-thrift-php-an-zhuang-she-ding-cheng-shi-she-ji
http://wiki.apache.org/hadoop/Hbase/ThriftApi
http://blog.johnsonlu.org/ubuntuhbase-thrift-php/

留言

  1. 作者已經移除這則留言。

    回覆刪除
    回覆
    1. 更正 是 sudo: ./configure :command not found

      刪除
    2. 作者已經移除這則留言。

      刪除
    3. 有可能是sudo的權限問題, 你可以參考
      http://www.thrift.pl/Thrift-tutorial-installation.html
      可以試試看直接執行./configure

      刪除

張貼留言

熱門文章

LTE筆記: RSRP, RSSI and RSRQ

[WiFi] WiFi 網路的識別: BSS, ESS, SSID, ESSID, BSSID

LTE筆記: 波束成型 (beamforming) 和天線陣列