Skip to content

Instantly share code, notes, and snippets.

@dispalt
Created June 8, 2015 21:27
Show Gist options
  • Save dispalt/0625fe8e4aeab61a522b to your computer and use it in GitHub Desktop.
Save dispalt/0625fe8e4aeab61a522b to your computer and use it in GitHub Desktop.
#!/bin/bash
FRAMEWORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.."
DIST_NAME=hdfs-mesos
DIST_VERSION=0.1.1
DIST=$DIST_NAME-$DIST_VERSION
export MESOS_HDFS_DATA_DIR=${MESOS_HDFS_DATA_DIR:-"/tmp/hdfs/data"}
export MESOS_HDFS_SECONDARY_DATA_DIR=${MESOS_HDFS_SECONDARY_DATA_DIR:-"/var/run/hadoop-hdfs"}
export MESOS_HDFS_NATIVE_HADOOP_BINARIES=${MESOS_HDFS_NATIVE_HADOOP_BINARIES:-false}
export MESOS_HDFS_FRAMEWORK_MNT_PATH=${MESOS_HDFS_FRAMEWORK_MNT_PATH:-"/opt/mesosphere"}
export MESOS_HDFS_STATE_ZK=${MESOS_HDFS_STATE_ZK:-"localhost:2181"}
export MESOS_MASTER_URI=${MESOS_MASTER_URI:-"zk://localhost:2181/mesos"}
export MESOS_HDFS_ZKFC_HA_ZOOKEEPER_QUORUM=${MESOS_HDFS_ZKFC_HA_ZOOKEEPER_QUORUM:-"localhost:2181"}
export MESOS_HDFS_FRAMEWORK_NAME=${MESOS_HDFS_FRAMEWORK_NAME:-"hdfs"}
export MESOS_HDFS_MESOSDNS=${MESOS_HDFS_MESOSDNS:-false}
export MESOS_HDFS_MESOSDNS_DOMAIN=${MESOS_HDFS_MESOSDNS_DOMAIN:-"mesos"}
export MESOS_NATIVE_LIBRARY=${MESOS_NATIVE_LIBRARY:-"/usr/local/lib/libmesos.so"}
export MESOS_HDFS_JOURNALNODE_COUNT=${MESOS_HDFS_JOURNALNODE_COUNT:-3}
export MESOS_HDFS_JVM_OVERHEAD=${MESOS_HDFS_JVM_OVERHEAD:-1.35}
export MESOS_HDFS_HADOOP_HEAP_SIZE=${MESOS_HDFS_HADOOP_HEAP_SIZE:-512}
export MESOS_HDFS_NAMENODE_HEAP_SIZE=${MESOS_HDFS_NAMENODE_HEAP_SIZE:-4096}
export MESOS_HDFS_DATANODE_HEAP_SIZE=${MESOS_HDFS_DATANODE_HEAP_SIZE:-1024}
export MESOS_HDFS_EXECUTOR_HEAP_SIZE=${MESOS_HDFS_EXECUTOR_HEAP_SIZE:-256}
export MESOS_HDFS_EXECUTOR_CPUS=${MESOS_HDFS_EXECUTOR_CPUS:-0.5}
export MESOS_HDFS_NAMENODE_CPUS=${MESOS_HDFS_NAMENODE_CPUS:-1}
export MESOS_HDFS_JOURNALNODE_CPUS=${MESOS_HDFS_JOURNALNODE_CPUS:-1}
export MESOS_HDFS_DATANODE_CPUS=${MESOS_HDFS_DATANODE_CPUS:-1}
export MESOS_HDFS_USER=${MESOS_HDFS_USER:-"root"}
export MESOS_HDFS_ROLE=${MESOS_HDFS_ROLE:-"*"}
echo "- env ------------------------------------------------------------------"
env | sort
echo "------------------------------------------------------------------------"
echo "- mesos-site.xml -------------------------------------------------------"
envsubst < /tmp/mesos-site.xml > $FRAMEWORK_DIR/etc/hadoop/mesos-site.xml
rm /tmp/mesos-site.xml ; cp $FRAMEWORK_DIR/etc/hadoop/mesos-site.xml /tmp/mesos-site.xml
pushd ..
rm $DIST.tgz ; tar czf $DIST.tgz $DIST
popd
cat $FRAMEWORK_DIR/etc/hadoop/mesos-site.xml
echo "------------------------------------------------------------------------"
if [ -z "$PORT0" ] ; then
PORT0="8765"
fi
if [ -z "$JAVA_HOME" ]; then
JAVA_CMD=$(readlink -f $(which java))
if [ -z "$JAVA_CMD" ]; then
echo “Error: java not found and JAVA_HOME not set”
exit 1;
fi
else
JAVA_CMD=$JAVA_HOME/bin/java
fi
exec $JAVA_CMD -cp $FRAMEWORK_DIR/lib/*.jar -Dmesos.conf.path=$FRAMEWORK_DIR/etc/hadoop/mesos-site.xml -Dmesos.hdfs.config.server.port=$PORT0 org.apache.mesos.hdfs.Main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment