Apache phoenix: create phoenix table maps to existing hbase table

孤人 提交于 2021-01-29 17:12:43

问题


I do have existing hbase table & for SQL support I am trying to explore if I can create apache phoenix table.

I would like to know if I create phoenix table on existing hbase table, does it replicate (or copy) data present in hbase table, or phoenix table just links to existing data present in hbase?

My phoenix version is <4.12.0 so this error still applies on my version & hence can't create View on top of existing hbase table.


回答1:


We can create a Phoenix table on top of the existing Hbase table. It internally uses Phoenix co-processor to link with the phoenix table.

Yes, Data would be replicated.

See below steps to do the same :

create 'DEV_HBASE:TestPhoneixIntegration','cf'
describe 'HBASE_PAS:TestPhoneixIntegration'

  Table HBASE_PAS:TestPhoneixIntegration is ENABLED                                                                                                                                                           
  HBASE_PAS:TestPhoneixIntegration                                                                                                                                                                            
  COLUMN FAMILIES DESCRIPTION                                                                                                                                                                                     
  {NAME => 'cf', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCAC
  HE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                                                                                                   
  1 row(s) in 0.0630 seconds

------------------------------------------------------

create table "DEV_HBASE"."TestPhoneixIntegration"(ROWKEY VARCHAR PRIMARY KEY , "cf"."name" VARCHAR);

SELECT * FROM "DEV_HBASE"."TestPhoneixIntegration";
+----------+-------+
|  ROWKEY  | name  |
+----------+-------+
| rowkey1  | John  |
+----------+-------+

--------------------------------------------------------
describe 'DEV_HBASE:TestPhoneixIntegration'
Table DEV_HBASE:TestPhoneixIntegration is ENABLED                                                                                                                                                           
    DEV_HBASE:TestPhoneixIntegration, {TABLE_ATTRIBUTES => {coprocessor$1 => '|org.apache.phoenix.coprocessor.ScanRegionObserver|805306366|', coprocessor$2 => '|org.apache.phoenix.coprocessor.UngroupedAggrega
    teRegionObserver|805306366|', coprocessor$3 => '|org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver|805306366|', coprocessor$4 => '|org.apache.phoenix.coprocessor.ServerCachingEndpointImpl|80530636
    6|', coprocessor$5 => '|org.apache.phoenix.hbase.index.Indexer|805306366|org.apache.hadoop.hbase.index.codec.class=org.apache.phoenix.index.PhoenixIndexCodec,index.builder=org.apache.phoenix.index.PhoenixInde
    xBuilder'}                                                                                                                                                                                                      
COLUMN FAMILIES DESCRIPTION                                                                                                                                                                                     
{NAME => 'cf', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCAC
HE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                                                                                                   
1 row(s) in 0.0580 seconds


来源:https://stackoverflow.com/questions/59694645/apache-phoenix-create-phoenix-table-maps-to-existing-hbase-table

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!