Created
October 5, 2015 00:32
-
-
Save actsasflinn/8b410fa3c625dd1d4b35 to your computer and use it in GitHub Desktop.
Hortonworks HDP Ambari Cluster Using Vagrant on Ubuntu
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
#VERSION_NUMBER=2.1.1-236 | |
[Updates-ambari-2.1.1] | |
name=ambari-2.1.1 - Updates | |
baseurl=http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.1.1 | |
gpgcheck=1 | |
gpgkey=http://public-repo-1.hortonworks.com/ambari/centos6/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins | |
enabled=1 | |
priority=1 |
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
#!/bin/sh | |
if [ ! -f hdp_id_ecdsa ]; then | |
ssh-keygen -t ecdsa -f hdp_id_ecdsa -N '' | |
fi | |
sudo echo "deb http://download.virtualbox.org/virtualbox/debian vivid contrib" >> /etc/apt/sources.list | |
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install virtualbox-5.0 dkms | |
sudo /etc/init.d/vboxdrv setup | |
vagrant up |
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
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 | |
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 | |
192.168.0.11 ambari1.mycluster ambari1 | |
192.168.0.12 master1.mycluster master1 | |
192.168.0.21 slave1.mycluster slave1 | |
192.168.0.22 slave2.mycluster slave2 |
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
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "hdp_vm" | |
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.7_chef-provisionerless.box" | |
$script = <<SCRIPT | |
sudo yum -y install ntp | |
sudo yum -y install wget | |
sudo chkconfig ntpd on | |
sudo /etc/init.d/ntpd start | |
sudo chkconfig iptables off | |
sudo /etc/init.d/iptables stop | |
sudo setenforce 0 | |
sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config | |
sudo sh -c 'echo "* soft nofile 10000" >> /etc/security/limits.conf' | |
sudo sh -c 'echo "* hard nofile 10000" >> /etc/security/limits.conf' | |
sudo sh -c 'echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag' | |
sudo sh -c 'echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled' | |
sudo cp /home/vagrant/hosts /etc/hosts | |
SCRIPT | |
$ambari_script = <<SCRIPT | |
sudo cp /home/vagrant/ambari.repo /etc/yum.repos.d/ambari.repo | |
sudo yum -y install ambari-server | |
SCRIPT | |
config.vm.provision "file", source: "hosts", destination: "~/hosts" | |
config.vm.provision "file", source: "hdp_id_ecdsa.pub", destination: "~/.ssh/authorized_keys2" | |
config.vm.provision "shell", inline: $script | |
# Ambari1 | |
config.vm.define :ambari1 do |a1| | |
a1.vm.provision "file", source: "ambari.repo", destination: "~/ambari.repo" | |
a1.vm.provision "shell", inline: $ambari_script | |
a1.vm.hostname = "ambari1.mycluster" | |
a1.vm.network :private_network, ip: "192.168.0.11" | |
a1.vm.provider :virtualbox do |vb| | |
vb.memory = "2048" | |
end | |
a1.vm.network "forwarded_port", guest: 8080, host: 8081 | |
a1.vm.network "forwarded_port", guest: 8000, host: 8001 | |
end | |
# Master1 | |
config.vm.define :master1 do |m1| | |
m1.vm.hostname = "master1.mycluster" | |
m1.vm.network :private_network, ip: "192.168.0.12" | |
m1.vm.provider :virtualbox do |vb| | |
vb.memory = "8192" | |
end | |
m1.vm.network "forwarded_port", guest: 8888, host: 8888 | |
end | |
# Slave1 | |
config.vm.define :slave1 do |s1| | |
s1.vm.hostname = "slave1.mycluster" | |
s1.vm.network :private_network, ip: "192.168.0.21" | |
s1.vm.provider :virtualbox do |vb| | |
vb.memory = "4096" | |
end | |
end | |
# Slave2 | |
config.vm.define :slave2 do |s2| | |
s2.vm.hostname = "slave2.mycluster" | |
s2.vm.network :private_network, ip: "192.168.0.22" | |
s2.vm.provider :virtualbox do |vb| | |
vb.memory = "4096" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment