点击关注上方“知了小巷”,
设为“置顶或星标”,第一时间送达干货。
Phoenix定位为OLTP和操作型分析(operational analytics),大多用于在线业务,稳定性要求第一位。Phoenix的功能很强大,也很灵活,Phoenix SQL基于SQL-92标准,但是还是有很多方言,使用时需要特别注意。
DataX是阿里巴巴集团内被广泛使用的离线数据同步工具/平台,实现包括 MySQL、Oracle、SqlServer、Postgre、HDFS、Hive、ADS、HBase、TableStore(OTS)、MaxCompute(ODPS)、DRDS 等各种异构数据源之间高效的数据同步功能。
这里主要用到oraclereader和hbase11xwriter。
基础软件版本:
Apache Hadoop:hadoop-2.8.5
Apache HBase:hbase-1.4.10
Apache Phoenix:phoenix-4.14.3-HBase-1.4-bin
Phoenix版本支持:
Phoenix Current release 4.15.0 can run on Apache HBase 1.3, 1.4 and 1.5. CDH HBase 5.11, 5.12, 5.13 and 5.14 is supported by 4.14.0. Apache HBase 2.0 is supported by 5.0.0.
hbase客户端
hbase shell
phoenix客户端
phoenix-4.14.3-HBase-1.4-bin/bin/sqlline.py
# 进入hbase shell客户端
$ hbase shellSLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/home/admin/hbase-1.4.10/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/home/admin/hadoop-2.8.5/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.SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]HBase ShellUse "help" to get list of supported commands.Use "exit" to quit this interactive shell.Version 1.4.10, r76ab087819fe82ccf6f531096e18ad1bed079651, Wed Jun 5 16:48:11 PDT 2019
# 创建命名空间ZLXX
hbase(main):006:0> create_namespace 'ZLXX'0 row(s) in 1.1150 seconds
# 创建hbase表,使用命名空间
hbase(main):001:0> create 'ZLXX:WT_TRADE_REFUND', 'INFO'0 row(s) in 1.7510 seconds => Hbase::Table - ZLXX:WT_TRADE_REFUND
查看表描述信息(desc)
hbase(main):009:0> desc 'ZLXX:WT_TRADE_REFUND'Table ZLXX:WT_TRADE_REFUND is ENABLED ZLXX:WT_TRADE_REFUND COLUMN FAMILIES DESCRIPTION {
NAME => 'INFO', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'} 1 row(s) in 0.0730 seconds
# 使用DataX往hbase表里面添加测试数据(存量批量数据采集)
数据源来自Oracle,数据目标系统是HBase原生创建的表。
使用oraclereader和hbase11xwriter。
具体配置zlxx_test.json
$ vi zlxx_test.json{
"job": {
"content": [ {
"reader": {
"name": "oraclereader", "parameter": {
"column": [], "connection": [ {
"fetchSize": "1024",