Hbase 集成 Phoenix

下载安装包

官网地址:http://phoenix.apache.org/
百度云盘:https://pan.baidu.com/s/1DqAKEc3rOznymkgc5-WPMA 密码:xb5o

解压到指定目录

tar -zxvf apache-phoenix-5.0.0-hbase-2.0.bin.tar.gz -C /usr/local
cd /usr/local
mv apache-phoenix-x.x phoenix

配置PHOENIX_HOME

export PHOENIX_HOME=/usr/local/phoenix
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$MONGODB_HOME/bin:$PHOENIX_HOME/bin

拷贝phoenix jar包到hbase目录

# cp phoenix-core-5.0.0-HBase-2.0.jar /usr/local/hbase-2.0.0/lib/
# cp phoenix-5.0.0-HBase-2.0-client.jar /usr/local/hbase-2.0.0/lib/

拷贝hbase-site.xml 到phoenix bin目录下覆盖原来的文件

cp hbase-site.xml /usr/local/phoenix/bin/

将 hdfs 集群中的配置文件 core-site.xml、 hdfs-site.xml 拷贝到 Phoenix 的 bin 目录下

cp core-site.xml hdfs-site.xml /usr/local/phoenix/bin/

通过phoenix连接HBase集群

cd /usr/local/phoenix/bin
./sqlline.py hadoop-slave,hadoop-slave2,hadoop-slave3:2181 # zookeeper集群地址
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:hadoop-namenode:2181 none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:hadoop-namenode:2181
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/phoenix/phoenix-5.0.0-HBase-2.0-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop-2.7.7/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
18/09/21 03:36:32 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Connected to: Phoenix (version 5.0)
Driver: PhoenixEmbeddedDriver (version 5.0)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
147/147 (100%) Done
Done
sqlline version 1.2.0
0: jdbc:phoenix:hadoop-namenode:2181>

查看集群中的表
在这里插入图片描述

查询数据
Hbase 集成 Phoenix_第1张图片

更多语法参考PHOENIX挂网:http://phoenix.apache.org

你可能感兴趣的:(HBase)