【问题标题】:Apache phoenix: create phoenix table maps to existing hbase tableApache phoenix:创建 phoenix 表映射到现有的 hbase 表
【发布时间】:2020-04-28 20:51:37
【问题描述】:

我确实有现有的 hbase 表和 SQL 支持,我正在尝试探索是否可以创建 apache phoenix 表。

我想知道我是否在现有的 hbase 表上创建 phoenix 表,它是复制(或复制)hbase 表中存在的数据,还是 phoenix 表只是链接到 hbase 中存在的现有数据?

我的 phoenix 版本是 this error 仍然适用于我的版本,因此无法在现有 hbase 表之上创建视图。

【问题讨论】:

  • Phoenix 表链接到 hbase 表。如果您是 Phoenix 的新手,请确保使用相似的大小写命名表,以确保一切正常(我建议使用大写名称)
  • @AnishNair - 您是否有任何指向说明 phoenix 表链接到 hbase 表的文档的链接?我需要仔细阅读这些特定的细节。
  • phoenix.apache.org/…。希望这可以帮助。我目前创建表而不是创建视图,并使用 4.7 版

标签: hbase phoenix


【解决方案1】:

我们可以在现有的 Hbase 表之上创建一个 Phoenix 表。它在内部使用 Phoenix 协处理器与 phoenix 表链接。

是的,数据将被复制。

请参阅以下步骤以执行相同操作:

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

【讨论】:

  • Shiva,是否有任何文档链接表明数据正在复制而不是链接到底层 hbase?谢谢
  • Ashish,这是因为 Phoenix-Hbase 协处理器。数据是链接而不是复制的。如果您从 Hbase 中删除数据(不推荐),它将从 Phoenix 中删除,反之亦然。由于 phoenix 是 HBase 之上的包装器,以提供 SQL 引擎功能。
猜你喜欢
  • 1970-01-01
  • 2017-10-29
  • 2016-03-25
  • 2019-04-18
  • 1970-01-01
  • 2015-05-13
  • 1970-01-01
  • 2016-11-24
  • 1970-01-01
相关资源
最近更新 更多