Building Your First GigaSpaces-EC2 Application

  Search Here
Searching GigaSpaces XAP/EDG 6.5 Documentation

                                               

Summary: Creating, deploying and running GigaSpaces-based applications on the Amazon Elastic Compute Cloud (EC2).

This page is specific to:
GigaSpaces 6.5

This page is new in the latest version of GigaSpaces documentation.

  • This section assumes that you are familiar with the Amazon EC2 web services. If this is not the case, please visit the Amazon EC2 getting started guide.
  • Amazon EC2 is defined as a beta version, therefore the GigaSpaces-EC2 solution is also defined as beta.

Overview

GigaSpaces XAP, the scale-out application server, bridges the gap between on-demand hardware scalability and on-demand application scalability. GigaSpaces offers a pre-configured Amazon Machine Image (AMI) with GigaSpaces installation and scripts.  You write your application once, deploy to any number of GigaSpaces-AMI nodes and scale on-demand by launching additional instances. This page will guide you how to configure and run your GigaSpaces application in the Amazon EC2 environment.

new! Watch the following screencast to learn how to setup and run the GigaSpaces image (AMI) on Amazon's EC2.

Learn about our EC2 pricing policy.

Before you begin, you should first set up your environment.

Additional Resources

About GigaSpaces

For information about the GigaSpaces eXtreme Application Platform (XAP), refer to the following sections:

Amazon Resources

Environment Setup

For efficient work with Amazon EC2, it is recommended to pre-install and to configure the SSH tool, FTP tool, VNC client, and the ElasticFox plugin.

The following steps guide you through installation and configuration of the Amazon-EC2 Firefox plugin and other required tools on Windows-based machines.

Running GigaSpaces-EC2 Cluster in 2 Simple Steps Using Firefox Plugin

Before you begin, you should first set up your environment.

The following AMIs are publicly available on the Amazon developer connection website.

Manifest Description Instance Types
GS6.5_CLUSTER_MNG/GS6.5_CLUSTER_MNG.manifest.xml The cluster manager (GSM) Large, Extra Large, High-CPU Extra Large
GS6.5_CLUSTER_NODE/GS6.5_CLUSTER_NODE.manifest.xml The cluster node (GSC) Large, Extra Large, High-CPU Extra Large
GS6.5_CLUSTER_UI/GS6.5_CLUSTER_UI.manifest.xml The graphical management center Small, High-CPU Medium
GS6.5_Development/GS6.5_DEVELOPMENT.manifest.xml Development Small, High-CPU Medium

Running a GigaSpaces application on the EC2 cluster can be done very simply using the ElasticFox Firefox plugin:

  1. Start the GigaSpaces AMI cluster
  2. Write and deploy your application (Processing Unit) to the GigaSpaces-EC2 cluster

This solution can also be run using the EC2 CLI. To do this, see Running GigaSpaces-EC2 Cluster using the EC2 CLI .

1. Starting the GigaSpaces AMI Cluster

The GigaSpaces-EC2 cluster environment is assembled from two types of AMIs:

  • The cluster manager (GSM – Grid Service Manager)
  • The cluster container (GSC – Grid Service Container)

Your deployment should be assembled from any number of GSC AMIs and at least one GSM AMI.

For more details on GSCs and GSMs, refer to the Running Service Grid - GSC and GSM section.

As a first step, locate the GigaSpaces AMIs by typing GS6.5_ in the text field located in the top right corner of the Machine Images panel.



  1. Start your GSM AMIs
  2. Start your GSC AMIs

You need to log into the GSM AMI, but you don't need to log into the GSC AMI.

1. Starting the GSM AMI

  1. Launch the CLUSTER_MNG AMI (Instance Type=Large, Number of instances=1, KeyPair=your key).




  2. Shortly after, new instances with a pending state are displayed in the your instances panel. As soon as the state changes to running, you can log into your running AMI (you might need to press the Refresh button in the instances panel).
  3. In Your Instances Panel, choose the AMI and press the Open SSH Connection button (the green key button). You are then logged into the machine as root.

  4. After logging into the machine, GigaSpaces XAP evaluation license agreement is presented. Read it carefully and approve by typing Yes at the bottom of the agreement. Note that typing No halts the machine.



  5. After accepting the evaluation license agreement, The GSM process starts automatically.

In production environments, it is recommended that you use at least 2 GSM AMIs. To do this, see Start more than one GSM AMIs below.

2. Starting GSC AMIs

GigaSpaces enables running more than one cluster container in a given AMI instance.

To start your GSC AMIs:

  1. Choose the CLUSTER_NODE AMI.
  2. Obtain the GSM internal host name by right-clicking the running GSM instance and selecting Copy Private DNS Name to clipboard:



  3. Specify the number of AMIs in your cluster, by setting the Minimum Number of Instances and Maximum Number of Instances fields in the Launch new instance(s) window.
  4. In the User Data text field, specify: [the number of cluster containers per GSC AMI]#[The GSM internal hostname].
    # is a separator symbol between the number of GSCs and the GSM internal host name. Do not include any spaces before and after the separator.
  5. Shortly after, new instances with a pending state are displayed in the your instances panel.
  6. As soon as the state changes to running on all the new instances, you can verify that the cluster is up and running by using the GigaSpaces Management Center. To do this, see Using the GigaSpaces Management Center for EC2 below.



    Recommended number of GSCs (cluster containers):
  • For large AMI machines, 2 or 3 GSCs are recommended per instance.
  • For extra large AMI machines, up to 5 GSCs are recommended per instance.

    In case the cluster contains more than one GSM, the GSM's internal host names should be separated by a comma.

