Error en Plesk: Espacio insuficiente en /migration del servidor fuente de la migración

Vaya tela…. este error persiste y persiste en las versiones de Plesk …

Síntomas
La migración de un dominio Parallels Plesk Panel finaliza sin ningún error. De todas formas, el dominio no presenta ningún archivo html.

Causa

La causa de este problema es una cantidad de espacio de disco insuficiente en el directorio /migration del servidor fuente.

El Administrador de Migraciones de Parallels Plesk Panel carga el Agente de Migración al servidor fuente. El Agente de Migración es un script perl que realiza el volcado de los datos, usando /migration en el servidor fuente como directorio temporal para la migración. Si el directorio /migration ya no dispone de más espacio o se encuentra en una partición de tamaño limitado, los datos no se volcan debido a esta insuficiencia de espacio de disco.

Puede comprobar el tamaño de la partición ejecutando el comando «df -h». Por ejemplo:

~# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda1 950M 254M 649M 29% / <- la partición es demasiado pequeña

/dev/sda2 4.7G 1.6G 3.1G 35% /usr

/dev/sda3 100G 60G 41G 60% /var

/dev/sda4 4.7G 5.5M 4.7G 1% /home

~#

La partición “/” donde se encuentra el directorio /migration es demasiado pequeña. Tar no puede volcar los datos debido a la insuficiencia de espacio de disco.

Resolución

Le recomendamos liberar el directorio /migration en el servidor fuente. También puede transferir el directorio a una partición de mayor capacidad.

Por ejemplo, creemos el directorio de migración en otra partición que tenga espacio suficiente:

source~# mkdir /home/migration

Entonces creeamos un vínculo simbólico:

source~# rm -rf /migration

source~# ln -s /home/migration/ /migration

Y yasta amigos a migrar dominios a saco de servidor a servidor….

Buscar un archivo creado entre dos fechas en al shell de Linux

Te acuerdas que creaste un archivo entre el 15 de Septiembre de 2010 y el 30 de Septiembre de ese mismo año. ¿Cómo lo puedes buscar en Linux? Fácil, usando el comando find y estos truquitos:

Primera forma para versiones antiguas del comando find (< =2.4)

$ touch -d "15 sep 2010" /tmp/begin
$ touch -d "30 sep 2010" /tmp/end
$ find . -newer /tmp/begin -a \! -newer /tmp/end

Segunda forma (Para versiones nuevas de find (>=2.4), te lo puedes hacer con un solo comando mediante la opción ‘-newerXY’)

$ find . -newermt “15 sep 2010″ \! -newermt “30 sep 2010″)

Lo he necesitado varias veces y nunca me acordaba de la receta, así que la dejo aquí compartida para todos. ¡Que os aproveche!

Script para optimizar las tablas fragmentadas en MySQL

Bueno otro buen script a la huchaca… esta escrito en bash aparte de ser utilisisimo porque chequea las tablas fragmentadas y tambien chequea todas las bbdds en busca de tablas MyISAM o INNODB y las optimiza.

#!/bin/bash

VERSION="0.7.2"
log="$PWD/mysql_error_log.txt"

echo "MySQL fragmentation finder (and fixer) v$VERSION, written by Phil Dufault ( http://www.dufault.info/ )"

showHelp() {
echo -e "\tThis script only repairs MyISAM and InnoDB tables"
echo -e "\t--help or -h\t\tthis menu"
echo -e "\t--user username\tspecify mysql username to use\n\t\t\tusing this flag means the script will ask for a password during runtime, unless you supply..."
echo -e "\t--password \"yourpassword\""
echo -e "\t--host hostname\tspecify mysql hostname to use, be it local (default) or remote"
}

#s parse arguments
while [[ $1 == -* ]]; do
case "$1" in
--help|-h) showHelp; exit 0;;
--user) mysqlUser="$2"; shift 2;;
--password) mysqlPass="$2"; shift 2;;
--host) mysqlHost="$2"; shift 2;;
--) shift; break;;
esac
done

