Getting Started aiCache on AWS


Launching your aiCache instance

Registering for aiCache AMI

  1. Before being able to use aiCache on Amazon AWS you should subscribe by going to Amazon AWS subscriptions.
  2. Login to amazon AWS using your amazon credentials, fill in the necessary information, and follow the on screen wizard.
  3. Once the subscription process is completed a message will appear showing your confirmation/verification code. You will then be able to start a new aiCache instance

Launching the aiCache instance

Starting the Management Console

  1. To launch a new aiCache application instance you need to go to your amazon AWS Management Console click on the button (Sign in to the AWS console)
  2. Login using your AWS credentials, use the same credentials you have used to subscribe for aiCache.
  3. Once you are logged in you will see a screen that looks like the figure below


Selecting an AMI

  1. From the left side menu select the AMI option (AMI)
  2. In the viewing box , select All Images, Select all platforms then start typing aicache in the provided box. You will be presented with a screen that looks like the figure below
  3. Select the latest aiCache image, normal aiCache images manifiest files are of the format
aicache/aicache.v{versionNumber}.manifest.xml

Do not select images that follow another format (in the figure above aicache/image_bundles/) those images are specific to cloud vendors (rightscale for this example).
Prefix aicache can be also aicache.eu for European AMI. Latest version is aicache/aicache.v6.manifest.xml.

Launching an Instance from the AMI

Select the image and then click the launch button shown on top, this will open the Launch instance wizard as shown below.



Setting up config file

For quick start, you can use template config.
Hostname is your domain name, if you are trying to cache abc.com then change hostname (example.com) to your domain
Cname is an alias for this domain name.
If no hostname or cname found for specific request, aicache will respond with 409 Website not configured error.

 website
 hostname example.com
 cname www.example.com
 cname EC2_PUBLIC_HOSTNAME


cname EC2_PUBLIC_HOSTNAME is a special substitution.
It will be replaced with amazon address like ec2-xx-xx-xx-xx.amazonaws.com and allow you to test aicache acceleration before making DNS changes.

Origin Servers are your application / website servers.
You should tell aiCache how it can call your application servers by specifying the ip addresses for your origin server / servers
If you look at the example configuration file you will notice origin server entires

#origin 10.24.83.175 80 1
#origin 10.24.70.176 80 2
#origin 10.24.73.156 80 3
#origin 10.24.191.239 80 4


note that # implies that this configuration line is commented / not effective.
Add your origin ip address and remove the comment at the beginning of the line to enable origin server configuration
If you have a website at 127.0.0.1 your configuration will look like this :

origin 127.0.0.1 80 1
#origin 10.24.70.176 80 2
#origin 10.24.73.156 80 3
#origin 10.24.191.239 80 4


where 80 is the port on which the server is running, the second number implies the order a which aiCache will contact your origin servers. If case it is one server then its 1.

Upload config file to your web server and set it's url in User Data field while launching AMI.
On screenshot below I'm launching aiCache instance with config file from http://aicache.com/example.cfg



New Users : If this is the first time you use Amazon AWS then you will have to complete steps 2 and 3 of the wizard where you can create a new keypair and security groups. Read the following two sections to understand the process

Advanced users : you can skip the following 2 sections and advance to (Launch) section


Creating a new Keypair


If you landed on step 2 of the wizard, then you will see a screen that looks like the figure below



Public/Private keypair is the preferred method for securely connecting via SSH to your amazon EC2 instance.
Keypair name can be any name that you choose, we suggest aiCacheKeypair as a name.

Enter the name of the keypair then click on Create and Download keypair, after successfully downloading the keypair click on the continue button below.

Warning: Key pair is considered confidential , if anyone can access your key pair he is likely
to be able to control, terminate, restart or tamper with your Aicache and any Amazon EC2
instance you launch using this key pair.


Creating and configuring security groups

