Skip to content

Instantly share code, notes, and snippets.

@itxx00
Created February 7, 2018 03:02
Show Gist options
  • Save itxx00/00af0e1ef5b364bf821449e8c871952b to your computer and use it in GitHub Desktop.
Save itxx00/00af0e1ef5b364bf821449e8c871952b to your computer and use it in GitHub Desktop.
#!/bin/bash
#!/bin/sh
# this script sets the TTL(in seconds) value on the tsdb column family in HBase.
TTL=$1
if ! [[ $TTL =~ ^[1-9][0-9]*$ ]] ; then
echo "Invalid TTL value (expecting a postive integer)" 1>&2
exit 1
fi
# set TSDB_TABLE name if not already set in ENV
TSDB_TABLE=${TSDB_TABLE-'tsdb'}
export JAVA_HOME=/usr/lib/jvm/jre
hbh=/opt/hbase
exec "$hbh/bin/hbase" shell <<EOF
disable '$TSDB_TABLE';
alter '$TSDB_TABLE', {NAME=>'t', TTL=>'$TTL'};
enable '$TSDB_TABLE';
describe '$TSDB_TABLE'
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment