Support for Vagrant-libvirt based testbed. The top level vagrant folder is organizated for supporing a set of Vagrant file approaches. The first approach is to support Apache Mesos clusters for Apache Myriad development. The availables configuraions are:
1. vagrant/mesos/virtualbox -> the original Vagrant file so far in Apache Myriad 2. vagrant/mesos/libvirt -> new Vagrant structure based on Libivrt/KVM JIRA: [MYRIAD-261] https://issues.apache.org/jira/browse/MYRIAD-261 Pull Request: Closes #107 Author: Javi Roman <jroman.espi...@gmail.com> Date: Fri, 16 Mar 2018 19:22:08 +0100 Project: http://git-wip-us.apache.org/repos/asf/incubator-myriad/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-myriad/commit/2ce260e0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-myriad/tree/2ce260e0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-myriad/diff/2ce260e0 Branch: refs/heads/master Commit: 2ce260e07f0c2af5bb7e09ca9041ffa71f3259aa Parents: 2f4ad0d Author: Javi Roman <jroman.espi...@gmail.com> Authored: Fri Mar 16 19:22:08 2018 +0100 Committer: Javi Roman <javiro...@apache.org> Committed: Thu Apr 5 18:17:50 2018 +0200 ---------------------------------------------------------------------- Vagrantfile | 79 ------ vagrant/README.md | 8 + vagrant/format_namenode.sh | 23 -- vagrant/install_default_jdk.sh | 32 --- vagrant/install_docker.sh | 25 -- vagrant/install_hadoop.sh | 115 --------- vagrant/install_mesos.sh | 38 --- vagrant/mesos/libvirt/README.md | 55 +++++ vagrant/mesos/libvirt/mesos/README.md | 245 +++++++++++++++++++ vagrant/mesos/libvirt/mesos/Vagrantfile | 92 +++++++ vagrant/mesos/libvirt/mesos/ansible.cfg | 79 ++++++ vagrant/mesos/libvirt/mesos/check-env.sh | 28 +++ .../libvirt/mesos/config/cluster-1m4a.yaml | 64 +++++ .../libvirt/mesos/config/cluster-3m4a.yaml | 76 ++++++ vagrant/mesos/libvirt/mesos/docs/ansible.txt | 1 + vagrant/mesos/libvirt/mesos/docs/build-mesos.md | 135 ++++++++++ .../mesos/libvirt/mesos/docs/notes-myriad.txt | 11 + .../mesos/libvirt/mesos/docs/steps-hadoop.txt | 145 +++++++++++ .../provisioning/group_vars/all/defaults.yml | 100 ++++++++ .../libvirt/mesos/provisioning/inventory.py | 219 +++++++++++++++++ .../provisioning/roles/common/handlers/main.yml | 20 ++ .../provisioning/roles/common/tasks/main.yml | 104 ++++++++ .../roles/common/templates/hostname-fix.j2 | 23 ++ .../roles/common/templates/hosts.j2 | 26 ++ .../roles/common/templates/ntp.conf.j2 | 24 ++ .../provisioning/roles/common/vars/main.yml | 2 + .../provisioning/roles/devel/handlers/main.yml | 29 +++ .../provisioning/roles/devel/tasks/main.yml | 70 ++++++ .../roles/devel/templates/exports.j2 | 34 +++ .../provisioning/roles/dfs-start/tasks/main.yml | 39 +++ .../provisioning/roles/docker/tasks/main.yml | 63 +++++ .../roles/hadoop/files/core-site.xml | 23 ++ .../roles/hadoop/files/hdfs-site.xml | 34 +++ .../provisioning/roles/hadoop/files/java.sh | 20 ++ .../roles/hadoop/files/mapred-site.xml | 24 ++ .../hadoop/files/myriad-config-default.yml | 76 ++++++ .../provisioning/roles/hadoop/files/slaves | 3 + .../provisioning/roles/hadoop/files/workers | 3 + .../roles/hadoop/files/yarn-site.xml | 40 +++ .../provisioning/roles/hadoop/tasks/build.yml | 51 ++++ .../roles/hadoop/tasks/datanode.yml | 50 ++++ .../provisioning/roles/hadoop/tasks/main.yml | 37 +++ .../roles/hadoop/tasks/namenode.yml | 68 +++++ .../roles/nfs-client/tasks/main.yml | 31 +++ .../roles/passwordless/tasks/build.yml | 38 +++ .../roles/passwordless/tasks/main.yml | 24 ++ .../roles/passwordless/tasks/master.yml | 83 +++++++ .../roles/yarn-start/tasks/main.yml | 30 +++ .../provisioning/roles/zookeeper/tasks/main.yml | 51 ++++ .../mesos/libvirt/mesos/provisioning/site.yml | 63 +++++ vagrant/mesos/libvirt/mesos/setup-env | 23 ++ vagrant/mesos/virtualbox/Vagrantfile | 79 ++++++ .../virtualbox/provisioning/format_namenode.sh | 23 ++ .../provisioning/install_default_jdk.sh | 32 +++ .../virtualbox/provisioning/install_docker.sh | 25 ++ .../virtualbox/provisioning/install_hadoop.sh | 115 +++++++++ .../virtualbox/provisioning/install_mesos.sh | 38 +++ .../mesos/virtualbox/provisioning/shutdown.sh | 30 +++ .../virtualbox/provisioning/start_datanode.sh | 24 ++ .../provisioning/start_historyserver.sh | 23 ++ .../provisioning/start_mesos_master.sh | 34 +++ .../provisioning/start_mesos_slave.sh | 38 +++ .../virtualbox/provisioning/start_namenode.sh | 27 ++ vagrant/shutdown.sh | 30 --- vagrant/start_datanode.sh | 24 -- vagrant/start_historyserver.sh | 23 -- vagrant/start_mesos_master.sh | 34 --- vagrant/start_mesos_slave.sh | 38 --- vagrant/start_namenode.sh | 27 -- 69 files changed, 2952 insertions(+), 488 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/Vagrantfile ---------------------------------------------------------------------- diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 9eb7d2b..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,79 +0,0 @@ -# -*- mode: ruby -*- -# # vi: set ft=ruby : - -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -VAGRANTFILE_API_VERSION = "2" - -HADOOP_VERSION="2.7.0" -PRIVATE_IP="10.141.141.20" - -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - config.vm.box = "ubuntu/trusty64" - config.vm.box_url = "https://vagrantcloud.com/ubuntu/boxes/trusty64" - config.vm.network :private_network, ip: "#{PRIVATE_IP}" - - # Configure VM resources - config.vm.provider :virtualbox do |vb| - vb.name = "myriad-dev" - vb.customize ["modifyvm", :id, "--memory", "4096"] - vb.customize ["modifyvm", :id, "--cpus", "2"] - vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] - vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] - end - - if Vagrant.has_plugin?("vagrant-cachier") - # Configure cached packages to be shared between instances of the same base box. - config.cache.scope = :box - end - - # Forward mesos master and slave ports - config.vm.network "forwarded_port", guest: 5005, host: 5005 - config.vm.network "forwarded_port", guest: 5050, host: 5050 - config.vm.network "forwarded_port", guest: 5051, host: 5051 - - # Forward myriad web and admin ports - config.vm.network "forwarded_port", guest: 8080, host: 8080 - config.vm.network "forwarded_port", guest: 8081, host: 8081 - - # Forward YARN/Hadoop ports - config.vm.network "forwarded_port", guest: 50070, host: 50070 - config.vm.network "forwarded_port", guest: 50075, host: 50075 - config.vm.network "forwarded_port", guest: 8088, host: 8088 - config.vm.network "forwarded_port", guest: 8042, host: 8042 - config.vm.network "forwarded_port", guest: 19888, host: 19888 - config.vm.network "forwarded_port", guest: 8192, host: 8192 - config.vm.network "forwarded_port", guest: 2181, host: 2181 - - # install software - config.vm.provision "shell", path: "vagrant/install_default_jdk.sh" - config.vm.provision "shell", path: "vagrant/install_mesos.sh" - config.vm.provision "shell", path: "vagrant/install_docker.sh" - config.vm.provision "shell", path: "vagrant/install_hadoop.sh", args: ["#{HADOOP_VERSION}"] - - # start things up - config.vm.provision "shell", path: "vagrant/start_mesos_master.sh" - config.vm.provision "shell", path: "vagrant/start_mesos_slave.sh" - config.vm.provision "shell", path: "vagrant/format_namenode.sh" - config.vm.provision "shell", path: "vagrant/start_namenode.sh" - config.vm.provision "shell", path: "vagrant/start_datanode.sh" - config.vm.provision "shell", path: "vagrant/start_historyserver.sh" - -end http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/README.md ---------------------------------------------------------------------- diff --git a/vagrant/README.md b/vagrant/README.md new file mode 100644 index 0000000..a1ccfbb --- /dev/null +++ b/vagrant/README.md @@ -0,0 +1,8 @@ +# Development Testbed based on Vagrant + +Vagrant is a tool for building complete development environments, sandboxed in +a virtual machine. Vagrant is a Swiss Army knife for development environments. +It does everything you need to create and manage them, and helps enforce good +practices by encouraging the use of automation and an environment that more +closely resembles production. + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/format_namenode.sh ---------------------------------------------------------------------- diff --git a/vagrant/format_namenode.sh b/vagrant/format_namenode.sh deleted file mode 100644 index e944a41..0000000 --- a/vagrant/format_namenode.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -v -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -set -e - -# Format NameNode -sudo -u hduser sh -c 'yes Y | /usr/local/hadoop/bin/hdfs namenode -format' http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/install_default_jdk.sh ---------------------------------------------------------------------- diff --git a/vagrant/install_default_jdk.sh b/vagrant/install_default_jdk.sh deleted file mode 100644 index 0a85c3c..0000000 --- a/vagrant/install_default_jdk.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -v -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -PREFIX="JAVA Default JDK Provisioner:" -set -e - -# For installing Java 8 -apt-get -y update -apt-get -y install default-jdk - -if $(test -e /usr/lib/libjvm.so); then - rm /usr/lib/libjvm.so -fi - -ln -s /usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so /usr/lib/libjvm.so http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/install_docker.sh ---------------------------------------------------------------------- diff --git a/vagrant/install_docker.sh b/vagrant/install_docker.sh deleted file mode 100644 index a0a214f..0000000 --- a/vagrant/install_docker.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -v -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -set -e - -#Install docker -echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list -apt-get update -apt-get -y install docker.io http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/install_hadoop.sh ---------------------------------------------------------------------- diff --git a/vagrant/install_hadoop.sh b/vagrant/install_hadoop.sh deleted file mode 100644 index fe5c2a0..0000000 --- a/vagrant/install_hadoop.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -v -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# $1 is HADOOP_VERSION -set -e - -apt-get update - -apt-get install -y openssh-server -apt-get install -y tar -apt-get install -y gzip - -# Add hduser user and hadoop group - -if [ `/bin/egrep -i "^hadoop:" /etc/group` ]; then - echo "Group hadoop already exists" -else - echo "Adding hadoop group" - addgroup hadoop -fi - - -if [ `/bin/egrep -i "^hduser:" /etc/passwd` ]; then - echo "User hduser already exists" -else - echo "creating hduser in group hadoop" - adduser --ingroup hadoop --disabled-password --gecos "" --home /home/hduser hduser - adduser hduser sudo -fi - -# Setup password-less auth -sudo -u hduser sh -c "mkdir -p /home/hduser/.ssh" -sudo -u hduser sh -c "chmod 700 /home/hduser/.ssh" -sudo -u hduser sh -c "yes | ssh-keygen -t rsa -N '' -f /home/hduser/.ssh/id_rsa" -sudo -u hduser sh -c 'cat /home/hduser/.ssh/id_rsa.pub >> /home/hduser/.ssh/authorized_keys' -#sudo -u hduser sh -c "ssh-keyscan -H $1 >> /home/hduser/.ssh/known_hosts" -sudo -u hduser sh -c "ssh-keyscan -H localhost >> /home/hduser/.ssh/known_hosts" -#sudo -u hduser sh -c "ssh-keyscan -H $2 >> /home/hduser/.ssh/known_hosts" - -# Download Hadoop -HADOOP_VER="$1" -cd ~ -if [ ! -f /tmp/hadoop-${HADOOP_VER}.tar.gz ]; then - wget http://apache.osuosl.org/hadoop/common/hadoop-${HADOOP_VER}/hadoop-${HADOOP_VER}.tar.gz -O /tmp/hadoop-${HADOOP_VER}.tar.gz -fi - -sudo tar ixzf /tmp/hadoop-${HADOOP_VER}.tar.gz -C /usr/local -cd /usr/local -rm -rf hadoop -sudo mv -f hadoop-${HADOOP_VER} hadoop -sudo chown -R hduser:hadoop hadoop - -# Init bashrc with hadoop env variables -sudo sh -c 'echo export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 >> /home/hduser/.bashrc' -sudo sh -c 'echo export HADOOP_INSTALL=/usr/local/hadoop >> /home/hduser/.bashrc' -sudo sh -c 'echo export PATH=\$PATH:\$HADOOP_INSTALL/bin >> /home/hduser/.bashrc' -sudo sh -c 'echo export PATH=\$PATH:\$HADOOP_INSTALL/sbin >> /home/hduser/.bashrc' -sudo sh -c 'echo export HADOOP_MAPRED_HOME=\$HADOOP_INSTALL >> /home/hduser/.bashrc' -sudo sh -c 'echo export HADOOP_COMMON_HOME=\$HADOOP_INSTALL >> /home/hduser/.bashrc' -sudo sh -c 'echo export HADOOP_HDFS_HOME=\$HADOOP_INSTALL >> /home/hduser/.bashrc' -sudo sh -c 'echo export YARN_HOME=\$HADOOP_INSTALL >> /home/hduser/.bashrc' -sudo sh -c 'echo export HADOOP_COMMON_LIB_NATIVE_DIR=\$\{HADOOP_INSTALL\}/lib/native >> /home/hduser/.bashrc' -sudo sh -c 'echo export HADOOP_OPTS=\"-Djava.library.path=\$HADOOP_INSTALL/lib\" >> /home/hduser/.bashrc' -# hit the vagrant user with the same thing -sudo sh -c 'echo export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 >> /home/vagrant/.bashrc' -sudo sh -c 'echo export HADOOP_INSTALL=/usr/local/hadoop >> /home/vagrant/.bashrc' -sudo sh -c 'echo export PATH=\$PATH:\$HADOOP_INSTALL/bin >> /home/vagrant/.bashrc' -sudo sh -c 'echo export PATH=\$PATH:\$HADOOP_INSTALL/sbin >> /home/vagrant/.bashrc' -sudo sh -c 'echo export HADOOP_MAPRED_HOME=\$HADOOP_INSTALL >> /home/vagrant/.bashrc' -sudo sh -c 'echo export HADOOP_COMMON_HOME=\$HADOOP_INSTALL >> /home/vagrant/.bashrc' -sudo sh -c 'echo export HADOOP_HDFS_HOME=\$HADOOP_INSTALL >> /home/vagrant/.bashrc' -sudo sh -c 'echo export YARN_HOME=\$HADOOP_INSTALL >> /home/vagrant/.bashrc' -sudo sh -c 'echo export HADOOP_COMMON_LIB_NATIVE_DIR=\$\{HADOOP_INSTALL\}/lib/native >> /home/vagrant/.bashrc' -sudo sh -c 'echo export HADOOP_OPTS=\"-Djava.library.path=\$HADOOP_INSTALL/lib\" >> /home/vagrant/.bashrc' - - -# Modify JAVA_HOME in hadoop-env -cd /usr/local/hadoop/etc/hadoop -sudo -u hduser sed -i.bak s=\${JAVA_HOME}=//usr/lib/jvm/java-7-openjdk-amd64/=g hadoop-env.sh -pwd - -/usr/local/hadoop/bin/hadoop version - -# Update configuration -sudo -u hduser sed -i.bak 's=<configuration>=<configuration>\<property>\<name>fs\.default\.name\</name>\<value>hdfs://localhost:9000\</value>\</property>=g' core-site.xml -#sudo -u hduser sed -i.bak 's=<configuration>=<configuration>\<property>\<name>fs\.default\.name\</name>\<value>hdfs://'"$1"':9000\</value>\</property>=g' core-site.xml -sudo -u hduser sed -i.bak 's=<configuration>=<configuration>\<property>\<name>yarn\.nodemanager\.aux-services</name>\<value>mapreduce_shuffle</value>\</property>\<property>\<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>\<value>org\.apache\.hadoop\.mapred\.ShuffleHandler</value>\</property>=g' yarn-site.xml - -sudo -u hduser cp mapred-site.xml.template mapred-site.xml -sudo -u hduser sed -i.bak 's=<configuration>=<configuration>\<property>\<name>mapreduce\.framework\.name</name>\<value>yarn</value>\</property>=g' mapred-site.xml - -cd ~ -sudo -u hduser sh -c 'mkdir -p ~hduser/mydata/hdfs/namenode' -sudo -u hduser sh -c 'mkdir -p ~hduser/mydata/hdfs/datanode' -sudo chown -R hduser:hadoop ~hduser/mydata - -cd /usr/local/hadoop/etc/hadoop -sudo -u hduser sed -i.bak 's=<configuration>=<configuration>\<property>\<name>dfs\.replication</name>\<value>1\</value>\</property>\<property>\<name>dfs\.namenode\.name\.dir</name>\<value>file:/home/hduser/mydata/hdfs/namenode</value>\</property>\<property>\<name>dfs\.datanode\.data\.dir</name>\<value>file:/home/hduser/mydata/hdfs/datanode</value>\</property>\<property>\<name>dfs\.namenode\.datanode\.registration\.ip-hostname-check</name>\<value>false</value>\</property>=g' hdfs-site.xml http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/install_mesos.sh ---------------------------------------------------------------------- diff --git a/vagrant/install_mesos.sh b/vagrant/install_mesos.sh deleted file mode 100644 index d3521f5..0000000 --- a/vagrant/install_mesos.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -v -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -PREFIX="Mesos Provisioner: " -set -e - -echo "${PREFIX} Installing pre-reqs..." -# For Mesos -apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF -DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]') -CODENAME=$(lsb_release -cs) -echo "deb http://repos.mesosphere.io/${DISTRO} ${CODENAME} main" | sudo tee /etc/apt/sources.list.d/mesosphere.list -apt-get -y update - -apt-get -y install libcurl3 -apt-get -y install zookeeperd -apt-get -y install aria2 -apt-get -y install ssh -apt-get -y install rsync - -apt-get -y install mesos=0.24.1-0.2.35.ubuntu1404 http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/README.md ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/README.md b/vagrant/mesos/libvirt/README.md new file mode 100644 index 0000000..ced3779 --- /dev/null +++ b/vagrant/mesos/libvirt/README.md @@ -0,0 +1,55 @@ +# Myriad Vagrant based testbed setup + +This is a development environment for the Apache Myriad project based on +Vagrant and libvirt. + +You have to setup properly your environment in order to use Vagrant and +libvirt. Follow the steps in the nex section for different environments. + +# Requeriments + +Download Vagrant from HashiCorp site: + +https://www.vagrantup.com/downloads.html + +## For Ubuntu users + +``` +$ sudo apt-get install software-properties-common +$ sudo apt-add-repository ppa:ansible/ansible +$ sudo apt-get update +$ sudo apt-get install ansible +$ sudo apt-get install qemu-kvm libvirt-bin libvirt-dev +$ sudo apt-get install ruby-libvirt + +$ vagrant plugin install vagrant-libvirt +Installing the 'vagrant-libvirt' plugin. This can take a few minutes... +$ vagrant plugin list +vagrant-libvirt (0.0.40, system) + +$ sudo usermod -G libvirtd -a $USER +$ newgrp - +``` + +## For Fedora users + +``` +dnf -y install qemu libvirt libvirt-devel ruby-devel gcc +dnf -y install libxslt-devel libxml2-devel libvirt-devel +dnf -y install libguestfs-tools-c ruby-devel gcc +``` + +Testing Vagrant-libvirt: + +``` +$ mkdir test && cd test +$ vagrant init centos/7 +$ vagrant up --provider libvirt +$ vagrant box list +centos/7 (libvirt, 1702.01) +$ vagrant status +$ vagrant ssh +$ vagrant destroy +$ cd .. && rm -fr test +``` + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/README.md ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/README.md b/vagrant/mesos/libvirt/mesos/README.md new file mode 100644 index 0000000..02d6584 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/README.md @@ -0,0 +1,245 @@ +# Plain Apache Mesos Environment + +This is the Vagrant-libvirt based environment for testing Apache Myriad +project in a Mesos cluster. + +# Setup the environment + +In order to use this vagrant environment we have to enable a suitable +environment. The key points of this environment are: + +- **MESOS_ARCH**: This variable has to match with the VMs architecture defined in + the config folder: *cluster-1m4a.yaml*, *cluster-3m4a.yaml*, and so on. For + example **MESOS_ARCH: 1m4a** matchs with the architecture *cluster-1m4a.yaml*, which + is a Mesos master node (1m), and four Mesos agents (4a). + +- **HADOOP_VERSION**: This variable is used for downloading a binary distribution + of Apache HAdoop. + +- **ZOOKEEPER_VERSION**: For dowloading an Apache Zookeeper binary distribution. + +``` +$ source setup-env + +This Vagrant environment is ready for the following settings: + +- MESOS_ARCH: 1m4a +- HADOOP_VERSION: 2.7.0 +- ZOOKEEPER_VERSION: 3.4.11 + +'vagrant up --provider=libvirt' and happy hacking! +``` + +# Running the deployment + +The VMs provisioning is based on Ansible, the provisioning is guided by the +main playbook **provisioning/site.yml** and one special **provisioing/inventory.py** +for creating a dynamic inventory. This dynamic inventory is created for +managing the Ansible provisioning with a multi-machine Vagrant environment, +because the Vagrant Ansible support is sometime problematic. + +``` +$ vagrant up --provider=libvirt +[...] +PLAY RECAP +********************************************************************* +build : ok=36 changed=28 unreachable=0 failed=0 +mesos-a1 : ok=28 changed=25 unreachable=0 failed=0 +mesos-a2 : ok=31 changed=28 unreachable=0 failed=0 +mesos-a3 : ok=31 changed=28 unreachable=0 failed=0 +mesos-a4 : ok=31 changed=28 unreachable=0 failed=0 +mesos-m1 : ok=41 changed=38 unreachable=0 failed=0 +``` + +## Final VMs set + +``` +$ vagrant status +Current machine states: + +build running (libvirt) +mesos-m1 running (libvirt) +mesos-a1 running (libvirt) +mesos-a2 running (libvirt) +mesos-a3 running (libvirt) +mesos-a4 running (libvirt) +``` + +The VM dedicated for development is *build*, the development is maded in the +*/opt* folder: + +``` +$ vagrant ssh build +[vagrant@build ~]$ tree -d -L 1 /opt/ +/opt/ +âââ hadoop +âââ mesos +âââ myriad +``` + +# Building the ecosystem + +The strategy is to build the target Apache Mesos version from source, and +build Myriad framework as follow: + +## Building Apache Mesos + +``` +[vagrant@build ~]$ cd /opt/mesos +[vagrant@build ~]$ git checkout 0.28.1 +[vagrant@build ~]$ ./bootstrap +[vagrant@build ~]$ mkdir build +[vagrant@build ~]$ cd build +[vagrant@build ~]$ ../configure +[vagrant@build ~]$ make +[...] +running install_scripts +creating build/bdist.linux-x86_64/wheel/mesos.native-0.28.1.dist-info/WHEEL +make[2]: Leaving directory `/opt/mesos/build/src' +make[1]: Leaving directory `/opt/mesos/build/src' +``` + +## Building Myriad Framework + +``` +[vagrant@build myriad]$ cd /opt/myriad +[vagrant@build myriad]$ ./gradlew build +[...] +:myriad-scheduler:test +:myriad-scheduler:check +:myriad-scheduler:build + +BUILD SUCCESSFUL + +Total time: 3 mins 56.948 secs +``` + +# Running the ecosystem + +The ecosystem was built from **build** VM, however the execution of ecosystem +is carried out from **mesos-m1** VM and mesos agents. + +## Running Mesos 3rdparty shipped Zookeeper + +We have to run a Zookeeper server, we can use the shipped Zookeeper expecified +at ZOOKEEPER_VERSION, or we can use the already shipped Zookeeper at 3rdparty +Mesos folder. Let see who to run the 3rdparty Zookeeper shipped with Mesos. + +``` +$ vagrant ssh mesos-m1 +[vagrant@mesos-m1 ~]$ cd /opt/mesos/build/3rdparty/zookeeper-3.4.5/ +[vagrant@mesos-m1 zookeeper-3.4.5]$ cp conf/zoo_sample.cfg conf/zoo.cfg +[vagrant@mesos-m1 zookeeper-3.4.5]$ echo "server.1=mesos-m1:2888:3888" >> conf/zoo.cfg +[vagrant@mesos-m1 zookeeper-3.4.5]$ bin/zkServer.sh start +[vagrant@mesos-m1 zookeeper-3.4.5]$ echo ruok | nc 127.0.0.1 2181 +imok +[vagrant@mesos-m1 ~]$ jps +16290 Jps +16253 QuorumPeerMain +``` + +## Running Apache Mesos + +- At mesos-m1 + +``` +[vagrant@mesos-m1 ~]$ cd /opt/mesos/build +[vagrant@mesos-m1 build]$ sudo ./bin/mesos-master.sh --ip=100.0.10.101 --work_dir=/var/lib/mesos --zk=zk://mesos-m1:2181/mesos --quorum=1 +``` + +- At agents mesos-a[1..4]: + +``` +[vagrant@mesos-a1 ~]$ cd /opt/mesos/build +[vagrant@mesos-a1 build]$ sudo ./bin/mesos-slave.sh --master=zk://mesos-m1:2181/mesos --work_dir=/var/lib/mesos +``` + +*Note*: mesos-slave.sh was changed for newer versions of Mesos for mesos-agent.sh + +The Mesos Master web interface can be accessed via the URL: + +http://100.0.10.101:5050 + +## Running Hadoop HDFS + +The Ansible provisioning must have Apache HDFS already running in the platform. +For checking we can do the following: + +- At mesos-m1 master: + +``` +[vagrant@mesos-m1 ~]$ su - hdfs +Password: (vagrant is the password) +[hdfs@mesos-m1 ~]$ jps +21249 NameNode +16374 Jps +21448 SecondaryNameNode +[hdfs@mesos-m1 hadoop]$ cd /opt/hadoop +[hdfs@mesos-m1 hadoop]$ bin/hdfs dfsadmin -printTopology +Rack: /default-rack + 100.0.10.103:50010 (mesos-a2) + 100.0.10.104:50010 (mesos-a3) + 100.0.10.105:50010 (mesos-a4) +[hdfs@mesos-m1 hadoop]$ bin/hdfs dfsadmin -report +[...] +``` + +The NN web interface can be accessed via the URL: + +http://100.0.10.101:50070/ + +*Note*: Hadoop HDFS is running in mesos-a2, mesos-a3 and mesos-a4. +The Mesos agent mesos-a1 is dedicated for running Mesos tasks not related +with Hadoop. + +*Note*: You can stop or start HDFS manually from master node with: + +``` +[hdfs@mesos-m1 hadoop]$ cd /opt/hadoop +[hdfs@mesos-m1 hadoop]$ sbin/stop-dfs.sh +[hdfs@mesos-m1 hadoop]$ sbin/stop-dfs.sh +``` + + +## Running Hadoop YARN Resource Manager (RM) with Myriad + +- At mesos-m1: + +``` +cd /opt + +# Copy the Myriad Scheduler +cp -vf myriad/myriad-scheduler/build/libs/* hadoop/share/hadoop/yarn/lib/ + +# Copy the Myriad Executor +cp -vf myriad/myriad-executor/build/libs/myriad-executor-0.2.0.jar hadoop/share/hadoop/yarn/lib/ + +# Hadoop 2.7.x: +$ su - yarn +Password: (vagrant is the password) +[yarn@mesos-m1 ~]$ cd /opt/hadoop/ +[yarn@mesos-m1 hadoop]$ sbin/yarn-daemon.sh --config /opt/hadoop/etc/hadoop/ start resourcemanager +[yarn@mesos-m1 hadoop]$ jps +19283 ResourceManager +19519 Jps +``` + +The YARN web interface can be accessed via the URL: + +http://100.0.10.101:8088 + +The Myriad web interface can be accessd via the URL: + +http://100.0.10.101:8192 + +# Happy Hacking + +At this point you have a local development environment ready for Myriad +Framework hacking! + + + + + + + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/Vagrantfile ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/Vagrantfile b/vagrant/mesos/libvirt/mesos/Vagrantfile new file mode 100644 index 0000000..c5cc2af --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/Vagrantfile @@ -0,0 +1,92 @@ +# -*- mode: ruby -*- +# vim: set ft=ruby ts=2 et : + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +VAGRANTFILE_API_VERSION = "2" + +# Tested with Vagrant version: +Vagrant.require_version ">= 1.7.2" + +# Require YAML module +require 'yaml' + +def fail_with_message(msg) + fail Vagrant::Errors::VagrantError.new, msg +end + +def check_minimal_env() + if ENV['MESOS_ARCH'].nil? || ENV['MESOS_ARCH'].empty? + fail_with_message "You have to set MESOS_ARCH environment variable!" + end + if ENV['HADOOP_VERSION'].nil? || ENV['HADOOP_VERSION'].empty? + fail_with_message "You have to set HADOOP_VERSION environment variable!" + end + if ENV['ZOOKEEPER_VERSION'].nil? || ENV['ZOOKEEPER_VERSION'].empty? + fail_with_message "You have to set ZOOKEEPER environment variable!" + end +end + +# Sanity checks +check_minimal_env() + +# Read YAML file with cluster details: The cluster flavor. +config_file = 'config/cluster-' + ENV['MESOS_ARCH'] + ".yaml" +if File.exists?(config_file) + cluster = YAML.load_file(config_file) +else + fail_with_message "Cluster definition file: #{config_file} was not found!" +end + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # Disabling the default /vagrant share + config.vm.synced_folder ".", "/vagrant", disabled: true + config.ssh.insert_key = false + + i = 0 + cluster.each do |servers| + # VM definition + config.vm.define servers["name"] do |node| + node.vm.box = servers["box"] + node.vm.hostname = servers["name"] + node.vm.network "private_network", ip: servers["ip"] + node.vm.provider :libvirt do |domain| + domain.uri = 'qemu+unix:///system' + domain.driver = 'kvm' + domain.memory = servers["mem"] + domain.cpus = servers['cpu'] + if servers.key?('aditional_disk') + for disk in servers['aditional_disk'] + domain.storage :file, :size => disk + end + end + end + i += 1 + if i == cluster.length + node.vm.provision :ansible do |ansible| + ansible.verbose = "vv" + ansible.inventory_path = "provisioning/inventory.py" + ansible.playbook = "provisioning/site.yml" + ansible.limit = "all" + end # provison + end # if + end # config + end # cluster +end # vagrant http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/ansible.cfg ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/ansible.cfg b/vagrant/mesos/libvirt/mesos/ansible.cfg new file mode 100644 index 0000000..acbdc2e --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/ansible.cfg @@ -0,0 +1,79 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +[defaults] +# Disable host key checking. If a host is not initially in âknown_hostsâ this +# will result in prompting for confirmation of the key, which results in an +# interactive experience +host_key_checking = False + +# This is the default SSH timeout to use on connection attempts. +timeout = 30 + +# This options forces color mode even when running without a TTY. +force_color = 1 + +# Number of parallel processes to spawn when +# communicating with remote hosts. +forks = 10 + +# Facts gathering: The value âsmartâ means each new +# host that has no facts discovered will be scanned, +# but if the same host is addressed in multiple plays +# it will not be contacted again in the playbook run. +# This enhance fact gathering time. +gathering = smart + +# Ansible will log information about executions at the designated location +log_path=.vagrant/ansible.log + +# The retry files save path is where Ansible will save .retry files when a +# playbook fails. The directory will be created if it does not already exist. +retry_files_save_path = .vagrant/retry-files + +# +# Play execution strategies explained: +# +# Plays execution control for many hosts, controls how plays run their multiple +# hosts: +# +# linear (default): All hosts of a play have to finish one task before any of them can +# begin the next one. Using the number of forks (default 5) +# to parallelize. +# serial: Ensures one group of hosts in a play finishes its work before another group +# can begin. This strategy will take a subset of hosts (the default is +# five) and execute all tasks (in the linear fashion) against those +# hosts before moving to the next subset and starting from the beginning. +# free: Allows each host to run until the end of the play as fast as it can. +# Allows all hosts to run independently of each other. âfreeâ lets each +# host run independently, starting its next task as soon as it finishes +# the previous one, regardless of how far other hosts have gotten. +# +# By default Ansible will attempt to run on all hosts from a play in parallel. +# +# With the serial strategy ansible will attempt to run on by defauult 5 of the play. +# It is designed so that each task will be run on all hosts before continuing on +# to the next task. So if you have 3 tasks it will ensure task 1 runs on all +# your hosts first, then task 2 is run, then task 3 is run. This is the "linear" strategy. +# +# Each play contains a list of tasks. Tasks are executed in order, one at a +# time, against all machines matched by the host pattern of the play, before moving on to +# the next task. It is important to understand that, within a play, all hosts +# are going to get the same task directives. It is the purpose of a play to map +# a selection of hosts to tasks. + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/check-env.sh ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/check-env.sh b/vagrant/mesos/libvirt/mesos/check-env.sh new file mode 100644 index 0000000..c51ae75 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/check-env.sh @@ -0,0 +1,28 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +echo +echo "This Vagrant environment is ready for the following settings:" +echo + +[ -z $MESOS_ARCH ] || echo "- MESOS_ARCH: $MESOS_ARCH" +[ -z $HADOOP_VERSION ] || echo "- HADOOP_VERSION: $HADOOP_VERSION" +[ -z $ZOOKEEPER_VERSION ] || echo "- ZOOKEEPER_VERSION: $ZOOKEEPER_VERSION" + +echo +echo "'vagrant up --provider=libvirt' and happy hacking!" http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/config/cluster-1m4a.yaml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/config/cluster-1m4a.yaml b/vagrant/mesos/libvirt/mesos/config/cluster-1m4a.yaml new file mode 100644 index 0000000..3164e9f --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/config/cluster-1m4a.yaml @@ -0,0 +1,64 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +- name: build + type: build + box: centos/7 + ip: 100.0.10.100 + mem: 4096 + cpu: 2 +- name: mesos-m1 + type: master + box: centos/7 + ip: 100.0.10.101 + mem: 2048 + cpu: 2 +- name: mesos-a1 + type: agent + box: centos/7 + ip: 100.0.10.102 + mem: 2048 + cpu: 2 +- name: mesos-a2 + type: agent + box: centos/7 + ip: 100.0.10.103 + mem: 2048 + cpu: 2 + aditional_disk: + - 50G + - 50G +- name: mesos-a3 + type: agent + box: centos/7 + mem: 2048 + ip: 100.0.10.104 + aditional_disk: + - 50G + - 50G + cpu: 2 +- name: mesos-a4 + type: agent + box: centos/7 + mem: 2048 + ip: 100.0.10.105 + aditional_disk: + - 50G + - 50G + cpu: 2 http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/config/cluster-3m4a.yaml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/config/cluster-3m4a.yaml b/vagrant/mesos/libvirt/mesos/config/cluster-3m4a.yaml new file mode 100644 index 0000000..cb51758 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/config/cluster-3m4a.yaml @@ -0,0 +1,76 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +- name: build + type: build + box: centos/7 + ip: 100.0.10.100 + mem: 2048 + cpu: 2 +- name: mesos-m1 + type: master + box: centos/7 + ip: 100.0.10.101 + mem: 2048 + cpu: 2 +- name: mesos-m2 + type: master + box: centos/7 + ip: 100.0.10.102 + mem: 2048 + cpu: 2 +- name: mesos-m3 + type: master + box: centos/7 + ip: 100.0.10.103 + mem: 2048 + cpu: 2 +- name: mesos-a1 + type: agent + box: centos/7 + ip: 100.0.10.104 + mem: 2048 + cpu: 2 +- name: mesos-a2 + type: agent + box: centos/7 + ip: 100.0.10.105 + mem: 2048 + cpu: 2 + aditional_disk: + - 50G + - 50G +- name: mesos-a3 + type: agent + box: centos/7 + ip: 100.0.10.106 + mem: 1024 + cpu: 2 + aditional_disk: + - 50G + - 50G +- name: mesos-a4 + type: agent + box: centos/7 + mem: 2048 + ip: 100.0.10.107 + aditional_disk: + - 50G + - 50G + cpu: 2 http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/docs/ansible.txt ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/docs/ansible.txt b/vagrant/mesos/libvirt/mesos/docs/ansible.txt new file mode 100644 index 0000000..d2c1d5b --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/docs/ansible.txt @@ -0,0 +1 @@ +ansible-playbook --private-key $HOME/.vagrant.d/insecure_private_key -i provisioning/inventory.py provisioning/site.yml --tags hadoop http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/docs/build-mesos.md ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/docs/build-mesos.md b/vagrant/mesos/libvirt/mesos/docs/build-mesos.md new file mode 100644 index 0000000..99981f4 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/docs/build-mesos.md @@ -0,0 +1,135 @@ +# Building Apache Mesos + +Note: Last tested Mesos version for Myriad -> 0.28.1 + +Notes about build Apache Mesos and some development hacking notes. + +# Building with autotools system + +``` +# Change working directory. +$ cd mesos + +# Bootstrap (Only required if building from git repository). +$ ./bootstrap + +# Configure and build. +$ mkdir build +$ cd build +$ ../configure +$ make + +# Run test suite. +$ make check + +# Install (Optional). +$ make install +``` + +# Building with new CMake system + +``` +curl -O https://cmake.org/files/v3.9/cmake-3.9.4-Linux-x86_64.tar.gz +tar xvzf cmake-3.9.4-Linux-x86_64.tar.gz +export PATH=$PATH:$HOME/cmake-3.9.4-Linux-x86_64/bin + +cd mesos +mkdir build && cd build +cmake .. +cmake --build . + + +For cleaning generated build system files: + +rm build/CMakeCache.txt +``` + +# Running Apache Mesos + +## Master + +``` +cd /home/vagrant/mesos.git/build +sudo ./bin/mesos-master.sh --ip=100.0.10.101 --work_dir=/var/lib/mesos +``` + +## Agents + +``` +cd /home/vagrant/mesos.git/build +sudo ./bin/mesos-agent.sh --master=100.0.10.101:5050 --work_dir=/var/lib/mesos +``` + +## Running with 3rdparty shipped Zookeeper + +At master: + +``` +cd /home/vagrant/mesos.git/build/3rdparty/zookeeper-3.4.8 +cp conf/zoo_sample.cfg conf/zoo.cfg +echo "server.1=mesos-m1:2888:3888" >> conf/zoo.cfg +bin/zkServer.sh start +echo ruok | nc 127.0.0.1 2181 + +sudo ./bin/mesos-master.sh --ip=100.0.10.101 --work_dir=/var/lib/mesos --zk=zk://mesos-m1:2181/mesos --quorum=1 +``` + +At agents: + +``` +sudo ./bin/mesos-agent.sh --master=zk://mesos-m1:2181/mesos --work_dir=/var/lib/mesos +``` + +# Debugging + +``` +gdbserver -> exec ${LIBTOOL} --mode=execute gdbserver 100.0.10.101:1234 \ + /home/vagrant/mesos.git/build/src/mesos-master "${@}" + + +(gdb) target remote mesos-m1:1234 +(gdb) continue +(gdb) monitor exit +``` + +# Development Environment with Vim + + +## Building clang-format + +``` +svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm +cd llvm/tools +svn co http://llvm.org/svn/llvm-project/cfe/trunk clang +cd ../.. +mkdir build +cd build +cmake -G "Unix Makefiles" ../llvm +``` + +## Code navigation: cscope and tags + +``` +sudo yum install cscope ctags -y + +cd build +make cscope +make ctags +``` + +## Vimrc with clang-format for C++11 and Google Style + +``` +cd +curl -O https://raw.githubusercontent.com/javiroman/reproducible-research/master/vim-tmux/vimrc +mv vimrc .vimrc +mkdir -p .vim/bundle +git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim +vim +:PluginInstall +or from command line: vim +PluginInstall +qall +``` + + + + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/docs/notes-myriad.txt ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/docs/notes-myriad.txt b/vagrant/mesos/libvirt/mesos/docs/notes-myriad.txt new file mode 100644 index 0000000..1dd51d5 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/docs/notes-myriad.txt @@ -0,0 +1,11 @@ +# Copy the Myriad Scheduler +cp -vf myriad/myriad-scheduler/build/libs/* hadoop/share/hadoop/yarn/lib/ + +# Copy the Myriad Executor +cp -vf myriad/myriad-executor/build/libs/myriad-executor-0.2.0.jar hadoop/share/hadoop/yarn/lib/ + +# Copy the myriad-config-default.yml +cp myriad/myriad-scheduler/build/resources/main/myriad-config-default.yml hadoop/etc/hadoop/ + +#Hadoop 2.7.x: +#sbin/yarn-daemon.sh --config /opt/hadoop/etc/hadoop/ start resourcemanager http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/docs/steps-hadoop.txt ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/docs/steps-hadoop.txt b/vagrant/mesos/libvirt/mesos/docs/steps-hadoop.txt new file mode 100644 index 0000000..54e2c55 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/docs/steps-hadoop.txt @@ -0,0 +1,145 @@ +$ cat /etc/profile.d/java.sh +export JAVA_HOME=/usr/lib/jvm/java + +$ cat /opt/hadoop/etc/hadoop/workers +mesos-a2 +mesos-a3 +mesos-a4 + +- Set NameNode Location + +$ cat /opt/hadoop/etc/hadoop/core-site.xml +<configuration> + <property> + <name>fs.default.name</name> + <value>hdfs://mesos-m1:9000</value> + </property> +</configuration> + +- Set path for HDFS + +https://hortonworks.com/blog/hdfs-metadata-directories-explained/ + +NN: dfs.namenode.name.dir + +Determines where on the local filesystem the DFS name node should store the +name table(fsimage). If this is a comma-delimited list of directories +then the name table is replicated in all of the directories, for redundancy. + +DN: dfs.datanode.data.dir + +Although DataNodes do not contain metadata about the directories and files +stored in an HDFS cluster, they do contain a small amount of metadata about +the DataNode itself and its relationship to a cluster. + +- directories on the datanode's local filesystem that store HDFS blocks. +- dfs.datanode.data.dir: directory on your datanodes as the data directory. +dfs.datanode.data.dir=/volumes/disk1/hadoop/data/ + +$ cat /opt/hadoop/etc/hadoop/hdfs-site.xml + +<configuration> + <property> + <name>dfs.namenode.name.dir</name> + <value>/cluster/nn</value> + </property> + + <property> + <name>dfs.datanode.data.dir</name> + <value>/cluster/1/dn/data,/data/2/dn/data</value> + </property> + + <property> + <name>dfs.replication</name> + <value>3</value> + </property> +</configuration> + +- Set YARN as Job Scheduler +$ cat /opt/hadoop/etc/hadoop/mapred-site.xml +<configuration> + <property> + <name>mapreduce.framework.name</name> + <value>yarn</value> + </property> +</configuration> + +- Configure YARN +$ cat /opt/hadoop/etc/hadoop/yarn-site.xml +<configuration> + <property> + <name>yarn.acl.enable</name> + <value>0</value> + </property> + + <property> + <name>yarn.resourcemanager.hostname</name> + <value>mesos-m1</value> + </property> + + <property> + <name>yarn.nodemanager.aux-services</name> + <value>mapreduce_shuffle</value> + </property> +</configuration> + +- Duplicate Config Files on Each Node: NFS shared for this + +- HDFS needs to be formatted like any classical file system. On node-master, run the following command: + +- Permission, user and local folders: + +Master (NN): + +groupadd hadoop +useradd -g hadoop yarn +useradd -g hadoop hdfs +useradd -g hadoop mapred + +mkdir /opt/hadoop/logs +sudo chown -R hdfs:hadoop /opt/hadoop/logs + +sudo mkdir -p /cluster/nn/ +sudo chown -R hdfs:hadoop /cluster/nn/ + +- Format HDFS: + +For the HDFS NameNode to start, it needs to initialize the directory where it +will hold its data. + +sudo su - hdfs +cd /opt/hadoop +bin/hdfs namenode -format + +- Running HDFS cluster: + +sudo su - hdfs +sbin/start-dfs.sh + + +- Testing HDFS: + +sudo su - hdfs +bin/hdfs dfsadmin -printTopology +bin/hdfs dfsadmin -report + +- Running Yarn cluster: + +sudo su - yarn +sbin/start-yarn.sh + +- Testing Yarn: + +bin/yarn node -list +bin/yarn application -list + +For testing with Myriad we run only RM: + +sudo -E -u yarn bin/yarn --daemon start resourcemanager +sudo -E -u yarn jps + + + + + + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/group_vars/all/defaults.yml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/group_vars/all/defaults.yml b/vagrant/mesos/libvirt/mesos/provisioning/group_vars/all/defaults.yml new file mode 100644 index 0000000..a509c11 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/group_vars/all/defaults.yml @@ -0,0 +1,100 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +# Minimal CentOS system packages +system_packages: + - nc + - tar + - wget + - git + - docker-python + - epel-release + - vim + - tree + - ntp + - net-tools + - bind-utils + - xz + - unzip + - curl + - ipset + - nfs-utils + - gdb-gdbserver + - gcc-c++ + - sysstat + +# Dependencies for building Apache Mesos in CentOS +mesos_dependencies_packages: + - apache-maven + - python-devel + - python-six + - python-virtualenv + - java-1.8.0-openjdk-devel + - zlib-devel + - libcurl-devel + - openssl-devel + - cyrus-sasl-devel + - cyrus-sasl-md5 + - apr-devel + - subversion-devel + - apr-util-devel + - libevent + - libevent-devel + +system_epel_packages: + - pdsh + - sshpass + +# NFS enablement for sharing folders between nodes +nfs_packages: + - rpcbind + - nfs-server + - nfs-lock + - nfs-idmap +nfs_shared_folder: /opt + +# Source code location for Mesos and Myriad +mesos_cloned_folder: mesos +myriad_cloned_folder: myriad +mesos_repository: https://git-wip-us.apache.org/repos/asf/mesos.git +myriad_repository: https://github.com/myriad-framework/myriad +mesos_repo_branch: master +myriad_repo_branch: master + +# Zookeeper configrations +zookeeper_version: "{{ lookup('env','ZOOKEEPER_VERSION') }}" +zookeeper_binary_download_url: http://www-eu.apache.org/dist/zookeeper +zookeeper_binary_package: "{{ zookeeper_binary_download_url }}/zookeeper-{{ zookeeper_version }}/zookeeper-{{ zookeeper_version }}.tar.gz" + +# Hadoop configrations +hadoop_version: "{{ lookup('env','HADOOP_VERSION') }}" +hadoop_binary_download_url: https://archive.apache.org/dist/hadoop/common/ +hadoop_binary_package: "{{ hadoop_binary_download_url }}/hadoop-{{ hadoop_version }}/hadoop-{{ hadoop_version }}.tar.gz" + +# Hadoop folders +hadoop_data_root_folder: /cluster +hadoop_namenode_folder: "{{ hadoop_data_root_folder }}/nn" +hadoop_logs_folder: "{{ nfs_shared_folder }}/hadoop/logs" +hadoop_etc_folder: "{{ nfs_shared_folder }}/hadoop/etc/hadoop" + + + + + + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/inventory.py ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/inventory.py b/vagrant/mesos/libvirt/mesos/provisioning/inventory.py new file mode 100755 index 0000000..b794c95 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/inventory.py @@ -0,0 +1,219 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +import yaml +import os +import sys +import paramiko +import socket +import time +import logging + + +def get_cluster_config_file(): + '''Returns the file used as MESOS architecture''' + try: + ret = os.environ["MESOS_ARCH"] + except KeyError: + logging.debug( + "[Ansible] Please set environment variable MESOS_ARCH") + sys.exit(1) + + return "config/cluster-" + ret + ".yaml" + + +def get_cluster_config_yml(): + '''Returns a list with hostname and IP''' + with open(get_cluster_config_file(), 'r') as f: + ret = yaml.load(f) + + return ret + + +def check_ssh(ip, user, key_file, initial_wait=0, interval=0, retries=1): + logging.debug("[Ansible] checking SSH availability for %s", ip) + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + + time.sleep(initial_wait) + + for x in range(retries): + try: + ssh.connect(ip, username=user, key_filename=key_file) + return True + except (paramiko.BadHostKeyException, + paramiko.AuthenticationException, + paramiko.SSHException, + socket.error) as e: + logging.debug(e) + time.sleep(interval) + + return False + + +def check_ssh_available(cluster_yml): + ssh_key_path = os.environ["HOME"] + "/.vagrant.d/insecure_private_key" + + # check if the hosts are ssh accesibles + for item in cluster_yml: + if check_ssh(item.get('ip'), + "vagrant", + ssh_key_path, + 2, 2, 3): + logging.debug( + "[Ansible] %s: SSH is OK for provisioning", item) + else: + logging.debug("[Ansible] %s: SSH not ready", item) + return False + + return True + + +logging.basicConfig(filename='.vagrant/inventory.log', level=logging.DEBUG) + +all_vm_accesibles = False +logging.debug('[Ansible] getting host list from configuration') +cluster_yml = get_cluster_config_yml() + + +logging.debug("[Ansible] Sanity check loop for Ansible hosts") +while not all_vm_accesibles: + logging.debug("[Ansible] Waiting for SSH to become available in all hosts") + if check_ssh_available(cluster_yml): + all_vm_accesibles = True + + +class InventoryTemplate: + ''' + { + "all": { + "hosts": ["bt","a1","a2","p1","m1","m2","m3"], + "vars": { + "ansible_user": "vagrant", + "ansible_become": "true" + } + }, + "build-host": { + "hosts": ["build"] + }, + "mesos-masters": { + "hosts": ["master-m1","master-m3","master-m2"] + }, + "mesos-agents": { + "hosts": ["agent-a1","agent-a2"] + }, + "_meta": { + "hostvars": { + "build": {"ansible_host": "192.168.121.56"}, + "master-a1": {"ansible_host": "192.168.121.30"}, + "master-a2": {"ansible_host": "192.168.121.248"}, + "master-a3": {"ansible_host": "192.168.121.112"}, + "agent-a1": {"ansible_host": "192.168.121.80"}, + "agent-a2": {"ansible_host": "192.168.121.105"}, + "agent-a3": {"ansible_host": "192.168.121.150"} + } + } + } + ''' + + _template = """ + { + "all": { + "hosts": [%(_get_all|_pattern_a)s], + "vars": { + "ansible_user": "vagrant", + "ansible_become": "true" + } + }, + "build-host": { + "hosts": ["build"] + }, + "mesos-masters": { + "hosts": [%(_get_masters|_pattern_a)s] + }, + "mesos-agents": { + "hosts": [%(_get_agents|_pattern_a)s] + }, + "_meta": { + "hostvars": { + %(_get_all_hostip|_pattern_b)s + } + } + } + """ + + def __init__(self, dict={}): + self.dict = dict + + def __str__(self): + return self._template % self + + def __getitem__(self, key): + return self._process(key.split("|")) + + def _process(self, l): + arg = l[0] + if len(l) == 1: + if arg in self.dict: + return self.dict[arg] + elif hasattr(self, arg) and callable(getattr(self, arg)): + return getattr(self, arg)() + else: + raise KeyError(arg) + else: + func = l[1] + return getattr(self, func)(self._process([arg])) + + def _get_all(self): + cad = [] + for i in cluster_yml: + cad.append(i.get('name')) + return cad + + def _get_masters(self): + cad = [] + for i in cluster_yml: + if i.get('type') == 'master': + cad.append(i.get('name')) + return cad + + def _get_agents(iself): + cad = [] + for i in cluster_yml: + if i.get('type') == 'agent': + cad.append(i.get('name')) + return cad + + def _get_all_hostip(self): + cad = [] + for i in cluster_yml: + cad.append("\"%s\": {\"ansible_host\": \"%s\"}" % (i.get('name'), + i.get('ip'))) + return cad + + def _pattern_a(self, l): + return ",".join(["\"%s\"" % x for x in l]) + + def _pattern_b(self, l): + return ",".join(["%s" % x for x in l]) + + +print InventoryTemplate() http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/common/handlers/main.yml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/common/handlers/main.yml b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/handlers/main.yml new file mode 100644 index 0000000..1768796 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/handlers/main.yml @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +- name: Restart ntp + service: name=ntpd state=restarted http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/common/tasks/main.yml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/common/tasks/main.yml b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/tasks/main.yml new file mode 100644 index 0000000..b174b46 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/tasks/main.yml @@ -0,0 +1,104 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +- name: Sanity checking Ansible version + run_once: true + delegate_to: localhost + assert: + that: + - ansible_version.full|version_compare('2.2.0.0', '>') + msg: "Please install at least ansible 2.2.x.x in your host" + +- name: Fetch the Apache Maven repo file + yum_repository: + name: epel-apache-maven + description: EPEL Apache Maven Repository + baseurl: http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-$releasever/$basearch/ + gpgcheck: no + +- name: Install CentOS prerequisites + yum: name={{ item }} state=latest + with_items: + - "{{ system_packages }}" + - "{{ mesos_dependencies_packages }}" + +- name: Install CentOS EPEL prerequisites + yum: name={{ item }} state=latest + with_items: + - "{{ system_epel_packages }}" + +- name: Disabling SELinux (anti-pattern) + selinux: + policy: targeted + state: permissive + +- name: Effective disabling of SELinux (avoiting reboot) + command: /usr/sbin/setenforce 0 + +- name: Stopping Firewall rules (anti-pattner) + service: name=firewalld state=stopped enabled=no + +- name: Effective disabling of iptables rules + command: /usr/sbin/iptables -F + +- name: Disabling Chronyd NTP server + service: name=chronyd state=stopped enabled=no + +- name: Passwordless pre-step PasswordAuthentication enabling + lineinfile: + dest: /etc/ssh/sshd_config + backup: yes + regexp: '^PasswordAuthentication' + line: 'PasswordAuthentication yes' + +- name: Restarting SSH daemon + service: name=sshd state=restarted + +- name: Configure /etc/host files + template: src=hosts.j2 dest=/etc/hosts + +- name: Configure ntp servers + template: src=ntp.conf.j2 dest=/etc/ntp.conf + notify: Restart ntp + +- name: Enabled ntpd service + service: name=ntpd enabled=yes + +# 'Mesos > 0.21.0' requires 'subversion > 1.8' devel package, +# which is not available in the default repositories. +# Create a WANdisco SVN repo file to install the correct version +- name: WANdisco SVN repo + blockinfile: + dest: /etc/yum.repos.d/wandisco-svn.repo + backup: yes + create: yes + block: | + [WANdiscoSVN] + name=WANdisco SVN Repo 1.9 + enabled=1 + baseurl=http://opensource.wandisco.com/centos/7/svn-1.9/RPMS/\$basearch/ + gpgcheck=1 + gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco + +- name: Enable NFS in all nodes + service: name={{ item }} state=started + with_items: + - "{{ nfs_packages }}" + + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/hostname-fix.j2 ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/hostname-fix.j2 b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/hostname-fix.j2 new file mode 100644 index 0000000..6a39a55 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/hostname-fix.j2 @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +if ! grep -e "^127\.0\.1\.1.*`hostname`.*" /etc/hosts > /dev/null ; then + echo "127.0.1.1 `hostname`" >> /etc/hosts +fi http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/hosts.j2 ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/hosts.j2 b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/hosts.j2 new file mode 100644 index 0000000..100be34 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/hosts.j2 @@ -0,0 +1,26 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# {{ ansible_managed }} +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 + +{% for item in play_hosts %} +{% set short_name = item.split('.') %} +{{ hostvars[item]['ansible_host'] }} {{ item }} +{% endfor %} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/ntp.conf.j2 ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/ntp.conf.j2 b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/ntp.conf.j2 new file mode 100644 index 0000000..d88de96 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/templates/ntp.conf.j2 @@ -0,0 +1,24 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +driftfile /var/lib/ntp/ntp.drift + +server 0.pool.ntp.org +server 1.pool.ntp.org +server 2.pool.ntp.org +server 3.pool.ntp.org http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/common/vars/main.yml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/common/vars/main.yml b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/vars/main.yml new file mode 100644 index 0000000..cd21505 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/common/vars/main.yml @@ -0,0 +1,2 @@ +--- + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/handlers/main.yml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/handlers/main.yml b/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/handlers/main.yml new file mode 100644 index 0000000..7210200 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/handlers/main.yml @@ -0,0 +1,29 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# +# This tasks can spend a lot of time, you have +# to take this into account. +# +- name: Restart NFS Server + service: name=nfs-server state=restarted + + + + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/tasks/main.yml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/tasks/main.yml b/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/tasks/main.yml new file mode 100644 index 0000000..67bfc8e --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/tasks/main.yml @@ -0,0 +1,70 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +- name: Install the 'Development tools' package group + yum: + name: "@Development tools" + state: present + +- name: Setup shared folder permissions + file: + path: "{{ nfs_shared_folder }}" + state: directory + owner: vagrant + group: vagrant + mode: 0755 + +- name: Checkout Apache Mesos repo + become_user: vagrant + git: + repo: "{{ mesos_repository }}" + dest: "{{ nfs_shared_folder }}/{{ mesos_cloned_folder }}" + version: "{{ mesos_repo_branch }}" + update: no + +- name: Checkout Apache Myriad repo + become_user: vagrant + git: + repo: "{{ myriad_repository }}" + dest: "{{ nfs_shared_folder }}/{{ myriad_cloned_folder }}" + version: "{{ myriad_repo_branch }}" + update: no + +- name: Copy exports file. + template: + src: exports.j2 + dest: /etc/exports + owner: root + group: root + mode: 0644 + notify: Restart NFS Server + +- name: Start rpcbind + service: name=rpcbind state=started enabled=yes + +- name: Start NFS Server + service: name=nfs-server state=started enabled=yes + +- name: Start nfs-lock + service: name=nfs-lock state=started enabled=yes + +- name: Start nfs-idmap + service: name=nfs-idmap state=started enabled=yes + +- meta: flush_handlers http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/templates/exports.j2 ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/templates/exports.j2 b/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/templates/exports.j2 new file mode 100644 index 0000000..aa2b5dd --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/devel/templates/exports.j2 @@ -0,0 +1,34 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# /etc/exports: the access control list for filesystems which may be exported +# to NFS clients. See exports(5). +# +# Example for NFSv2 and NFSv3: +# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) +# +# Example for NFSv4: +# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check) +# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check) +# +{# % for item in play_hosts %} +{{ nfs_shared_folder}} {{ hostvars[item]['ansible_host'] }}(rw,sync,no_root_squash) +{% endfor % #} + +{{ nfs_shared_folder }} *(rw,sync,no_root_squash) http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/dfs-start/tasks/main.yml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/dfs-start/tasks/main.yml b/vagrant/mesos/libvirt/mesos/provisioning/roles/dfs-start/tasks/main.yml new file mode 100644 index 0000000..066cfd6 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/dfs-start/tasks/main.yml @@ -0,0 +1,39 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +- name: Format Hadoop filesystem + shell : "source /etc/profile.d/java.sh && {{ nfs_shared_folder }}/hadoop/bin/hdfs namenode -format && touch .skipformat" + become: yes + become_user: hdfs + args: + creates: .skipformat + run_once: yes + tags: hadoop + +- name: Start DFS cluster + shell : "source /etc/profile.d/java.sh && {{ nfs_shared_folder }}/hadoop/sbin/start-dfs.sh && touch .skipstartdfs" + become: yes + become_user: hdfs + args: + creates: .skipstartdfs + run_once: yes + tags: hadoop + + + http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/docker/tasks/main.yml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/docker/tasks/main.yml b/vagrant/mesos/libvirt/mesos/provisioning/roles/docker/tasks/main.yml new file mode 100644 index 0000000..e81f7d7 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/docker/tasks/main.yml @@ -0,0 +1,63 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +- name: Setup OverlayFS storage driver automatic loading + lineinfile: + dest: /etc/modules-load.d/overlay.conf + create: yes + state: present + line: overlay + +- name: Load overlay kernel module (avoiting reboot) + modprobe: name=overlay state=present + +- name: Setup offial Docker repository + blockinfile: + dest: /etc/yum.repos.d/docker.repo + backup: yes + create: yes + block: | + [dockerrepo] + name=Docker Repository + baseurl=https://yum.dockerproject.org/repo/main/centos/7/ + enabled=1 + gpgcheck=1 + gpgkey=https://yum.dockerproject.org/gpg + +- name: Configure systemd to run the Docker Daemon with OverlayFS (folder) + file: path=/etc/systemd/system/docker.service.d state=directory + +- name: Configure systemd to run the Docker Daemon with OverlayFS (control file) + blockinfile: + dest: /etc/systemd/system/docker.service.d/override.conf + backup: yes + create: yes + block: | + [Service] + ExecStart= + ExecStart=/usr/bin/docker daemon --storage-driver=overlay -H fd:// + +- name: Installing Docker 1.11.12 version + yum: name=docker-engine-1.11.2 state=installed + +- name: Starting Docker daemon + service: name=docker state=started + +- name: Enabling Docker daemon + service: name=docker enabled=yes http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/core-site.xml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/core-site.xml b/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/core-site.xml new file mode 100644 index 0000000..6685a83 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/core-site.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. See accompanying LICENSE file. +--> + +<!-- Put site-specific property overrides in this file. --> +<configuration> + <property> + <name>fs.default.name</name> + <value>hdfs://mesos-m1:9000</value> + </property> +</configuration> http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/hdfs-site.xml ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/hdfs-site.xml b/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/hdfs-site.xml new file mode 100644 index 0000000..aaa8f64 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/hdfs-site.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. See accompanying LICENSE file. +--> + +<!-- Put site-specific property overrides in this file. --> + +<configuration> + <property> + <name>dfs.namenode.name.dir</name> + <value>/cluster/nn</value> + </property> + + <property> + <name>dfs.datanode.data.dir</name> + <value>/cluster/1/dn,/cluster/2/dn</value> + </property> + + <property> + <name>dfs.replication</name> + <value>3</value> + </property> +</configuration> http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/2ce260e0/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/java.sh ---------------------------------------------------------------------- diff --git a/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/java.sh b/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/java.sh new file mode 100644 index 0000000..b2fca19 --- /dev/null +++ b/vagrant/mesos/libvirt/mesos/provisioning/roles/hadoop/files/java.sh @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +export JAVA_HOME=/usr/lib/jvm/java +export MESOS_NATIVE_JAVA_LIBRARY=/opt/mesos/build/src/.libs/libmesos.so