设为首页 加入收藏

TOP

shell脚本创建hbase表
2019-05-07 13:47:45 】 浏览:98
Tags:shell 脚本 创建 hbase

#!/bin/bash
source ~/.bash_profile

#日志目录
DACPDIR="/logs"
#DACPDIR=$(cd "$(dirname "$0")"; pwd)
#日志名称
LOGNAME="hbase_table"
#日志全路径名
full_log_name=${DACPDIR}/${LOGNAME}.log

#hbase名称
hbase_table=pro:info_d
CF=cf

echo `hbase shell <<EOF
exists '$hbase_table'
EOF` | grep 'does exist' >$full_log_name 2>&1
rtstatus=$
if [ $rtstatus -ne 0 ]; then
echo `hbase shell << EOF
create '$hbase_table', {NAME => '$CF', COMPRESSION=>'lzo', BLOOMFILTER =>"ROW", TTL => '15552000', VERSIONS => '1'}
grant 'b','RW','$hbase_table'
grant 'bd','RW','$hbase_table'
grant 'pro','RW','$hbase_table'
EOF` >$full_log_name 2>&1
if [ "$" -ne 0 ] ;then
echo "创建hbase表失败!"
else
echo "创建hbase表成功!"
fi
else
echo "hbase表已存在!"
fi

以上内容,仅作为自己学习使用

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇FusionInsight HD HBase 常用API 下一篇安装hbase后重启服务,发现zookee..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目