hive 使用 beeline 執行hql傳引數; hive 使用distcp 和 MSCK 進行hive資料庫遷移
阿新 • • 發佈:2019-01-07
beeline 命令
-u 指定連結
-e 指定hql
-f 指定hql檔案
--hiveconf 指定傳引數, 引數在hql裡形如 ${hiveconf:var}, 要有hiveconf:字首
jdbc='jdbc:hive2://bd-master01-pe2.f.cn:10000/default;principal=hive/[email protected]' beeline -u "$jdbc" --slient=true --outputformat=tsv2 --hiveconf date="20181115" -f /home/fr-renjie.wei/fix_daily_fact.hql beeline -u "$jdbc" --slient=true --outputformat=tsv2 --hiveconf date="20181115" -e 'select * from table where column1 like "${hiveconf:date}"'
hadoop distcp 可以在兩個叢集間快速遷移檔案或資料夾, -u引數可以差異更新
在beeline裡可以執行MSCK命令來讓hive識別沒有被新增metastore資訊的檔案
set hive.msck.path.validation=ignore;
MSCK REPAIR TABLE db.table;