Add Hive DIB element

Change-Id: Iac3a13f2a70fd8888fc81c04629f2c696199d2a5
This commit is contained in:
IvanBerezovskiy 2013-08-26 18:57:23 +04:00
parent bdf1600e7c
commit a49aaad30c
4 changed files with 42 additions and 0 deletions

3
elements/hive/README.md Normal file
View File

@ -0,0 +1,3 @@
Installs Hive on Ubuntu and Fedora.
Hive stores metadata in MySQL databases. So, this element requires 'mysql' element.
You can specify download link for Hive using parameter 'HIVE_DOWNLOAD_URL' or choose Hive version using parameter 'HIVE_VERSION'.

View File

@ -0,0 +1,2 @@
hadoop
mysql

View File

@ -0,0 +1,29 @@
#!/bin/bash
install-packages wget tar
tmp_dir=/tmp/hive
mkdir -p $tmp_dir
cd $tmp_dir
if [ -z $HIVE_DOWNLOAD_URL ]; then
HIVE_DOWNLOAD_URL=http://www.apache.org/dist/hive/hive-$HIVE_VERSION/hive-$HIVE_VERSION-bin.tar.gz
fi
wget $HIVE_DOWNLOAD_URL
if [ $? -ne 0 ]; then
echo -e "Could not download hive.\nAborting"
exit 1
fi
HIVE_FILE=$(basename $HIVE_DOWNLOAD_URL)
tar xzf $HIVE_FILE
HIVE_DIR="${HIVE_FILE%.*}"
HIVE_DIR="${HIVE_DIR%.*}"
mv $HIVE_DIR /opt/hive
rm -r $tmp_dir
chmod -R a+rw /opt/hive
ln -s /usr/share/java/mysql-connector-java.jar /opt/hive/lib/libmysql-java.jar
chown -R hadoop:hadoop /opt/hive
cat >> /home/hadoop/.bashrc <<EOF
HIVE_HOME=/opt/hive
PATH=\$PATH:\$HIVE_HOME/bin
EOF

8
elements/hive/root.d/0-check Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if [ -z "$HIVE_DOWNLOAD_URL" ]; then
version_check=$(echo $HIVE_VERSION | sed -e '/[0-9]\.[0-9][0-9]\.[0-9]/d')
if [ ! -z $version_check ]; then
echo -e "Unable to install Hive: You should specify HIVE_DOWNLOAD_URL or HIVE_VERSION.\nAborting"
exit 1
fi
fi