NEW VERSION 0.0.6 RELEASED!
POST UPDATED!
POST UPDATED!
Requirements:
You must to have setup AWS auto-scaling or you have to setup it using this guide.
(btw. You need AWS Autoscaling CLI tools for setup your autoscaling.)
Make sure what your autoscalig configuration works correct on on-demand ec2 instances.
So your autoscaling configuration must have:
- lauch-config at least with options: --image-id value --instance-type value --group value[,value...] --key value, other options are optinal.
[--block-device-mapping "key1=value1,key2=value2..." ] - still did not implemented!
- auto-scaling-group at least with options: --availability-zones value[,value...] --launch-configuration value --max-size value --min-size value --load-balancers value[, value]], other options are optinal.
[--desired-capacity value] [--grace-period value] [--health-check-type value][--placement-group value] [--vpc-zone-identifier value] -still did not implemented
- policies mandatory options:
- alarms: all except one: value of option:
--dimensions "AutoScalingGroupName=MyAutoScalingGroup", because cloudwatch has no data for current scaling process.
I recommend You use loadbalancer metric, or use my common design for autoscaling: one on-demand instance at master role + scaleout with spot-instance in slave role.
(btw. You need AWS Autoscaling CLI tools for setup your autoscaling.)
Make sure what your autoscalig configuration works correct on on-demand ec2 instances.
So your autoscaling configuration must have:
- lauch-config at least with options: --image-id value --instance-type value --group value[,value...] --key value, other options are optinal.
[--block-device-mapping "key1=value1,key2=value2..." ] - still did not implemented!
- auto-scaling-group at least with options: --availability-zones value[,value...] --launch-configuration value --max-size value --min-size value --load-balancers value[, value]], other options are optinal.
[--desired-capacity value] [--grace-period value] [--health-check-type value][--placement-group value] [--vpc-zone-identifier value] -still did not implemented
- policies mandatory options:
--auto-scaling-group --adjustment= --type --cooldown - alarms: all except one: value of option:
--dimension, can't be autoscaling metric like --dimensions "AutoScalingGroupName=MyAutoScalingGroup", because cloudwatch has no data for current scaling process.
I recommend You use loadbalancer metric, or use my common design for autoscaling: one on-demand instance at master role + scaleout with spot-instance in slave role.
Also you need *nix like OS (FreeBSD, Linux, Mac OS X, etc) with:
- PHP 5.3.x +
- MySQL 5.x
- AWSSDKforPHP (and all its dependents)
- PEAR PHP Log
- MySQL 5.x
- AWSSDKforPHP (and all its dependents)
- PEAR PHP Log
Installation:
1. Install dependencies
1.1 Make sure what PEAR has been installed and path included in include_path directive at your php.ini.
To adding directive to php.ini (where /usr/share/pear - path to you pear):
# echo "include_path=\".:/usr/share/pear\"" >> /etc/php.ini1.2 Discover pear channel and install AWSSDKforPHP(aka cloudfusion):
# pear channel-discover pear.amazonwebservices.com
# pear install aws/sdk1.3 Config SDK:
# cp -Rp /usr/share/pear/AWSSDKforPHP/config-sample.inc.php ~/.aws/sdk/config.inc.php
# vim ~/.aws/sdk/config.inc.php (add your AWS security credentials to config)
# chmod 600 ~/.aws/sdk/config.inc.php1.4. Install Log package from PEAR:
# pear install Log2. Install mycld
2.1 Get the mycld from code.google.com
# svn checkout http://mycld.googlecode.com/svn/trunk ~/mycld2.2 Create MySQL database
# mysql -u root -p < ~/mycld/db.sql2.3 Config mycld for accessing your MySQL
# cd ~/mycld/conf/
# cp -Rp db.ini.sample db.ini
# vim db.ini (change your mysql user and/or password)Running:
1. Suspend you AWS autoscaling activities first:
# as-suspend-processes MyAutoScalingGroup2. Add cron job:
# echo "*/5 * * * * root /root/mycld/mycld.cli.runner.php \-s spotscale -a check -d >> /root/mycld/logs/spotscale-error.log \2>&1" >> /etc/crontab Debugging:
1. Check what you are running mycld.cli.runner.php with "-d"'.
# grep "mycld" /etc/crontab | grep "-d"
2. Watch logs:
# tail -f ~/mycld/logs/*.log
No comments:
Post a Comment