2. Writing and Deploying Your Application to the GigaSpaces-EC2 Cluster

Running your application on the EC2 cluster involves two steps:

  1. Develop and test you Processing Unit on your local machine. To learn how to do this, refer to the OpenSpaces Hello World Example.
  2. Copy the Processing Unit folder from your local machine to the /deploy directory of the GSM AMI.
    You can use Win SCP3 to FTP your Processing Unit to the GSM machine.



  3. After uploading your Processing Units to the deploy folder, use the GigaSpaces Management Center to deploy them.To do this, see Using the GigaSpaces Management Center for EC2 below.

You can also deploy the Processing Unit using GigaSpaces CLI pudeploy command after logging into the GSM AMI. For more details, refer to the pudeploy - GigaSpaces CLI section.

Using GigaSpaces Small AMI for development purposes

GigaSpaces small AMI contains the GigaSpaces XAP installation, without the automated clustering scripts.
This AMI supports the Small and High-CPU Medium Instances.

It is recommended to use this AMI for development purposes.

  1. Launch the DEVELOPMENT AMI (Instance Type=Small, Number of instances=1, KeyPair=your key).

  2. Shortly after, new instances with a pending state are displayed in the Your Instances Panel. As soon as the state changes to running, you can login to your running AMI (you might need to press the Refresh button in the instances panel).
  3. In Your Instances Panel, choose the AMI and press the Open SSH Connection button (the green key button). You are then logged into the machine as root.
  4. After logging into the machine, GigaSpaces XAP evaluation license agreement is presented. Read it carefully and approve by typing Yes at the bottom of the agreement. Note that typing No halts the machine.
  5. After accepting the evaluation license agreement, the machine is ready for use and you can start your development.

For more details on getting started with GigaSpaces, refer to the GigaSpaces Getting Quick Start Guide.

Terminate a running GigaSpaces-EC2 cluster

The GigaSpaces solution on EC2 is a "pay-per-use" model. Once you are done using the nodes in your cluster, you should terminate your instances. To do this, right-click the running instance in the Your Instances Panel, and choose Terminate.

Starting Multiple GSM AMIs

This section guides you through starting more than one GSM in your cluster (for redundancy). This section describes how to start the recommended number of GSMs (2 per cluster).

  1. Launch 2 instances of the GS_AMI_CLUSTER_MNG AMI (Instance Type=Large, Number of instances=2, KeyPair=your key.
  2. In the User Data text field, specify 2 (the number of GSMs per cluster).
  3. Extract the machines' external and internal host names, and log on (as root) to these two machines (using the external host name), by right-clicking the running instances. Keep this host name for later usage.
  4. Log onto the two running AMIs (SSH to the machines).
  5. Accept the license agreement by typing Yes at the bottom of the agreement. Be aware that typing No halts the machine.
  6. Run the gsm_start.sh script:
    ./gsm_start.sh
    
  7. This prompts the following input:
    • Number of cluster managers (GSM AMI) you wish to deploy, two are recommended.
    • The internal host names for each cluster manager.
  8. The GSM starts on each machine. Check the environment using the gs.sh script list command:
    ./[GIGASPACES_INSTALL_FOLDER]/bin/gs.sh
    gs> list
    

Using GigaSpaces Management Center for EC2

  1. Locate the GigaSpaces CLUSTER_UI AMI by typing GS6.5_ in the text field located in the top right corner of the Machine Images panel.
  2. Obtain the internal host name of the CLUSTER_MNG AMI by right-clicking the running AMI instance and selecting Copy Private DNS Name to clipboard.
  3. Launch the CLUSTER_UI AMI (Instance Type=Small, Number of instances=1, KeyPair=your key).
  4. In the User Data text field, specify the GSMs internal hostname.
  5. Shortly after, a new instance with pending state is displayed in the Your Instances Panel. Wait for the AMI state to change to running (you might need to press the Refresh button in the instances panel).
  6. Right-click the CLUSTER_UI AMI running instance and select SSH to public DNS name.
  7. Click Yes in the following dialog.
  8. An SSH Putty window opens, you are automatically logged in.
  9. After logging into the machine, GigaSpaces XAP evaluation license agreement is presented. Read it carefully and approve by typing Yes at the bottom of the agreement. Note that typing No halts the machine.
    After a few seconds, the VNC server is started.



  10. Right-click the top right corner of the Putty window and select Change Settings....
  11. Select Connection > SSH > Tunnels and enter the information provided in the SSH console output.



    • Click Add and Apply.
  12. Make sure a line is added to the Forward Ports window.
  13. Click Apply.

    Do not close the SSH window.

  14. Launch the VNC client from your desktop.
  15. In the Server dialog, type 'localhost:1', and click OK.
  16. Type the password presented in SSH console output (no user name is required).
  17. The GigaSpaces Management Center is started with the appropriate discovery settings.

For more details on the GigaSpaces Management Center, refer to the GigaSpaces Management Center section.


GigaSpaces 6.5 Documentation Contents (Current Page in Bold)

    Java

    C++

    .NET

    Middleware Capabilities

    Configuration and Management

Add GigaSpaces wiki search to your browser search engines!
(works on Firefox 2 and Internet Explorer 7)

Labels