Setting up Cluster on Amazon Web Services (AWS)

Amazon Web Services (AWS) is a comprehensive, evolving cloud computing platform that offers a suite of cloud-computing services. The services provided by this platform that is important for TIBCO ComputeDB are Amazon Elastic Compute Cloud (EC2) and Amazon Simple Storage Service (S3). You can set up TIBCO ComputeDB cluster on Amazon Web Services using one of the following options:

TIBCO ComputeDB EC2 Scripts

The TIBCO ComputeDB EC2 scripts enable you to launch and manage TIBCO ComputeDB clusters on Amazon EC2 instances quickly. They also allow you to provide custom configuration for the cluster via TIBCO ComputeDB configuration files, before launching the cluster.

The snappy-ec2 script is the entry point for these EC2 scripts and is derived from the spark-ec2 script available in Apache Spark 1.6.

The scripts are available on GitHub in the snappy-cloud-tools repository and also as a .tar.gz file on the release page file.

Note

The EC2 scripts are provided on an experimental basis. Feel free to try it out and provide your feedback as via GitHub issues.

This section covers the following: * Prerequisites * Deploying TIBCO ComputeDB Cluster with EC2 Scripts * Cluster Management * Known Limitations

Prerequisites

  • Ensure that you have an existing AWS account with required permissions to launch EC2 resources

  • Create an EC2 Key Pair in the region where you want to launch the TIBCO ComputeDB Cloud cluster
    Refer to the Amazon Web Services EC2 documentation for more information on generating your EC2 Key Pair.

  • Using the AWS Secret Access Key and the Access Key ID, set the two environment variables, AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID. You can find information about generating these keys in the AWS IAM console page.
    If you already have set up the AWS Command Line Interface on your local machine, the script automatically detects and uses the credentials from the AWS credentials file.

    For example:

    ```pre
    export AWS_SECRET_ACCESS_KEY=abcD12efGH34ijkL56mnoP78qrsT910uvwXYZ1112
    export AWS_ACCESS_KEY_ID=A1B2C3D4E5F6G7H8I9J10
    ```
    
  • Ensure Python v 2.7 or later is installed on your local computer.

Deploying TIBCO ComputeDB Cluster with EC2 Scripts

In the command prompt, go to the directory where the snappydata-ec2-<version>.tar.gz is extracted or to the aws/ec2 directory where the TIBCO ComputeDB cloud tools repository is cloned locally.

Syntax

./snappy-ec2 -k <your-key-name> -i <your-keyfile-path> <action> <your-cluster-name> [options]

Here:

  • <your-key-name> refers to the EC2 key pair.

  • <your-keyfile-path> refers to the path to the key file.

  • <action> refers to the action to be performed. Some of the available actions are launch, destroy, stop, start and reboot-cluster. Use launch action to create a new cluster while stop and start actions work on existing clusters.

By default, the script starts one instance of a locator, lead, and server each. The script identifies each cluster by its unique cluster name that you provide and internally ties the members (locators, leads, and stores/servers) of the cluster with EC2 security groups, whose names are derived from the cluster name.

When running the script, you can also specify options to configure the cluster such as the number of stores in the cluster and the region where the EC2 instances should be launched.

Example

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem --stores=2 --with-zeppelin --region=us-west-1 launch my-cluster

The above example launches a TIBCO ComputeDB cluster named my-cluster with two stores or servers. The locator is associated with a security group named my-cluster-locator, and the servers are associated with my-cluster-store security group.

The cluster is launched in the N. California (us-west-1) region on AWS and has an Apache Zeppelin server running on the instance where the lead is running.

The example assumes that you have the key file (my-ec2-key.pem) in your home directory for EC2 Key Pair named 'my-ec2-key'.

Assuming IAM Role in the AWS EC2 Scripts

An IAM user in AWS can gain additional (or different) permissions, or get permissions to perform actions in a different AWS account through EC2 scripts. You can configure the AWS EC2 scripts to use an IAM role by passing the following properties:

  • assume-role-arn: The Amazon Resource Name (ARN) of the IAM role to be assumed. This IAM role's credentials are used to launch the cluster. If you are using the switch role functionality, this property is mandatory.

  • assume-role-timeout: Timeout in seconds for the temporary credentials of the assumed IAM role, min is 900 seconds, and max is 3600 seconds.

  • assume-role-session-name: Name of this session in which IAM role is assumed by the user.

