1、hive根据日期分区加载数据脚本
#!/bin/bash date_list='2018-03-20 2018-03-22'; for date in $date_list do echo "start to hive partition" hive -e "ALTER TABLE hive_table_name ADD PARTITION(dt='$date');" echo "hive partition finished" done |
2、hive查看表分区命令
show partitions hive_table_name;
3、远程命令脚本中判断hadoop的nameNode的状态,选择状态为active的nameNode使用
if /hadoop/bin/hdfs dfs -ls hdfs://host1:8020/ | grep logs then echo "host1 status is active" else echo "host2 status is active" namenodeHost="hdfs://host2:8020/" fi |