如何使用 sqoop 将 postgresql 数据库增量备份到 hadoop

问题描述 投票:0回答:0

我有一个名为 test 的数据库,我在其中创建了一个名为 sqoop2 的表。其中包含 15 行与 updated_date 分隔的行。所以当我在查询下面运行时,但没有一个查询帮助我们做增量数据。

Query1:sqoop import --connect jdbc:postgresql://xx.xx.xx.xx:5432/test --username xxxx --password xxxx --query 'SELECT * FROM sqoop2 WHERE update_date > '''2023-04 -07 00:00:00''' 和 $CONDITIONS' --target-dir /warehouse/tablespace/managed/hive/test.db/sqoop2 --split-by id --hive-import --hive-table test .sqoop2 --hive-overwrite

Query2:sqoop import --connect jdbc:postgresql://xx.xx.xx.xx:5432/test --username xx --password xx --table sqoop2 -m 1 --warehouse-dir /warehouse/tablespace/ managed/hive/test.db --incremental lastmodified --merge-key id --check-column update_date --last-value "2023-04-04"

我们希望根据 update_date 和每个日期将数据隔离到单个文件夹中的增量数据。

Query1:sqoop import --connect jdbc:postgresql://xx.xx.xx.xx:5432/test --username xxxx --password xxxx --query 'SELECT * FROM sqoop2 WHERE update_date > '''2023-04 -07 00:00:00''' 和 $CONDITIONS' --target-dir /warehouse/tablespace/managed/hive/test.db/sqoop2 --split-by id --hive-import --hive-table test .sqoop2 --hive-overwrite

Query2:sqoop import --connect jdbc:postgresql://xx.xx.xx.xx:5432/test --username xx --password xx --table sqoop2 -m 1 --warehouse-dir /warehouse/tablespace/ managed/hive/test.db --incremental lastmodified --merge-key id --check-column update_date --last-value "2023-04-04"

linux postgresql hadoop hive sqoop
© www.soinside.com 2019 - 2024. All rights reserved.