集群信息命令
查看集群端口命令
hdfs getconf -confKey fs.default.name
查看集群节点状态命令
hdfs haadmin -getServiceState 节点名称
hdfs test命令及shell应用案例
hadoop fs -help
-test -[defsz] :
Answer various questions about , with result via exit status.
-d return 0 if is a directory.
-e return 0 if exists.
-f return 0 if is a file. --文件存在则显示为0
-s return 0 if file is greater than zero bytes in size.
-z return 0 if file is zero bytes in size, else return 1.
##测试用例
hadoop fs -test -f /user/hive/warehouse/test.db/increat_table
if [ $? -eq 0 ] ;then
echo ‘文件目录已经存在,执行增量导入’
./increment.sh
else
echo ‘文件目录不存在,执行全量导入操作’
./import_loan_base.sh
fi