Example

./snappy-ec2 -k <your-key-name> -i <your-keyfile-path> stop snap_ec2_cluster --with-zeppelin --authorized-address=<Authorized IP Address> --assume-role-arn=<role-arn> --assume-role-timeout=<timeout> --assume-role-session-name=<name-for-session>

Note

By default, the cluster is launched in the N. Virginia (us-east-1) region on AWS. To launch the cluster in a specific region use option --region.

Cluster Management

This section covers the following:

Using Custom Build

This script by default, uses the TIBCO ComputeDB build available on the GitHub releases page to launch the cluster. To select a version of the OSS build available on GitHub, use option --snappydata-version.

You can also provide your own TIBCO ComputeDB build to the script to launch the cluster, by using option --snappydata-tarball to the launch command. The build can be present either on a local filesystem or as a resource on the web.

For example, to use TIBCO ComputeDB Enterprise build to launch the cluster, download the product tarball from https://edelivery.tibco.com to your local machine and give its path as value to the above option.

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem launch my-cluster --snappydata-tarball="/home/ec2-user/snappydata/distributions/TIB_compute_1.1.1_linux.tar.gz"

Alternatively, you can also put your build tarball file on a public web server and provide its URL to this option.

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem launch my-cluster --snappydata-tarball="https://s3-us-east-2.amazonaws.com/mybucket/distributions/TIB_compute_1.1.1_linux.tar.gz" 

The build file should be in .tar.gz format.

Specifying Properties

You can specify the configuration for the cluster via command-line options. Use --locator-conf to specify the configuration properties for all the locators in the cluster. Similarly, --server-conf and --lead-conf allows you to specify the configuration properties for servers and leads in the cluster, respectively.

Following is a sample configuration for all the three processes in a TIBCO ComputeDB cluster:

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem --stores=2 launch my-cluster \
  --locator-conf="-peer-discovery-port=9999 -heap-size=1024m" \
  --lead-conf="-spark.executor.cores=10 -heap-size=4096m -spark.ui.port=3333" \
  --server-conf="-client-port=1530"

The utility also reads snappy-env.sh, if present in the directory where helper scripts are present.

Note

  • The earlier method of specifying the configuration properties by placing the actual configuration files in the directory, where helper scripts are available, is discontinued.
  • Ensure that the configuration properties specified are correct. Otherwise, launching the TIBCO ComputeDB cluster may fail, but the EC2 instances would still be running.

Stopping the Cluster

When you stop a cluster, it shuts down the EC2 instances, and any data saved on the local instance stores is lost. However, the data saved on EBS volumes is retained, unless the spot-instances are used.

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem stop cluster-name

Resuming the Cluster

When you start a cluster, it uses the existing EC2 instances associated with the cluster name and launches TIBCO ComputeDB processes on them.

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem start cluster-name

Note

The start command, or launch command with --resume option, ignores the --locators, --leads, or --stores options and launches the TIBCO ComputeDB cluster on existing instances. However, if the configuration options are provided, they are read and processed, thus overriding their values that were provided when the cluster was launched or started previously.

Adding Servers to the Cluster

This is not yet supported using the script. You must manually launch an instance with (cluster-name)-stores group and then use launch command with the --resume option.

Listing Members of the Cluster

To get the first locator's hostname:

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem get-locator cluster-name

Use the get-lead command to get the first lead's hostname.

Connecting to the Cluster

You can connect to any instance of a cluster with SSH using the login command. It logs you into the first lead instance. You can then use SSH to connect to any other member of the cluster without a password.
The TIBCO ComputeDB product directory is located at /opt/snappydata/ on all the members.

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem login cluster-name

Destroying the Cluster

Destroying a cluster permanently destroys all the data on the local instance stores and on the attached EBS volumes.

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem destroy cluster-name

This also deletes the security groups created for this cluster.

Starting Cluster with Apache Zeppelin

