#!/bin/bash
# 这里的表数组之间空格隔开
hbase_tables=(table1 table2 table3)
allCount=${#hbase_tables[*]}
echo "数组元素个数是:${#hbase_tables[*]},${allCount}"
allHbaseCreateDialog="list\n"
for table in ${hbase_tables[*]}
do
allHbaseCreateDialog="${allHbaseCreateDialog}create '${table}' , {NAME => 'f', TTL => '33696000', COMPRESSION => 'SNAPPY'}, {SPLITS_FILE => 'region_split_info.txt'}\nlist\n"
done
echo -e ${allHbaseCreateDialog} > 1.txt
上述步骤会讲建表语句拼入1.txt文件
然后执行如下命令
cat 1.txt | hbase shell