Skip to content

Instantly share code, notes, and snippets.

@a-romero
Last active April 28, 2018 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a-romero/d0824e2080496d6e954bbe891a325efd to your computer and use it in GitHub Desktop.
Save a-romero/d0824e2080496d6e954bbe891a325efd to your computer and use it in GitHub Desktop.
#To run - export any variables then execute below:
#curl -sSL https://gist.github.com/a-romero/d0824e2080496d6e954bbe891a325efd/raw | sudo -E sh
export ambari_password=${ambari_password:-StrongPassword} #Ambari password
export host_count=${host_count:-1} #choose number of nodes
export ambari_services=${ambari_services:-HDFS HIVE SPARK MAPREDUCE2 TEZ YARN ZOOKEEPER HBASE DRUID} #AMBARI_METRICS can be added post-install
export hdp_ver=${hdp_ver:-2.6}
export nifi_password=${nifi_password:-StrongPassword}
export ambari_version=${ambari_version:-2.6.1.3}
export mpack_url="http://public-repo-1.hortonworks.com/HDF/centos7/3.x/updates/3.1.0.0/tars/hdf_ambari_mp/hdf-ambari-mpack-3.1.0.0-564.tar.gz"
yum install -y git python-argparse mysql-connector-java* nc
cd ~
git clone https://github.com/seanorama/ambari-bootstrap.git
#remove unneeded repos for some AMIs
if [ -f /etc/yum.repos.d/zfs.repo ]; then
rm -f /etc/yum.repos.d/zfs.repo
fi
if [ -f /etc/yum.repos.d/lustre.repo ]; then
rm -f /etc/yum.repos.d/lustre.repo
fi
#install MySql community rpm
sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
export install_ambari_server=true
curl -sSL https://raw.githubusercontent.com/seanorama/ambari-bootstrap/master/ambari-bootstrap.sh | sudo -E sh
while ! echo exit | nc localhost 8080; do echo "waiting for Ambari to be fully up..."; sleep 10; done
echo "Changing Ambari password..."
curl -iv -u admin:admin -H "X-Requested-By: blah" -X PUT -d "{ \"Users\": { \"user_name\": \"admin\", \"old_password\": \"admin\", \"password\": \"${ambari_password}\" }}" http://localhost:8080/api/v1/users/admin
sudo ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
echo "Adding HDF mpack..."
sudo ambari-server install-mpack --verbose --mpack=${mpack_url}
sudo ambari-server restart
while ! echo exit | nc localhost 8080; do echo "waiting for Ambari to be fully up..."; sleep 10; done
sleep 20
echo "Setting recommendation strategy..."
export ambari_stack_version=${hdp_ver}
export recommendation_strategy="ALWAYS_APPLY_DONT_OVERRIDE_CUSTOM_VALUES"
echo "Generating BP and deploying cluster..."
cd ~/ambari-bootstrap/deploy
cat << EOF > configuration-custom.json
{
"configurations" : {
"core-site": {
"hadoop.proxyuser.root.users" : "admin",
"fs.trash.interval": "4320"
},
"hdfs-site": {
"dfs.replication": "1",
"dfs.namenode.safemode.threshold-pct": "0.99"
},
"hive-site": {
"hive.server2.transport.mode" : "binary"
}
}
}
EOF
./deploy-recommended-cluster.bash
##Once deployed run below to enable admin user to use Ambari views
# sudo -u hdfs hdfs dfs -mkdir /user/admin
# sudo -u hdfs hdfs dfs -chown admin /user/admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment