distcp
#!/bin/bash DB=$1 #获取hive表定义 ret=$(hive -e "use ${DB};show tables;"|grep -v _es|grep -v _hb|grep -v importinfo) for tem in $ret; do echo $tem if [ "$tem" != "tab_name" ];then hive -e "use ${DB};show create table $tem" >> /data1/job/secha.sh echo -e ';c' >> /data1/job/secha.sh fi done #迁移hive的表数据 ret=$(hive -e "use ${DB};show tables;"|grep -v _es|grep -v _hb|grep -v importinfo) for tem in $ret; do echo $tem if [ "$tem" != "tab_name" ];then hadoop distcp hdfs://master:9000/user/hive/warehouse/${DB}.db/$tem hdfs://192.168.0.21:8020/user/hive/warehouse/${DB}.db/$tem fi done
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)