miércoles, 24 de agosto de 2011

Instalación de Scalr (II)

En el artículo anterior mostraba como instalar Scalr sobre debian 6 pero detecte algunos errores en el dashboard de scalr que no me convencían por lo que (haciendo caso de la documentación de scalr) vamos a instalar php 5.2 y quitar php 5.3 para un correcto funcionamiento.

Comandos en modo chuleta:

# nano /etc/apt/sources.list

deb http://ftp.debian.org/debian/     lenny         main contrib non-free

# nano /etc/apt/preferences

Package: php5*
Pin: release a=oldstable
Pin-Priority: 700

Package: *
Pin: release a=stable
Pin-Priority: 600

# aptitude update
# aptitude remove `dpkg -l | grep php| awk '{print $2}' `
# aptitude install libkrb53

# apt-get install -t lenny ` dpkg -l | grep php| grep -v libssh | awk '{print $2}' `
# aptitude install -t lenny php5-mhash

# aptitude install php-pear php5-dev -t lenny

Añadir a sources.list:
# nano /etc/apt/sources.list

deb http://backports.debian.org/debian-backports lenny-backports main contrib non-free
# aptitude install -t lenny-backports libssh2-php

# nano /etc/apache2/sites-enabled/000-default:

       
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
       


# a2enmod rewrite

# aptitude install librrd2-dev
# aptitude install -t lenny-backports rrdtool
# cd /root
# mkdir php_rrdtool
# cd php_rrdtool/
# wget http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tar.gz
# tar xvzf php_rrdtool.tar.gz
# mv rrdtool /usr/include/php5/ext
# cd /usr/include/php5/ext/rrdtool
# phpize
# ./configure --with-php-config=/usr/bin/php-config --with-rrdtool=/usr
# make ; make install
# cd /etc/php5/conf.d/
# nano rrdtool.ini
;enable rrdtool extension module
extension=rrdtool.so
# /etc/init.d/apache2 restart

Aparece el siguiente error:
PHP Warning:  PHP Startup: rrdtool: Unable to initialize module\nModule compiled with module API=20090626, debug=0, thread-safety=0\nPHP    compiled with module API=20060613, debug=0, thread-safety=0\nThese options need to match\n in Unknown on line 0

# cd /usr/lib/php5/
# ll
total 20
drwxr-xr-x 2 root root 4096 ago 11 19:28 20060613+lfs
drwxr-xr-x 2 root root 4096 ago 11 19:01 20090626+lfs
drwxr-xr-x 2 root root 4096 ago 11 19:05 build
drwxr-xr-x 2 root root 4096 ago  4  2010 libexec
-rwxr-xr-x 1 root root  278 ago  4  2010 maxlifetime
# ll /usr/lib/php5/20090626+lfs/
total 48
-rwxr-xr-x 1 root root 48641 ago 11 02:43 rrdtool.so

# rm -rf 20090626+lfs/
# /etc/init.d/apache2 restart

# aptitude safe-upgrade
Resolviendo las dependencias...                 
Se ELIMINARÁN los siguientes paquetes:
  libltdl3-dev{u}
Se actualizarán los siguientes paquetes:
  autoconf automake automake1.4 autotools-dev libdb4.6 libmcrypt4 libmhash2 libtool m4 rrdtool shtool

Entramos a la configuración desde el navegador.
http://miip/settings_core.php
Cambiamos "Path to rrdtool binary:"
/usr/bin/rrdtool

# cd /usr/share/fonts/truetype/ttf-dejavu
# wget http://people.ee.ethz.ch/~oetiker/webtools/rrdtool-trac/browser/branches/1.2/program/src/DejaVuSansMono-Roman.ttf?format=raw
# mv DejaVuSansMono-Roman.ttf\?format\=raw DejaVuSansMono-Roman.ttf

Cambiamos "Path to font (for rrdtool):"
/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf

Cambiamos "Statistics URL: ":
ponemos nuestra ip/dominio en sustitución de domain.com

Pulsamos sobre save.

# mkdir /home/rrddata
# mkdir /home/graphics


Añadir a /etc/crontab:
* * * * * /usr/bin/php -q /var/scalr/app/cron-ng/cron.php --SNMPStatsPoller

# /etc/init.d/cron restart


Descargamos nuestro certificados X.509 desde nuestra cuenta de amazon y la copiamos en:
$ scp -i aws.pem pk* root@maquina.eu-west-1.compute.amazonaws.com:/var/scalr/app/etc/
$ scp -i aws.pem cert* root@maquina.eu-west-1.compute.amazonaws.com:/var/scalr/app/etc/

Continuamos con el Warning de php para rrdtool:

# cd /usr/include/php5/ext/rrdtool
#  rm -rf rrdtool/
# cd
# cd php_rrdtool/
# tar xvzf php_rrdtool.tar.gz
# mv rrdtool /usr/include/php5/ext
# cd /usr/include/php5/ext/rrdtool/
# phpize
# aptitude search libtool
# apt-cache policy libtool
# locate libtool.m4
# aptitude remove libtool
# aptitude install libtool php5-dev -t lenny
# phpize

root@DB:/usr/include/php5/ext/rrdtool# phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
Obtenemos estos warnings para ya podemos continuar con el make:
# ./configure --with-php-config=/usr/bin/php-config --with-rrdtool=/usr
# make ; make install
# cd /etc/php5/conf.d/
# nano rrdtool.ini
;enable rrdtool extension module
extension=rrdtool.so
# /etc/init.d/apache2 restart

También nos faltaba este paso de la instalación anterior.
mysql> grant all privileges on scalr.* to 'scalr'@'localhost' identified by 'contraseña';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;


