Documentation > Deployment > Running on Amazon EC2

Note: These instructions are for manually setting up an H-Store cluster using NFS on Amazon EC2. See this page for instructions on how to automatically deploy H-Store on EC2 using its built-in deployment scripts.

The following instructions are how to setup a Ubuntu-based EC2 cluster to deploy H-Store, including how to use autofs to auto-mount the home directory through NFS on each node in the virtual cluster. This setup assumes that you will use the default ubuntu user for the Canonical-prepared EC2 images and that H-Store will be installed in /home/ubuntu/H-Store ($HSTORE_HOME).

  1. Create a new security group called hstore. Allow for incoming SSH on port 22 so that you can log into each instance.
  2. Launch a new EC2 Instance within the hstore security group. In this example, we will use the official Ubuntu 10.04 64-bit community image in the US-East region (ami-4a0df923).
  3. Log into the instance as the ubuntu user. We need first to update the package repository list in order to get Sun’s version of Java (this is needed by Google Protocol Buffers). Add the two following lines to /etc/apt/sources.list:
    deb http://archive.canonical.com/ubuntu lucid partner
    deb-src http://archive.canonical.com/ubuntu lucid partner
    

    Then install the required packages with the following command:

    sudo apt-get update
    sudo apt-get --yes install subversion gcc g++ sun-java6-jdk valgrind ant
  4. Check out the source for H-Store from Subversion. For this example, we will use the trunk:
    svn co https://database.cs.brown.edu/svn/hstore/trunk/ $HSTORE_HOME
    
  5. Copy your key pair file generated by Amazon into the $HOME/.ssh/ directory.
    cp hstore.pem ~/.ssh/ && chmod 0400  ~/.ssh/hstore.pem
  6. Change the global.sshoptions parameter in $HSTORE_HOME/properties/default.properties to be the following:

    global.sshoptions = -i /home/ubuntu/.ssh/hstore.pem
  7. Now build the project:
    cd $HSTORE_HOME && ant build
  8. You can test that the system is working properly on a single node using the following command:

    ant hstore-prepare hstore-benchmark -Dproject=tpcc
  9. Although not required, it is easier to run H-Store when using a networked file system. The following are instructions on how to create a NFS server using a micro instance of Ubuntu. We will export the directory $HSTORE_HOME and use autofs to automatically mount them on each machine in the virtual cluster.
    1. Create the instance:
      ec2-run-instances --region us-east-1 \
                        --group hstore \
                        -k hstore \
                        --instance-type t1.micro ami-4a0df923

      You can also set associate instance to an elastic IP address to ensure that the nodes can always connect to it even after it is restarted. Then add an entry to /etc/hosts that maps the hostname hstore-nfs to this IP address. This is the hostname we will use in the examples below.

    2. Log into server and execute the following commands as root to setup NFS. Note that these steps are based on the instructions found here.
      apt-get install nfs-kernel-server 
      echo "/home *(rw,async,no_subtree_check)" >> /etc/exports
      exportfs  -a
      service portmap start
      /etc/init.d/nfs-kernel-server start
      
    3. Enable all internal network traffic for the hstore security group.
    4. We now need to configure autofs on each of the client machines. You can do this step once, and then clone the instance. First, install the autofs package:
      apt-get install autofs
    5. If you are using the hostname alias hstore-nfs mentioned above, edit the /etc/hosts file and add in an entry at the end of the file. Replace the IP address shown below with the private IP address for the NFS head node instance. Do not use the Elastic IP address because it will not be able to go through the firewall.
      10.XXX.XXX.XXX cs227-nfs
    6. You can test that the configuration is working by using the mount command directly:
      mount -t nfs hstore-nfs:/home/ubuntu/H-Store /home/ubuntu/H-Store
    7. Now edit the /etc/auto.master file and add in the following line at the bottom of the file
      /home         /etc/auto.home
    8. Create a new file /etc/auto.home and add in the following information. Note that the directory needs to end with a ‘/‘ followed by a ‘&
      *    hstore-nfs:/home/&
    9. Lastly, start the autofs service
      /etc/init.d/autofs start
  10. Once NFS is installed on each of the nodes in the cluster and you have installed the source code in an NFS shared directory, you can create a cluster configuration file and update the benchmark catalog. H-Store will automatically log into each node and launch the HStoreSite service off of the directory.