forked from OpenTSDB/opentsdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add src/upgrade_1to2.sh script to create tree and meta tables.
Signed-off-by: Chris Larsen <[email protected]>
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
# Small script to setup the HBase tables used by OpenTSDB. | ||
|
||
test -n "$HBASE_HOME" || { | ||
echo >&2 'The environment variable HBASE_HOME must be set' | ||
exit 1 | ||
} | ||
test -d "$HBASE_HOME" || { | ||
echo >&2 "No such directory: HBASE_HOME=$HBASE_HOME" | ||
exit 1 | ||
} | ||
|
||
TREE_TABLE=${TREE_TABLE-'tsdb-tree'} | ||
META_TABLE=${META_TABLE-'tsdb-meta'} | ||
BLOOMFILTER=${BLOOMFILTER-'ROW'} | ||
# LZO requires lzo2 64bit to be installed + the hadoop-gpl-compression jar. | ||
COMPRESSION=${COMPRESSION-'LZO'} | ||
# All compression codec names are upper case (NONE, LZO, SNAPPY, etc). | ||
COMPRESSION=`echo "$COMPRESSION" | tr a-z A-Z` | ||
|
||
case $COMPRESSION in | ||
(NONE|LZO|GZIP|SNAPPY) :;; # Known good. | ||
(*) | ||
echo >&2 "warning: compression codec '$COMPRESSION' might not be supported." | ||
;; | ||
esac | ||
|
||
# HBase scripts also use a variable named `HBASE_HOME', and having this | ||
# variable in the environment with a value somewhat different from what | ||
# they expect can confuse them in some cases. So rename the variable. | ||
hbh=$HBASE_HOME | ||
unset HBASE_HOME | ||
exec "$hbh/bin/hbase" shell <<EOF | ||
create '$TREE_TABLE', | ||
{NAME => 't', VERSIONS => 1, COMPRESSION => '$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER'} | ||
create '$META_TABLE', | ||
{NAME => 'name', COMPRESSION => '$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER'} | ||
EOF |