Bueno funciona pero los tenemos los mismos errores en el dashboard que obteníamos con php 5.3

Referencias:
http://atom-hosting.com/blog/?p=52



Continuará ...

miércoles, 10 de agosto de 2011

Instalación de Scalr

Instalación de scalr en modo chuleta sobre debian squeeze:

# aptitude install apache2 php5-cli libapache2-mod-php5 php5-mysql php5-mcrypt php5-mhash libssh2-php php5-snmp php-pear php5-dev php5-curl make libcurl4-openssl-dev snmp
# /etc/init.d/apache2 restart
# cd /root
# mkdir scalr
# cd scalr/
# wget http://scalr.googlecode.com/files/scalr-2.2.1.tar.gz
# tar xvzf scalr-2.2.1.tar.gz

# cp -r scalr-2.2.1 /var/scalr

# cd /var
# chown -R www-data:www-data /var/scalr/app/cache /var/scalr/app/cron/cron.pid /var/scalr/app/etc/.passwd
# chmod 700 -R /var/scalr/app/cache /var/scalr/app/cron/cron.pid /var/scalr/app/etc/.passwd
# mv www www_old
# ln -s /var/scalr/app/www /var/www
# chmod a+rX -R /var/www

# cd /var/www
# find . -exec chown www-data.www-data {} \;

# cd /var/scalr/sql
# mysqladmin -p create scalr
# mysql -u root -p -D scalr < /var/scalr/sql/scalr-2.2-structure.sql
# mysql -u root -p -D scalr < /var/scalr/sql/scalr-2.2-init-data.sql
# mysql -u root -p
mysql> grant all privileges on scalr.* to 'scalr'@'%' identified by 'scalr';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

# cd /var/scalr/app/etc
# nano config.ini

# mkdir /var/scalr/app/cache/smarty_bin/en_US
# chmod 777 /var/scalr/app/cache/smarty_bin/en_US
# chmod 0777 /var/scalr/app/etc/.passwd
# chmod 0777 /var/scalr/app/etc/.cryptokey

# /etc/init.d/apache2 restart



Comprobamos a través: http://nuestraip/testenvironment.php:

Errors:
• Cannot find PECL_HTTP functions. Make sure that PECL_HTTP Functions enabled.

Solución
# pecl install pecl_http

Añadimos "extension=http.so" a php.ini:


# cd /etc/php5/apache2/conf.d
# echo "extension=http.so" > http.ini
# /etc/init.d/apache2 restart

Hasta llegar a:

Congratulations, your environment settings match Scalr requirements!

Añadimos a:
# nano /etc/crontab

#Scalr
*/4  * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --UsageStatsPoller
*/2  * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --Scheduler
*/15 * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --MySQLMaintenance
*    * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --DNSManagerPoll
*/4  * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --RolesQueue
17   5 * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --RotateLogs
*/5  * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --DBQueueEvent
*/4  * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --RDSMaintenance
*/2  * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --BundleTasksManager
*/2  * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --MessagingQueue
*/2  * * * * /usr/bin/php -q /var/scalr/app/cron/cron.php --EBSManager

* * * * * /usr/bin/php -q /var/scalr/app/cron-ng/cron.php --ScalarizrMessaging
* * * * * /usr/bin/php -q /var/scalr/app/cron-ng/cron.php --Poller
* * * * * /usr/bin/php -q /var/scalr/app/cron-ng/cron.php --Scaling

# /etc/init.d/cron restart

Referencias:

http://wiki.scalr.net/Installing_Scalr/OS_Specific_Installation_Guides/Ubuntu_10.04_Lucid
http://wiki.scalr.net/Installing_Scalr
http://aws.amazon.com/articles/1603
http://code.google.com/p/scalr/

Continuará...

martes, 9 de agosto de 2011

Amazon continúa luciendose

Hoy hemos recibido el siguiente mail:

"Amazon EBS Snapshots in the EU-West Region

Hello,

We've discovered an error in the Amazon EBS software that cleans up unused snapshots.  This has affected at least one of your snapshots in the EU-West Region.  

During a recent run of this EBS software in the EU-West Region, one or more blocks in a number of EBS snapshots were incorrectly deleted. The root cause was a software error that caused the snapshot references to a subset of blocks to be missed during the reference counting process. This process compares the blocks scheduled for deletion to the blocks referenced in customer snapshots. As a result of the software error, the EBS snapshot management system in the EU-West Region incorrectly thought some of the blocks were no longer being used and deleted them. We've addressed the error in the EBS snapshot system to prevent it from recurring. 

We have now disabled all of your snapshots that contain these missing blocks. You can determine which of your snapshots were affected via the AWS Management Console or the DescribeSnapshots API call. The status for any affected snapshots will be shown as "error."

We have created copies of your affected snapshots where we've replaced the missing blocks with empty blocks. You can create a new volume from these snapshot copies and run a recovery tool on it (e.g. a file system recovery tool like fsck); in some cases this may restore normal volume operation. These snapshots can be identified via the snapshot Description field which you can see on the AWS Management Console or via the DescribeSnapshots API call. The Description field contains "Recovery Snapshot snap-xxxx" where snap-xxx is the id of the affected snapshot. Alternately, if you have any older or more recent snapshots that were unaffected, you will be able to create a volume from those snapshots without error. For additional questions, you may open a case in our Support Center: https://aws.amazon.com/support/createCase

We apologize for any potential impact this might have on your applications.

Sincerely,
AWS Developer Support 

Aquí vemos uno de los snapshots dañado y "recuperado" (o eso se supone):



Menudo añito lleva amazon.