# prevent overwriting the commandline args with the ones in .my.cnf, and check that .my.cnf exists
if [[ ! $mysqlUser && -f "$HOME/.my.cnf" ]]; then
if grep "user=" "$HOME/.my.cnf" >/dev/null 2>&1; then
if grep "pass=" "$HOME/.my.cnf" >/dev/null 2>&1; then
mysqlUser=$(grep user= < "$HOME/.my.cnf" | awk -F\" '{print $2}'); mysqlPass=$(grep pass= < "$HOME/.my.cnf" | awk -F\" '{print $2}'); if grep "host=" "$HOME/.my.cnf" >/dev/null 2>&1; then
mysqlHost=$(grep host= < "$HOME/.my.cnf" | awk -F\" '{print $2}'); fi else echo "Found no pass line in your .my.cnf,, fix this or specify with --password" fi else echo "Found no user line in your .my.cnf, fix this or specify with --user" exit 1; fi fi # set localhost if no host is set anywhere else if [[ ! $mysqlHost ]]; then mysqlHost="127.0.0.1" fi # error out if [[ ! $mysqlUser ]]; then echo "Authentication information not found as arguments, nor in $HOME/.my.cnf" echo showHelp exit 1 fi if [[ ! $mysqlPass ]]; then echo -n "Enter your MySQL password: " read -s mysqlPass fi # Test connecting to the database: mysql -u"$mysqlUser" -p"$mysqlPass" -h"$mysqlHost" --skip-column-names --batch -e "show status" >/dev/null 2>&1
if [[ $? -gt 0 ]]; then
echo "An error occured, check $log for more information.";
exit 1;
fi

# Retrieve the listing of databases:
databases=( $(mysql -u"$mysqlUser" -p"$mysqlPass" -h"$mysqlHost" --skip-column-names --batch -e "show databases;" 2>"$log") );
if [[ $? -gt 0 ]]; then
echo "An error occured, check $log for more information."
exit 1;
fi

echo -e "Found ${#databases[@]} databases";
for i in ${databases[@]}; do
# get a list of all of the tables, grep for MyISAM or InnoDB, and then sort out the fragmented tables with awk
fragmented=( $(mysql -u"$mysqlUser" -p"$mysqlPass" -h"$mysqlHost" --skip-column-names --batch -e "SHOW TABLE STATUS FROM $i;" 2>"$log" | awk '{print $1,$2,$10}' | egrep "MyISAM|InnoDB" | awk '$3 > 0' | awk '{print $1}') );
if [[ $? -gt 0 ]]; then
echo "An error occured, check $log for more information."
exit 1;
fi
tput sc
echo -n "Checking $i ... ";
if [[ ${#fragmented[@]} -gt 0 ]]; then
if [[ ${#fragmented[@]} -gt 0 ]]; then
if [[ ${#fragmented[@]} -gt 1 ]]; then
echo "found ${#fragmented[@]} fragmented tables."
else
echo "found ${#fragmented[@]} fragmented table."
fi
fi
for table in ${fragmented[@]}; do
let fraggedTables=$fraggedTables+1;
echo -ne "\tOptimizing $table ... ";
mysql -u"$mysqlUser" -p"$mysqlPass" -h"$mysqlHost" -D "$i" --skip-column-names --batch -e "optimize table $table" 2>"$log" >/dev/null
if [[ $? -gt 0 ]]; then
echo "An error occured, check $log for more information."
exit 1;
fi
echo done
done
else
tput rc
tput el
fi
unset fragmented
done

# footer message
if [[ ! $fraggedTables -gt 0 ]]; then
echo "No tables were fragmented, so no optimizing was done.";
else
if [[ $fraggedTables -gt 1 ]]; then
echo "$fraggedTables tables were fragmented, and were optimized.";
else
echo "$fraggedTables table was fragmented, and was optimized.";
fi
fi

if [[ ! -s $log ]]; then
rm -f "$log"
fi

unset fraggedTables

Link | http://www.dufault.info/blog/a-script-to-optimize-fragmented-tables-in-mysql/

Script en bash para cambiar el puerto de Apache en todos los dominios en Plesk

Si quereis cambiar el puerto en todos los vhost`s en Plesk, tendreis que cambiar el numero 80 (puerto Apache default de Plesk) dentro del archivo httpd.include de cada vhosts, y si teneis muchos vhosts en el servidor o servidores… como no tengais este pequeño script en bash, os podeis morir en el intento

#!/bin/bash
MY_FILEPATH="/var/www/vhosts"
MY_FILE="httpd.include"
MY_REPLACE=":81"
find $MY_FILEPATH  -name $MY_FILE -exec perl -p -i -e "s[:80][$MY_REPLACE]g" {} \;
service httpd restart"

Problema con la libreta de direcciones en Horde al actualizar a Plesk a la versión 9.5.1

El problema que os comento me ha pasado con Horde (webmail por defecto en Plesk) por actualizar Plesk de la versión 9.3.0 a 9.5.1.

El problema estaba bien claro, al intentar acceder a la libreta de direcciones que Horde guarda, Horde daba el siguiente error:

DBError: field

y el log de Horde daba el siguiente error:

error log : Apr 20 18:05:16 HORDE [error] [kronolith] DB Error: no such  field:
SELECT event_id, event_uid, event_description, event_location,  event_private, event_status,
event_attendees, event_keywords,  event_title, event_category, event_recurcount, event_recurtype,
 event_recurenddate, event_recurinterval, event_recurdays, event_start,  event_end, event_alarm,
event_modified, event_exceptions,  event_creator_id FROM kronolith_events WHERE calendar_id =  'email@domain.com'
AND event_alarm > 0 AND ((event_end >=  '2010-04-20 00:00:00') OR (event_recurenddate >=
'2010-04-20  00:00:00' AND event_recurtype <> 0))
[nativecode=1054 ** Unknown  column 'event_private' in 'field list'] [pid 26294 on line 323 of  "/usr/share/psa-horde/kronolith/lib/Driver/sql.php"]
 Apr 20 18:05:16 HORDE [error] [turba] DB Error: no such field: SELECT  object_id, owner_id,
 object_type, object_members, object_uid,  object_firstname, object_lastname, object_middlenames,
 object_nameprefix, object_namesuffix, object_alias, object_bday,  object_homestreet,
object_homepob, object_homecity, object_homeprovince,  object_homepostalcode, object_homecountry,
 object_workstreet,  object_workpob, object_workcity, object_workprovince,  object_workpostalcode,
object_workcountry, object_tz, object_email,  object_homephone, object_workphone, object_cellphone,
object_fax,  object_pager, object_title, object_role, object_company,  object_category, object_notes,
object_url, object_freebusyurl,  object_pgppublickey, object_smimepublickey FROM turba_objects WHERE
 (object_type = 'Group' AND owner_id = 'email@domain.com')  [nativecode=1054 ** Unknown column
'object_firstname' in 'field list']  [pid 26294 on line 173 of  "/usr/share/psa-horde/turba/lib/Driver/sql.php"]

Vale pues despues de tantos errores aqui os digo la solución que mas o menos daban en los foros de parallels y que yo le aplique al dichoso error.

El error es debido a que Plesk al actualizar a la versión 9.5.1 instala la versión de psa-turba 2.3.3 que es la que crea el complemento de la libreta de direcciones en Horde, pues desinstalamos ese rpm que Plesk instalo:

rpm -e –nodeps psa-turba-2.3.3

Ahora nos vamos a bajar el anterior paquete rpm de la versión de psa-turba que es el 2.1.7 y posteriormente lo instalamos y listo.

wget http://autoinstall.plesk.com/PSA_9.3.0/dist-rpm-CentOS-5-x86_64/opt/horde/psa-turba-2.1.7-cos5.build93091230.06.noarch.rpm

rpm -i psa-turba-2.1.7-cos5.build93091230.06.noarch.rpm

Y listo¡¡¡ ya tenemos la libreta de direcciones que guarda Horde y no hemos perdido ningún contacto porque no hemos tocado la base de datos ni las tablas que usa Horde.