- Openssl-devel. Paquete necesario para obtener la librería libcrypto.
# yum install openssl-devel.x86_64 -y
Autoconf. Versión mínima requerida 2.65 ó superior.
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
# tar xvzf autoconf-latest.tar.gz
# cd autoconf-2.69/
# ./configure
# make
# make check (tarda bastante)
# make install
Resto de Dependencias CentOS.
# yum install automake flex bison pkgconfig gcc-c++ libevent-devel zlib-devel python-devel ruby-devel -y
Es posible que durante la instalación del paquete Automake se observe como se selecciona e instala como una dependencia más la librería autconf-2.63-5.1.el6.noarch, no preocuparse, no supondrá ningún problema de cara al futuro. Aún así, tras finalizar la instalación de todos estos paquetes podremos verificar la versión del mismo ejecutando el siguiente comando:
# autoconf -V
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille.
Boost (69,5 MB):
# wget http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
# tar xvzf boost_1_55_0.tar.gz
# cd boost_1_55_0
# ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86_64/b2
Detecting Python version... 2.6
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/boost-build2/doc/html/index.html
# ./b2 (tardará bastante en finalizar su ejecución)
...
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
/root/software/boost_1_55_0
The following directory should be added to linker library paths:
/root/software/boost_1_55_0/stage/lib
# ./bjam --prefix=/usr/local/ link=static runtime-link=static stage install
...
common.copy /usr/local/include/boost/tr1/tr1/unordered_map
...updated 11321 targets...
Podremos verificar la existencia de estas librerías:
# ls -al /usr/local/lib/libboost_*
Libtool. Paquete necesario para obtener la librería libtoolize.
# yum install libtool-2.2.6-15.5.el6.x86_64 -y
Thrift. Podemos obtener el paquete mediante dos formas:
Opción 1) Desde su propia web nos descargamos una de sus
versiones:
# wget http://archive.apache.org/dist/thrift/0.8.0/thrift-0.8.0.tar.gz
# tar xvzf thrift-0.8.0.tar.gz
# cd thrift-0.8.0
Opción2) 'Clonamos' el proyecto:
# git clone https://git-wip-us.apache.org/repos/asf/thrift.git thrift
# cd thrift
# ./bootstrap.sh (si elegimos esta segunda opción este paso es necesario)
Yo opté por la primera. A partir de aquí los siguientes pasos son idénticos para ambas opciones.
# ./configure --with-boost=/usr/local
# make
# make check (asegurarse que el puerto 9090 esté libre, por ejemplo asegurarse que el servicio hbalse =>hbasethriftserver de cloudera esté detenido en caso de haberse instalado/habilitado)
# make install
# cp /usr/local/lib/libthrift-0.8.0.so /usr/lib/
# /sbin/ldconfig /usr/lib/libthrift-0.8.0.so
A continuación deberemos añadir la siguiente variable de entorno a nuestro ficheros:
/root/.bashrc => EXPORT PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
/etc/profile => EXPORT PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
# source /root/.bashrc
# source /etc/profile
Verificar el resultado del siguiente comando:
# pkg-config --cflags thrift
-I/usr/local/include/thrift
RHBase:
# wget https://raw.github.com/RevolutionAnalytics/rhbase/master/build/rhbase_1.2.0.tar.gz
# R CMD INSTALL rhbase_1.2.0.tar.gz
* installing to library ‘/usr/lib64/R/library’
* installing *source* package ‘rhbase’ ...
** libs
g++ -m64 -I/usr/include/R -DNDEBUG -I/usr/local/include -I. -g -DHAVE_UINTPTR_T -DHAVE_NETDB_H=1 -fpermissive -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -I./gen_cpp `pkg-config --cflags thrift` -Wall -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Hbase.cpp -o Hbase.o
g++ -m64 -I/usr/include/R -DNDEBUG -I/usr/local/include -I. -g -DHAVE_UINTPTR_T -DHAVE_NETDB_H=1 -fpermissive -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -I./gen_cpp `pkg-config --cflags thrift` -Wall -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Hbase_constants.cpp -o Hbase_constants.o
g++ -m64 -I/usr/include/R -DNDEBUG -I/usr/local/include -I. -g -DHAVE_UINTPTR_T -DHAVE_NETDB_H=1 -fpermissive -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -I./gen_cpp `pkg-config --cflags thrift` -Wall -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Hbase_types.cpp -o Hbase_types.o
g++ -m64 -I/usr/include/R -DNDEBUG -I/usr/local/include -I. -g -DHAVE_UINTPTR_T -DHAVE_NETDB_H=1 -fpermissive -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -I./gen_cpp `pkg-config --cflags thrift` -Wall -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c tools.cc -o tools.o
g++ -m64 -shared -L/usr/local/lib64 -o rhbase.so Hbase.o Hbase_constants.o Hbase_types.o tools.o -L/usr/local/lib -lthrift -L/usr/lib64/R/lib -lR
installing to /usr/lib64/R/library/rhbase/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
converting help for package ‘rhbase’
finding HTML links ... done
admin html
functions html
rhbase html
** building package indices
** testing if installed package can be loaded
* DONE (rhbase)
Making 'packages.html' ... done
Verificar que existe /usr/lib64/R/library/rhbase/
# ls -al /usr/lib64/R/library/rhbase/
total 48
drwxr-xr-x 9 root root 4096 mar 17 14:48 .
drwxr-xr-x 49 root root 4096 mar 17 14:48 ..
-rw-r--r-- 1 root root 461 mar 17 14:48 DESCRIPTION
drwxr-xr-x 2 root root 4096 mar 17 14:48 help
drwxr-xr-x 2 root root 4096 mar 17 14:48 html
-rw-r--r-- 1 root root 222 mar 17 14:48 INDEX
drwxr-xr-x 2 root root 4096 mar 17 14:48 libs
drwxr-xr-x 2 root root 4096 mar 17 14:48 Meta
-rw-r--r-- 1 root root 41 mar 17 14:48 NAMESPACE
drwxr-xr-x 2 root root 4096 mar 17 14:48 R
drwxr-xr-x 2 root root 4096 mar 17 14:48 samples
drwxr-xr-x 2 root root 4096 mar 17 14:48 unitTests
Iniciar el servicio HBase Thrift Server
# hbase thrift start
...INFO thrift.ThriftServerRunner: starting TBoundedThreadPoolServer on /0.0.0.0:9090; min worker threads=16, max worker threads=1000, max queued requests=1000
...
- R
# R
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
...
> require(rhbase)
Loading required package: rhbase
> hb.init();
<pointer: 0x1ec4030="">
attr(,"class")
[1] "hb.client.connection"
> hb.list.tables()
$`test-table`
maxversions compression inmemory bloomfiltertype bloomfiltervecsize bloomfilternbhashes
cf: 3 NONE FALSE NONE 0 0
blockcache timetolive
cf: FALSE -1
¡¡¡ IMPORTANTE !!! En caso de leer una tabla cuyos datos son caracteres, debemos inicializar la conexión de la siguiente forma: > hb.init(serialize="character")
<pointer: 0x306a2f0="">
attr(,"class")
[1] "hb.client.connection"
> hb.get (tablename="TABLENAME", rows="ROWKEY", colspec="COLUMNFAMILY:")
[[1]]
[[1]][[1]]
[1] "ROWKEY"
[[1]][[2]]
[1] "cf:ATTR1_CADENA" "cf:ATTR2_INT" "cf:ATTR3_INT" "cf:ATTR4_INT" "cf:ATTR5_CADENA" "cf:ATTR6_INT"
[[1]][[3]]
[[1]][[3]][[1]]
[1] "BOTH"
[[1]][[3]][[2]]
[1] "62"
[[1]][[3]][[3]]
[1] "143"
[[1]][[3]][[4]]
[1] "10455"
[[1]][[3]][[5]]
[1] "CADENA"
[[1]][[3]][[6]]
[1] "24"
> quit();
Save workspace image? [y/n/c]: y