Optionally, you can start an instance of the Apache Zeppelin server with the cluster. Apache Zeppelin provides a web-based interactive notebook that is pre-configured to communicate with the TIBCO ComputeDB cluster. The Zeppelin server is launched on the same EC2 instance where the lead node is running.

./snappy-ec2 -k my-ec2-key -i ~/my-ec2-key.pem --with-zeppelin launch cluster-name

More Options

For a complete list of options provided by the script, run ./snappy-ec2. The options are also provided in the following list for quick reference:

Usage: snappy-ec2 [options] <action> <cluster_name>

<action> can be: launch, destroy, login, stop, start, get-locator, get-lead, reboot-cluster

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -s STORES, --stores=STORES
                        Number of stores to launch (default: 1)
  --locators=LOCATORS   Number of locator nodes to launch (default: 1)
  --leads=LEADS         Number of lead nodes to launch (default: 1)
  -w WAIT, --wait=WAIT  DEPRECATED (no longer necessary) - Seconds to wait for
                        nodes to start
  -k KEY_PAIR, --key-pair=KEY_PAIR
                        Name of the key pair to use on instances
  -i IDENTITY_FILE, --identity-file=IDENTITY_FILE
                        SSH private key file to use for logging into instances
  -p PROFILE, --profile=PROFILE
                        If you have multiple profiles (AWS or boto config),
                        you can configure additional, named profiles by using
                        this option (default: none)
  -t INSTANCE_TYPE, --instance-type=INSTANCE_TYPE
                        Type of server and lead instance to launch (default:
                        m4.large). WARNING: must be 64-bit; small instances
                        won't work
  --locator-instance-type=LOCATOR_INSTANCE_TYPE
                        Locator instance type (default: t2.medium)
  -r REGION, --region=REGION
                        Name of the EC2 region where instances are launched (default: us-east-1).
  -z ZONE, --zone=ZONE  Availability zone to launch instances in, or 'all' to
                        spread stores across multiple (an additional $0.01/Gb
                        for bandwidthbetween zones applies) (default: a single
                        zone chosen at random)
  -a AMI, --ami=AMI     Amazon Machine Image ID to use
  --snappydata-tarball=SNAPPYDATA_TARBALL
                        HTTP URL or local file path of the TIBCO ComputeDB
                        distribution tarball with which the cluster will be
                        launched. (default: )
  --locator-conf=LOCATOR_CONF
                        Configuration properties for locators (default: )
  --server-conf=SERVER_CONF
                        Configuration properties for servers (default: )
  --lead-conf=LEAD_CONF
                        Configuration properties for leads (default: )
  -v SNAPPYDATA_VERSION, --snappydata-version=SNAPPYDATA_VERSION
                        Version of TIBCO ComputeDB to use: 'X.Y.Z' (default:
                        LATEST)
  --with-zeppelin       Launch Apache Zeppelin server with the cluster. It launches 
                        in the same instance where the lead node is running.
  --deploy-root-dir=DEPLOY_ROOT_DIR
                        A directory to copy into the root (/) directory on the first locator. 
                        Must be absolute. Note that a trailing slash is handled as
                        per rsync: If you omit it, the last directory of the
                        --deploy-root-dir path will be created in / before
                        copying its contents. If you append the trailing
                        slash, the directory is not created and its contents
                        are copied directly into /. (default: none).
  -D [ADDRESS:]PORT     Use SSH dynamic port forwarding to create a SOCKS
                        proxy at the given local address (for use with login)
  --resume              Resume installation on a previously launched cluster
                        (for debugging)
  --root-ebs-vol-size=SIZE
                        Size (in GB) of root EBS volume for servers and leads.
                        TIBCO ComputeDB is installed on root volume.
  --root-ebs-vol-size-locator=SIZE
                        Size (in GB) of root EBS volume for locators.
                        TIBCO ComputeDB is installed on root volume.
  --ebs-vol-size=SIZE   Size (in GB) of each additional EBS volume to be
                        attached.
  --ebs-vol-type=EBS_VOL_TYPE
                        EBS volume type (e.g. 'gp2', 'standard').
  --ebs-vol-num=EBS_VOL_NUM
                        Number of EBS volumes to attach to each node as
                        /vol[x]. The volumes will be deleted when the
                        instances terminate. Only possible on EBS-backed AMIs.
                        EBS volumes are only attached if --ebs-vol-size > 0.
                        Only support up to 8 EBS volumes.
  --placement-group=PLACEMENT_GROUP
                        Which placement group to try and launch instances
                        into. Assumes placement group is already created.
  --spot-price=PRICE    If specified, launch stores as spot instances with the
                        given maximum price (in dollars)
  -u USER, --user=USER  The SSH user you want to connect as (default:
                        ec2-user)
  --delete-groups       When destroying a cluster, delete the security groups
                        that were created
  --use-existing-locator
                        Launch fresh stores, but use an existing stopped
                        locator if possible
  --user-data=USER_DATA
                        Path to a user-data file (most AMIs interpret this as
                        an initialization script)
  --authorized-address=AUTHORIZED_ADDRESS
                        Address to authorize on created security groups
                        (default: 0.0.0.0/0)
  --additional-security-group=ADDITIONAL_SECURITY_GROUP
                        Additional security group to place the machines in
  --additional-tags=ADDITIONAL_TAGS
                        Additional tags to set on the machines; tags are
                        comma-separated, while name and value are colon
                        separated; ex: "Task:MySnappyProject,Env:production"
  --copy-aws-credentials
                        Add AWS credentials to hadoop configuration to allow
                        Snappy to access S3
  --subnet-id=SUBNET_ID
                        VPC subnet to launch instances in
  --vpc-id=VPC_ID       VPC to launch instances in
  --private-ips         Use private IPs for instances rather than public if
                        VPC/subnet requires that.
  --instance-initiated-shutdown-behavior=INSTANCE_INITIATED_SHUTDOWN_BEHAVIOR
                        Whether instances should terminate when shut down or
                        just stop
  --instance-profile-name=INSTANCE_PROFILE_NAME
                        IAM profile name to launch instances under.
  --assume-role-arn=The Amazon Resource Name (ARN) of the IAM role to be assumed. 
                        This IAM role's credentials are used to launch the cluster. 
                        If you are using the switch role functionality, this property is mandatory.
  --assume-role-timeout=Timeout in seconds for the temporary credentials of the 
                        assumed IAM role, min is 900 seconds and max is 
                        3600 seconds.
  --assume-role-session-name=Name of this session in which this IAM role is 
                             assumed by the user.                           

