You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Overview

This document shows how to quickly set up virtual machines on your local computer for testing Ambari
This utilizes VirtualBox and Vagrant so you will need to install both.

Setup

Install VirtualBox from: https://www.virtualbox.org/wiki/Downloads
Install Vagrant from: http://downloads.vagrantup.com

After you have installed VirtualBox and Vagrant on your computer, check out the “ambari-vagrant” repo on github:
$ git clone https://github.com/u39kun/ambari-vagrant.git

Edit your /etc/hosts on your computer so that you will be able to resolve hostnames for the VMs:
$ sudo cat ambari-vagrant/append-to-etc-hosts.txt >> /etc/hosts

Copy the private key to your home directory (or some place convenient for you) so that it’s easily accessible for uploading via Ambari Web:
$ vagrant
The above command shows the command usage and also creates the private key
$ cp ~/.vagrant.d/insecure_private_key ~

VM Operations

First, change directory to ambari-vagrant:
$ cd ambari-vagrant
You will see subdirectories for different OS’s. “cd” into the OS that you want to test.

$ ./up.sh <# of VMs to launch>
For example, ./up.sh 3 starts 3 VMs.
You can specify up to 10
VMs will have the FQDN <os-code>01-10.ambari.apache.org, where <os-code> is c59 (CentOS 5.9), c64 (CentOS 6.4), etc.
E.g., c5901.ambari.apache.org, c6401.ambari.apache.org, etc.
VMs will have the IP address 192.168.<os-subnet>.101-10, where <os-subnet> is 59 for CentOS 5.9, 64 for CentOS 6.4, etc.
E.g., 192.168.59.101, 192.168.64.101, etc.

$ vagrant up <vm name>
Starts a specific VM. up.sh is a wrapper for this call.
Note: if you don’t specify the <vm name> parameter, it will try to start 10 VMs
You can run this if you want to start more VMs after you already called up.sh
For example: vagrant up c6406

$ vagrant destroy -f
Destroys all VMs launched from the current directory (deletes them from disk as well)
You can optionally specify a specific VM to destroy

$ vagrant suspend
Suspends (snapshot) all VMs launched from the current directory so that you can resume them later
You can optionally specify a specific VM to suspend

$ vagrant resume
Resumes all suspended VMs launched from the current directory
You can optionally specify a specific VM to resume

$ vagrant ssh host
Starts a SSH session to the host. For example: vagrant ssh c6401

$ vagrant status
Shows which VMs are running, suspended, etc.

Modifying RAM for the VMs

Each VM is allocated 2GB of RAM. These can be chaged by editing Vagrantfile. To change the RAM allocation, modify the following line:
vb.customize id, "--memory", 2048

Testing Ambari

Logg into <os-code>01 (e.g., c6401).
$ vagrant ssh c6401

Note that this logs you in as user "vagrant". Once you are logged in, you can run:
$ sudo su -
to make yourself root. Ambari offers many installation options (see ), but to get up and running quickly with default settings, you can run the following:

  1. yum install
  2. yum install ambari-server -y
  3. ambari-server setup -s
  4. ambari-server start

Once Ambari Server is started, hit http://c6401.ambari.apache.org:8080 (URL depends on the OS being tested) on your browser from your local computer. Ambari Web should come up.

Note: To test SSH install of Ambari Agent, use the non-root SSH user vagrant, and upload insecure_private_key file that you copied earlier when prompted in the Install Wizard.

When done testing, run "vagrant destroy -f" to purge the VMs.

Advanced

All VMs launched will have a directory called /vagrant inside the VM. This maps to the ambari-vagrant/<os> directory on your local computer. You can use this shared directory mapping to push files, etc.

If you want to test OS’s other than what’s currently in the ambari-vagrant repo, please see http://www.vagrantbox.es/ for all the readily available OS images you can test.

  • No labels