如何将hivederby元存储迁移到postgres元存储

yzxexxkh  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(374)

我使用derby作为hive元存储已经有相当一段时间了。有没有办法将metastore迁移到postgresql。
我正在使用ApacheHive-0.13

dphi5xsq

dphi5xsq1#

到目前为止,我发现最好的方法如下:


**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的所有表重复此操作。

相关问题