Each amazon EC2 instance is protected by an EC2 firewall. The firewall configuration is called (security groups)
using Amazon terminology. With a specific security group you can set your firewall to allow
certain IP addresses to access certain ports on your instance.

Since aiCache is basically a web server you should allow all clients to connect to port 80 (the default HTTP Port), you
should also remember to allow yourself to use SSH to connect to the instance thus port 22 should always be open.

You will now find yourself on step 3 of the wizard (firewall configuration). See figure below.


 
For now select the port 22 option shown on the wizard screen later you will go back and modify the security group to allow port 80 access.
Click continue.

Launch

This is step 4 of the wizard where you select security groups, key-pair, the number of instances to launch. See the below figure.



  1. Select your keypair, your security groups , the number of aiCache servers to start. You can create new security groups, and keypairs as required. If you are taking aiCache for a test drive then you would probably want to launch 1 instance.
  2. Click Launch to start your aiCache server instance.

Testing aicache instance

Point your browser to the amazon EC2 address - http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com
If aicache started correctly and no problems with config file, accelerated site should appear




Troubleshooting

Connecting to your aicache instance

Usually you don't have to access your aiCache instance via SSH - it will download config and keep aicache process alive automatically.
But if you need to manually adjust config and don't want to restart instnace, ssh will be useful.
For windows ssh you can use Putty. For Linux and Mac use your favourite ssh clients.

Access your aiCache instance using your Amazon SSH keypair

Download your amazon AWS keypair file and use ssh (unix / Mac ) to connect to your instance.
The ssh keypair is what you have created in subsection Creating a new Keypair

ssh -i path_to_aws_keypair root@ec2-xx-xx-xx-xx.compute-1.amazonaws.com
ec2-xx-xx is the public DNS name for your instance

For more information on how to use putty to connect to your AWS instance see AWS EC2 Manual

Configuration file

Configuration file you've provided as user data input located at
/root/aicache.cfg

Restarting aiCache

After you did some changes in config file, you have to restart aicache.

pkill aicache

This command will kill current aicache process and within 5 seconds new one will be started by aicache watchdog.
Also watchdog will restart aicache in case of any crashes.

Log rotation for aiCache


AiCache server provides several options for automated or on-demand log rotation

Size-based access log file rotation

aiCache provides automated, on-the-fly, size-based access log file rotation. This feature is typically used to cut down size of the access log files to some reasonable value, as it might be easier to deal with 10 files of 100MB each, as opposed to a single file of 1GB. To enable, simply set in the cfg file:

max_log_file_size 100000000

Be careful with those zeroes – the size is specified in bytes ! When max_log_file_size is set, aiCache rotates present log file upon it reaching the maximum size. The renamed access file has a timestamp added to the name of the file. The size-based rotation is a zero-downtime operation and happens automagically.

On-demand log file rotation via USR1 signal.

To execute on-the-fly, on-demand log file rotation, send SIGUSR1 to aiCache’s process ID at time of your choosing - manually or using a script driven by Linux cron facility. For example:

pkill -USR1 aicache

Simply add this command to be scheduled by Linux cron facility at time that is convenient for you.
aiCache’s log file rotation – size-based or on demand, is a zero-overhead and zero-downtime operation, so feel free to do it on schedule that is convenient for you, there’s no performance impact. Please note that aiCache rotates log files after the rotation is requested, upon receiving first log-enabled request.

On-demand log file rotation via CLI command

You can also tell aiCache to rotate the log files from the CLI, using rotatelog command. After logging into CLI

>rl

Log file rotation is not cluster-wide, it is only the aiCache instance that the command is directed at, that executes the rotation.

Advanced aiCache configuration

aiCache is highly configurable and has a wide range of parameters which you can tweak to suit your needs.
Please download aiCache administration guide for details on how to configure aiCache.

  Sign in   Recent Site Activity   Terms   Report Abuse   Print page  |  Powered by Google Sites