Add Hive DIB element
Change-Id: Iac3a13f2a70fd8888fc81c04629f2c696199d2a5
This commit is contained in:
parent
14560d749c
commit
d90cbdd9f7
3
elements/hive/README.md
Normal file
3
elements/hive/README.md
Normal 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'.
|
2
elements/hive/element-deps
Normal file
2
elements/hive/element-deps
Normal file
@ -0,0 +1,2 @@
|
||||
hadoop
|
||||
mysql
|
29
elements/hive/post-install.d/60-hive
Executable file
29
elements/hive/post-install.d/60-hive
Executable 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
8
elements/hive/root.d/0-check
Executable 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
|
Loading…
x
Reference in New Issue
Block a user