Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1.  Change your current directory to ambari-vagrant:

    Code Block
    cd ambari-vagrant
    

    You will see subdirectories for different OS’s.

  2. cd into the OS subdirectory for the OS you wish to use. CentOS 6.4 is recommended, because it is quicker to launch than other OS's.
    The remainder of this Quick Start uses CentOS 6.4. To install and use another version or distribution of Linux, specify the other directory name in place of centos6.4

    Code Block
    cd centos6.4
    
  3. Copy the private key into your OS directory:

    Code Block
    cp ~/.vagrant.d/insecure_private_key .
    
  4. (Optional) If you have at least 16 GM GB of memory on your Mac, consider increasing the amount of memory allocated to the VMs. Edit the following line in Vagrantfile, increasing 3072 to 4096 or more:

    Code Block
    vb.customize ["modifyvm", :id, "--memory", 3072] # RAM allocated to each VM
    
  5. All VMs will have a directory called /vagrant inside the VM. This corresponds to the ambari-vagrant/<os> directory on your local computer. If you have any files to access from within the VM, you can place them in this shared directory.
  6. Start one or more VMs, using the ./up.sh command. Three seems to be a good number if you have 16GB of RAM, without taxing the system too much.

    Code Block
    ./up.sh <# of VMs to launch>
    

    For example, up.sh 3 on CentOS 6.4 starts 3 VMs. Associated hostnames will be c6401, c6402, and c6403.

    Additional notes:
    - With the default Vagrantfile (in each OS subdirectory) you can specify up to 10 VMs. (If your computer can handle it; you can even add more.)
    - VMs will have fully-qualified domain names (FQDN) with the format <os-code>[01-10].ambari.apache.org, where <os-code> is c59 (CentOS 5.9), c64 (CentOS 6.4), etc. For example, c5901.ambari.apache.org, c6401.ambari.apache.org, etc.
    - VMs will have IP addresses 192.168.<os-subnet>.1[01-10], where <os-subnet> is 59 for CentOS 5.9, 64 for CentOS 6.4, etc. For example, 192.168.59.101 for CentOS 5.9 node c5901192.168.64.101, for CentOS 6.4 node c6401, etc.
    - Note that up.sh 3 is equivalent to doing something like vagrant up c640{1..3}

  7. Check the status of your VMs:

    Code Block
    hw100:centos6.4 lkg$ vagrant status
    
    Current machine states:
    c6401                     running (virtualbox)
    c6402                     running (virtualbox)
    c6403                     running (virtualbox)
    c6404                     not created (virtualbox)
    c6405                     not created (virtualbox)
    c6406                     not created (virtualbox)
    c6407                     not created (virtualbox)
    c6408                     not created (virtualbox)
    c6409                     not created (virtualbox)
    c6410                     not created (virtualbox)

    (You can use the vagrant init command to initialize your current directory as a Vagrant environment, but this step should already be handled by the preceding steps.)

  8. Next, log into one of your VMs. For example:

    Code Block
    vagrant ssh c6401
    

    From this point onward, your this terminal window will operate within the VM until you exit the VM. All commands will go to the VM, not your Mac.
    Tip: Open a second terminal window for submitting commands on your Mac. This will be useful when accessing the Ambari Web UI.

  9. When When you first access the VM you will be logged in as user vagrant. Change to root user:

    Code Block
    sudo su -
    

Install Ambari

Prerequisites: The Before installing Ambari, the following software must be installed on your VM:

  • yum

  • rpm

  • scp

  • curl

  • wget

  • pdsh

 (how to check)

 

  1. On your VM (where the main ambari service should run?), download the Ambari repository. The following commands download Ambari version 2.2.1.0 and install ambari-server:

    OSCommands
    CentOS 6
    wget -O /etc/yum.repos.d/ambari.repo http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.2.1.0/ambari.repo
    yum install ambari-server -y
    CentOS 7wget -O /etc/yum.repos.d/ambari.repo http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.1.0/ambari.repo
    yum install ambari-server -y
    Ubuntu 12
    wget -O /etc/apt/sources.list.d/ambari.list http://public-repo-1.hortonworks.com/ambari/ubuntu12/2.x/updates/2.2.1.0/ambari.list
    apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD apt-get update apt-get install ambari-server -y
     Ubuntu 14wget -O /etc/apt/sources.list.d/ambari.list http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.2.1.0/ambari.list
    apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD
    apt-get update
    apt-get install ambari-server -y

    Note: to test a branch build or the trunk build, specify the repo URL for the branch or trunk version.

  2. Ambari offers many installation options (see Ambari User Guides), but to To install Ambari with default settings, run the following commands to set up and start ambari-server:

    Code Block
    ambari-server setup -s
    ambari-server start

...

  1. For

...

  1. more information about installation options, see Ambari User Guides.

  2. (Optional) For frontend developers only: see "Frontend Development

...

  1. " (later on this page) for extra setup instructions.

  2. Once Ambari Server is started,

...

  1. access the Ambari Web UI at http://<hostname>.ambari.apache.org:8080. For example:

    Code Block
    http://c6401.ambari.apache.org:8080

...

  1. The URL depends on the OS

...

  1. and the node where you installed Ambari
    Note: The Ambari Server can take some time to

...

  1. launch and be ready to accept connections. Keep

...

  1. trying the URL until you

...

  1. see the login page.

...

  1. Login using default username admin

...

  1. , password admin.

  2. Choose "Launch Install Wizard."

  3. Name your cluster.

  4. On the Install Options page,

...

  1. list the FQDNs of the VMs. For example:

    Code Block
    c6401.ambari.apache.org
    c6402.ambari.apache.org
    c6403.ambari.apache.org
    

    Alternatively,

...

  1. use a range expression:

    Code Block
    c64[01-03].ambari.apache.org
    

...

  1. Upload the insecure_private_key file that you

...

  1. created earlier.

  2. Specify non-root SSH user vagrant.

  3. Follow the onscreen instructions to install your cluster.

Install the HDP Stack

 

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

...

run 

Basic Vagrant Commands

CommandDescription
vagrant up <vm-name>

Starts a specific VM. (up.sh is a wrapper for this call.) You can use this command to start more VMs after you called up.sh.

Example: vagrant up c6406

Note: if you

...

do not specify the <vm-name> parameter, it will try to start

...

ten VMs.

vagrant destroy -f

...

\[<vm-name>]

Destroys all VMs launched from the current directory

...

, and deletes them from disk

...

.

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 hostStarts a SSH session to the host. For example: vagrant ssh c6401
vagrant statusShows which VMs are running

...

Modifying RAM for the VMs

Each VM is allocated 2GB of RAM. These can be changed by editing Vagrantfile. To change the RAM allocation, modify the following line:

...

, suspended, etc.
 

...

Taking Snapshots

Vagrant makes it easy to take snapshots of the entire cluster.
First, install the snapshot plugin:

...

Tip: After starting the VMs but before you do anything on the VMs, run "vagrant snapshot take init".  This way, you can go back to the initial state of the VMs by running "vagrant snapshot go init"; this only takes seconds (much faster than starting the VMs up from scratch by using up.sh or "vagrant up").  Another advantage of this is that you can always go back to the initial state without destroying other named snapshots that you created.

Misc

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. Note that Ambari currently works on RHEL 5/6, CentOS 5/6, Oracle Linux 5/6, SUSE 11, and SLES 11. Ubuntu support is work in progress.

...