This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
-
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.
Cleanup shell scripts and Dockerfile (#4)
* Fix shellcheck errors * Cleanup all shell scripts with shfmt and shellcheck * Lint Dockerfile
- Loading branch information
Showing
8 changed files
with
192 additions
and
188 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
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 |
---|---|---|
@@ -1,40 +1,40 @@ | ||
#!/bin/bash | ||
: ${HADOOP_HOME:=/usr/local/hadoop} | ||
$HADOOP_HOME/etc/hadoop/hadoop-env.sh | ||
: "$HADOOP_HOME:=/usr/local/hadoop" | ||
"$HADOOP_HOME"/etc/hadoop/hadoop-env.sh | ||
|
||
# Remove annoying warnings about dependencies | ||
export ACCUMULO_HOME=/tmp | ||
export ZOOKEEPER_HOME=/tmp | ||
export HBASE_HOME=/tmp | ||
|
||
# Replace namenode hostname with docker-compose hostname | ||
sed s/HOSTNAME/$MASTER_HOSTNAME/ $HADOOP_HOME/etc/hadoop/core-site.xml.template > /usr/local/hadoop/etc/hadoop/core-site.xml | ||
sed s/HOSTNAME/$MASTER_HOSTNAME/ $HADOOP_HOME/etc/hadoop/yarn-site.xml.template > /usr/local/hadoop/etc/hadoop/yarn-site.xml | ||
sed s/HOSTNAME/$MASTER_HOSTNAME/ $HADOOP_HOME/etc/hadoop/mapred-site.xml.template > /usr/local/hadoop/etc/hadoop/mapred-site.xml | ||
sed s/HOSTNAME/"$MASTER_HOSTNAME"/ "$HADOOP_HOME"/etc/hadoop/core-site.xml.template > /usr/local/hadoop/etc/hadoop/core-site.xml | ||
sed s/HOSTNAME/"$MASTER_HOSTNAME"/ "$HADOOP_HOME"/etc/hadoop/yarn-site.xml.template > /usr/local/hadoop/etc/hadoop/yarn-site.xml | ||
sed s/HOSTNAME/"$MASTER_HOSTNAME"/ "$HADOOP_HOME"/etc/hadoop/mapred-site.xml.template > /usr/local/hadoop/etc/hadoop/mapred-site.xml | ||
|
||
# Don't start hadoop for metastore server | ||
if [[ -z "$SKIP_BOOTSTRAP" ]]; then | ||
# Clear HDFS datanode storage location | ||
rm -rf /tmp/hadoop/dataNode/* | ||
|
||
# Remove ssh keys from data nodes | ||
if [[ $HOSTNAME != $MASTER_HOSTNAME ]]; then | ||
if [[ "$HOSTNAME" != "$MASTER_HOSTNAME" ]]; then | ||
rm /root/.ssh/id_ed25519 | ||
fi | ||
|
||
# Add node hostnames to workers file | ||
echo $MASTER_HOSTNAME > $HADOOP_HOME/etc/hadoop/workers | ||
echo $NODE_HOSTNAMES | tr -s ' ' '\n' >> $HADOOP_HOME/etc/hadoop/workers | ||
echo "$MASTER_HOSTNAME" > "$HADOOP_HOME"/etc/hadoop/workers | ||
echo "$NODE_HOSTNAMES" | tr -s ' ' '\n' >> "$HADOOP_HOME"/etc/hadoop/workers | ||
|
||
# Start hadoop | ||
/usr/sbin/sshd | ||
$HADOOP_HOME/sbin/start-dfs.sh | ||
$HADOOP_HOME/sbin/start-yarn.sh | ||
$HADOOP_HOME/bin/mapred --daemon start historyserver | ||
"$HADOOP_HOME"/sbin/start-dfs.sh | ||
"$HADOOP_HOME"/sbin/start-yarn.sh | ||
"$HADOOP_HOME"/bin/mapred --daemon start historyserver | ||
hdfs dfs -mkdir -p /user/root/ | ||
|
||
# Grab JDBC drivers from mounted volume | ||
cp /jdbc/* $SQOOP_HOME/lib | ||
cp /jdbc/* "$SQOOP_HOME"/lib | ||
else | ||
echo "Skipping hadoop bootstrap..." | ||
fi |
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
/usr/sbin/sshd | ||
$HADOOP_HOME/bin/hdfs namenode -format | ||
$HADOOP_HOME/sbin/start-dfs.sh | ||
$HADOOP_HOME/bin/hdfs dfs -mkdir -p /user/hive/warehouse/iasworld.db | ||
"$HADOOP_HOME"/bin/hdfs namenode -format | ||
"$HADOOP_HOME"/sbin/start-dfs.sh | ||
"$HADOOP_HOME"/bin/hdfs dfs -mkdir -p /user/hive/warehouse/iasworld.db |
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
Oops, something went wrong.