Skip to content

Instantly share code, notes, and snippets.

@wjsl
Last active June 21, 2019 15:23
Show Gist options
  • Save wjsl/c09490203c02130daeaa2aa6fbace8b3 to your computer and use it in GitHub Desktop.
Save wjsl/c09490203c02130daeaa2aa6fbace8b3 to your computer and use it in GitHub Desktop.
Hacked up fork of the CDH vagrant cluster that's floating around. Updated to use OpenJDK 8 and CDH 6.2.0.
$master_script = <<SCRIPT
#!/bin/bash
apt-get install curl -y
curl -s https://archive.cloudera.com/cm6/6.2.0/ubuntu1604/apt/cloudera-manager.list > /etc/apt/sources.list.d/cloudera-manager.list
curl -s https://archive.cloudera.com/cm6/6.2.0/ubuntu1804/apt/archive.key > key
apt-key add key
rm key
apt-get update
export DEBIAN_FRONTEND=noninteractive
apt-get -q -y --force-yes install openjdk-8-jdk cloudera-manager-server-db cloudera-manager-server cloudera-manager-daemons
service cloudera-scm-server-db initdb
service cloudera-scm-server-db start
service cloudera-scm-server start
SCRIPT
$hosts_script = <<SCRIPT
cat > /etc/hosts <<EOF
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
EOF
SCRIPT
Vagrant.configure("2") do |config|
# Define base image
config.vm.box = "bento/ubuntu-18.04"
#config.vm.box_url = "http://files.vagrantup.com/precise64.box"
# Manage /etc/hosts on host and VMs
config.hostmanager.enabled = false
config.hostmanager.manage_host = true
config.hostmanager.include_offline = true
config.hostmanager.ignore_private_ip = false
config.vm.define :master do |master|
master.vm.provider :virtualbox do |v|
v.name = "vm-cluster-node1"
v.customize ["modifyvm", :id, "--memory", "4096"]
end
master.vm.network :private_network, ip: "10.211.55.100"
master.vm.hostname = "vm-cluster-node1"
master.vm.provision :shell, :inline => $hosts_script
master.vm.provision :hostmanager
master.vm.provision :shell, :inline => $master_script
end
config.vm.define :worker1 do |worker1|
worker1.vm.box = "bento/ubuntu-18.04"
worker1.vm.provider :virtualbox do |v|
v.name = "vm-cluster-node2"
v.customize ["modifyvm", :id, "--memory", "4096"]
end
worker1.vm.network :private_network, ip: "10.211.55.101"
worker1.vm.hostname = "vm-cluster-node2"
worker1.vm.provision :shell, :inline => $hosts_script
worker1.vm.provision :hostmanager
end
config.vm.define :worker2 do |worker2|
worker2.vm.box = "bento/ubuntu-18.04"
worker2.vm.provider :virtualbox do |v|
v.name = "vm-cluster-node3"
v.customize ["modifyvm", :id, "--memory", "4096"]
end
worker2.vm.network :private_network, ip: "10.211.55.102"
worker2.vm.hostname = "vm-cluster-node3"
worker2.vm.provision :shell, :inline => $hosts_script
worker2.vm.provision :hostmanager
end
config.vm.define :worker3 do |worker3|
worker3.vm.box = "bento/ubuntu-18.04"
worker3.vm.provider :virtualbox do |v|
v.name = "vm-cluster-node4"
v.customize ["modifyvm", :id, "--memory", "4096"]
end
worker3.vm.network :private_network, ip: "10.211.55.103"
worker3.vm.hostname = "vm-cluster-node4"
worker3.vm.provision :shell, :inline => $hosts_script
worker3.vm.provision :hostmanager
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment