Chapter 2. Starting a Cluster
The first step to set up a cluster with our AMIs is to
sign up for EC2. If you have never used EC2 before, we
strongly suggest reading Amazon's Getting Started Guide. It shouldn't take any longer than 10 minutes, and it makes the process in the following section much clearer. Rest assured, however, that we will still target this guide to users who are new to EC2.
Important
Remember that if you start EC2 nodes, Amazon will begin charging to your account! Simply running through these instructions should cost no more than a few dollars, as long as you terminate the cluster afterward.
2.1. Creating Security Groups
Before we launch the cluster itself, we will want to create security groups for it. These define firewall rules for the EC2 instances that make up the cluster. This is a one-time-only procedure: once you have created appropriate security groups, you should not have to recreate them when starting new clusters unless you would like to keep your groups separate.
First, we will create a security group for all cluster nodes:
Click on in the left-hand Navigation pane.
In the toolbar at the top, click Create Security Group. We will first create a group for all the machines in the cluster.
For Security Group Name, enter hadoop-cluster
, or anything else meaningful to you.
For Description, enter anything you choose.
Click Create.
Back in the Security Groups panel, your new group should be selected. In the lower pane, you should see a table where you can add individual security rules.
Leaving all other fields empty, enter the name of your security group (hadoop-cluster
) in the Source (IP or group) column of the row at the bottom of the table.
Click the Save button to the right.
Note
Due to an apparent bug in the AWS Management Console, you may have to click the Refresh button in the top right toolbar to see changes after you click Save.
Now you should see three entries: one each for ICMP, TCP, and UDP on all ports. This will allow all your cluster instances to communicate freely among themselves.
Next, we will create a security group for the master node only:
Click Create Security Group again.
For Security Group Name, enter hadoop-cluster-master
, or anything else meaningful to you.
For Description, enter anything you choose.
Click Create.
Back in the Security Groups panel, select your new security group and create the following four rules using the bottom pane:
The last two rules are for accessing the web interfaces for the Hadoop JobTracker and NameNode, respectively.
The
Source column specifies the hosts that are allowed to connect in
CIDR notation. The value given above allows access from the entire internet (only, of course, on these ports). If you happen to know the IP range of your school or intended users, enter it here instead for greater security.