Known Limitations

  • Launching the cluster on custom AMI (specified via --ami option) does not work if the user ec2-user does not have sudo permissions.

  • Support for option --user is incomplete.

AWS Management Console

You can launch a TIBCO ComputeDB cluster on Amazon EC2 instance(s) using Linux-based AMIs available on AWS. For more information on launching an EC2 instance, refer to the AWS documentation. This section covers the following:

Attention

The AMIs of TIBCO ComputeDB are currently unavailable on AWS.

Prerequisites

  • Ensure that you have an existing AWS account with required permissions to launch the EC2 resources.
  • Create an EC2 Key Pair in the region where you want to launch the TIBCO ComputeDB cluster.

Deploying TIBCO ComputeDB Cluster with AWS Management Console

To launch the instance and start the TIBCO ComputeDB cluster on a single EC2 instance:

  1. Open the Amazon EC2 console and sign in using your AWS login credentials. The current region is displayed at the top of the screen.

  2. Select the region where you want to launch the instance.

  3. Click Launch Instance from the Amazon EC2 console dashboard.

  4. On the Choose an Amazon Machine Image (AMI) page, select your preferred Linux-based AMI. For example, you can select Amazon Linux 2 AMI or Ubuntu Server 16.04 LTS. See this page for recommended Operating Systems.

    Note

    The AMIs with pre-installed TIBCO ComputeDB distribution are currently unavailable under AWS Marketplace or Community AMIs.

  5. On the Choose an Instance Type page, select the instance type as per the requirement of your use case and then click Review and Launch to launch the instance with default configurations.

    Note

    • You can also continue customizing your instance before you launch the instance. Refer to the AWS documentation for more information.

    • On Configure Security Group page, ensure that you open at least ports 22 (for SSH access to the EC2 instance) and 5050 (to access TIBCO ComputeDB Monitoring Console) for the public IP address of your laptop or client terminal.

    • If you need to connect to the TIBCO ComputeDB cluster via a JDBC client application or tool, open ports 1527 and 1528 for the public IP of the host where your application/tool is running, in the security group.

  6. You are directed to the last step Review Instance Launch. Check the details of your instance, and click Launch.

  7. In the Select an existing key pair or create a new key pair dialog box, select your key pair.

  8. Click Launch. The Launch Status page is displayed.

  9. Click View Instances. The dashboard which lists the EC2 instances is displayed.

  10. Click Refresh to view the updated list and the status of the instance you just created.

  11. Once the status of the instance changes to running, connect to the instance via SSH. You require:

    • The private key (.pem) file of the key pair with which the instance was launched.
    • The public DNS or IP address of the instance.
    • The username that is used to connect. It depends on the AMI you have selected. For example, it could be ec2-user for Amazon Linux AMIs or ubuntu for Ubuntu-based AMIs.

    Refer to the following documentation for more information on accessing an EC2 instance.

    Note

    The public DNS/IP of the instance is available on the EC2 dashboard > Instances page. Select your EC2 instance and search for it in the lower part of the page.

  12. Download the required TIBCO ComputeDB distribution into this EC2 instance. You can find the latest Enterprise edition release here.

    Note

    When TIBCO ComputeDB AMI is made available on AWS in the future, it will have the distribution pre-installed. In that case, you can jump directly to step 15.

  13. Download and unzip TIB_compute_<version>_linux.zip, untar the tar.gz file in it and rename it to /opt/snappydata.

    unzip TIB_compute_<version>_linux.zip
    tar -xvf TIB_compute_<version>_linux.tar.gz 
    sudo mv TIB_compute_<version>_linux-bin /opt/snappydata
    chown -R ec2-user:ec2-user /opt/snappydata
    
  14. Ensure that Java 8 is installed and set as default. For Amazon Linux 2018.03, you may need to uninstall Java 7 first. Following commands update OpenJDK to 8:

    sudo yum -y -q remove  jre-1.7.0-openjdk
    sudo yum -y -q install java-1.8.0-openjdk-devel
    java -version  # Ensure it prints correct Java version
    
  15. Setup passwordless ssh on this instance. This requirement may be removed in future, for single-instance installation on AWS.

  16. Run the following commands to update the cluster configuration.

    curl http://169.254.169.254/latest/meta-data/local-ipv4 > /opt/snappydata/conf/locators
    curl http://169.254.169.254/latest/meta-data/local-ipv4 > /opt/snappydata/conf/servers
    curl http://169.254.169.254/latest/meta-data/local-ipv4 > /opt/snappydata/conf/leads
    
  17. Go to the /opt/snappydata directory. Run the following command to start a basic cluster with one data node, one lead, and one locator.

    ./sbin/snappy-start-all.sh
    

Accessing TIBCO ComupteDB Cluster

The quickest way to connect to your TIBCO ComupteDB cluster is probably using the Snappy Shell utility packaged with the distribution.

You can launch the Snappy Shell either from the same EC2 instance or from your laptop, where you have TIBCO ComupteDB installed.

Connecting to the Cluster from the Same EC2 instance:

Launch Snappy Shell.

    ./bin/snappy

Note

Before connecting to the cluster, make sure the security group attached to this EC2 instance has ports 1527-1528 open for the public IP of the same ec2 instance.

Now, connect to the cluster using its private IP (you can also use the public DNS/IP instead):

    snappy> connect client '(private-ip-of-EC2-instance):1527';

Connecting to Cluster from Laptop (or any Host Outside AWS VPC):

Launch the Snappy Shell:

    ${SNAPPY_HOME}/bin/snappy

Note

Before connecting to the cluster, make sure the security group attached to this EC2 instance has ports 1527-1528 open for the public IP of your laptop that is the host with TIBCO ComupteDB installed.

Now, connect to the cluster using the public DNS/IP of its EC2 instance:

    snappy> connect client '<public-ip-of-EC2-instance>:1527';