【问题标题】:How to migrate hive derby metastore to postgres metastore如何将 hive derby 元存储迁移到 postgres 元存储
【发布时间】:2016-03-18 18:16:58
【问题描述】:

我使用 derby 作为 hive Metastore 已经有一段时间了。 有没有办法将元存储迁移到 Postgresql。

我正在使用 Apache Hive - 0.13

【问题讨论】:

    标签: hive metastore


    【解决方案1】:

    目前我发现的最佳方法如下:

    **Export from existing database**
    Use the derby tool 'ij' (assuming you are placed in the root installation folder for the pillar):
    java -cp lib/derby-10.10.1.1.jar:lib/derbytools-10.10.1.1.jar:lib/derbyclient-10.10.1.1.jar org.apache.derby.tools.ij
    Then run the following commands to extract the content of the somedb database:
    CONNECT 'jdbc:derby:/path/to/somedb'
    CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE(null, 'TABLE1', 'table1', null, null, null);
    This should create the file: 'table1'.
    
    **Import the data to the PostgreSQL database**
    Run the 'psql' application on the console/terminal.
    Log onto somedb and ingest data (and fix the automated sequences)
    \c somedb
    COPY table1 FROM '/path/to/table1' with csv;
    SELECT SETVAL('table1_guid_seq', (SELECT MAX(guid) FROM table1));
    

    对所有要从 derby 导出并导入 postgresql 的表重复此操作。

    【讨论】:

      猜你喜欢
      • 2016-04-24
      • 1970-01-01
      • 2016-05-02
      • 2021-01-04
      • 2019-08-15
      • 2021-04-23
      • 2016-07-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多