Configuring HA in Single JVM Mode on EC2
The following sections cover the information required to configure high availability (HA) for PPaaS in Single JVM Mode on Amazon EC2:
Deployment Architecture
In this deployment model PPaaS Core is configured in Active/Passive mode using an Amazon Auto-scaling group and an Elastic Load Balancer. PPaaS Core consists of Cloud Controller (CC), Auto-scaler (AS) and PPaaS Manager (SM). The configuration will make sure that at any given time an instance of PPaaS Core is active. CEP, BAM and ActiveMQ are configured in Active/Active mode. For more information, see the following links for configuring them:
- CEP Active/Active Configuration
- DAS Active/Active Configuration
- ActiveMQ Active/Active (Network of Brokers) Configuration
Configuring PPaaS Core in Active/Passive mode on EC2
Follow the instructions below to configure PPaaS Core in Active/Passive mode on Amazon EC2:
Step 1: Create an AMI for PPaaS
Follow the instructions below to create an AMI for PPaaS:
- Log in to the Amazon EC2 Management Console and start an Ubuntu 12.04 Server 64 bit instance:
SSH into the above VM instance and install Java and find the
JAVA_HOME
path:# Install java sudo apt-get install python-software-properties sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer # Find JAVA_HOME file $(which java) /usr/bin/java: symbolic link to `/etc/alternatives/java' file /etc/alternatives/java /etc/alternatives/java: symbolic link to `/usr/lib/jvm/java-7-oracle/jre/bin/java'
SCP PPaaS package into the above VM instance and extract it at the
/opt
folder and grant permissions to the userubuntu
:cd /opt/ppaas-4.1.1 sudo chown -R ubuntu:ubuntu .
Update the Message Broker IP address and port in the following file:
/opt/ppaas-4.1.1/repository/conf/mqtttopic.properties
Create an
init.d
script for PPaaS using the following file and update theUSER
,JAVA_HOME
andPRODUCT_HOME
variables:https://gist.github.com/imesh/5256272cd71b74a06581 USER=”ubuntu” JAVA_HOME=”/usr/lib/jvm/java-7-oracle/jre/bin/java” PRODUCT_HOME=”/opt/ppaas-4.1.1”
Set executable permissions to the above
init.d
script:sudo chmod +x /etc/init.d/ppaas
Configure the PPaaS service to be started at boot time:
update-rc.d ppaas defaults update-rc.d ppaas enable
Verify the PPaaS service by starting the service:
service ppaas start service ppaas status service ppaas stop
Remove the log files that was created by the previous step:
rm /opt/ppaas-4.1.1/repository/logs/*
Create an AMI from the above running instance via the EC2 Management Console:
Step 2: Create an Amazon Load Balancer
Follow the instruction below to create an Amazon Load Balancer:
- Navigate to the Network & Security menu in the EC2 dashboard and click Load Balancers.
- Click create Load Balancer
- Define the following protocols that will be used by PPaaS and click Continue.
- Add the SSL certificate information and click Continue.
- Click Continue without changing the default information on ciphers.
- Click Continue without changing the default information on backend certificate.
- Configure the health check endpoint and click Continue.
Set the Ping protocol to HTTPS.
Set the Ping port to 9443.
- Set the Ping path to
/console
.
- Click Continue without changing any of the default setting in the Add EC2 Instances page.
- Click Continue without changing any of the default setting in the Add tags page.
- Review the details of the load balancer and click Create.
Step 3: Launch an EC2 Configuration
Follow the instructions below to launch an EC2 configuration:
- Navigate to the Auto Scaling menu in the EC2 dashboard and click Launch Configurations.
- Click Create launch configuration.
- Search for the PPaaS AMI created and click Select.
- Choose the instance type required and click Next: Configure details.
- Add a configuration name and click Next: Add Storage.
- Click Next: Configure Security Group without changing any of the default storage details.
- Configure a security group as required and click Review.
Consider closing all ports other than the ones used by PPaaS.
- Review the details and click Create launch configuration.
Step 4: Create an auto-scaling group
Follow the instructions below to create an auto-scaling group:
- Navigate to the Auto Scaling menu on the EC2 Dashboard and click Auto Scaling Groups.
Click Create Auto Scaling group.
Configure the Auto-scaling group details:
Enter a group name.
Set group size to 1.
Set a preferred availability zone.
Check the Receive traffic from Elastic Load Balancer(s) checkbox option.
Set the load balancer created previously.
Set the Health Check Type to ELB.
Click Next: Configure scaling policies.
- Select Keep this group at its initial size under s caling policies and click Next: Configure Notifications.
- Configure the notifications as shown in the screen below and click Next: Configure Tags.
- Click Review.
Configuration is not required for configuring tabs.
- Review the details and click Create Autoscaling Group.
Step 5: HA Verification
Once the above configuration is complete, EC2 will start a PPaaS AMI instance in the configured autoscaling group.
Follow the instruction below to verify a HA:
Navigate to the Auto Scaling menu on the EC2 Dashboard and click Auto Scaling Groups.
Click on Instances to see the status of the instance.
SSH into the instance and stop the PPaaS service if the Health Status of the instance is indicated as Healthy.
sudo su service ppaas stop
Recheck the Instances tab under Auto Scaling Group.
Now the health status of the instance should be indicated as Unhealthy.- Terminate the running instance and start a new one.