wiki:howto/ZarafaMigrateConnectux

Version 22 (modified by Edwin Eefting, 14 years ago) (diff)

--

Zarafa migratie van Connectux naar SYN-3

Users

Zorg dat de users zijn aangemaakt op de SYN-3 server.

Als de installatie te groot is om dit handigmatig te doen, neem dan contact op met ons. Wij kunnen hiervoor scripts maken.

Database kopieren van Connectux naar SYN-3

  • Zorg dat u mimimaal SYN-3 versie 4.4.1 hebt.
  • Achterhaal de mysql user en pass van de database op de Connectux server:
    linux:/md0 # grep mysql /etc/araneus/zarafa/server.cfg
    mysql_user              = root
    mysql_password          = 12345
    mysql_database          = zarafa
    
  • Zorg dat de Zarafa database op de SYN-3 server leeg is:
    [Syn-3] root@syn.kado.local ~# svcstop /service/zarafa-server/                                                                                                                               
    Stopping /service/zarafa-server/ ....OK
    [Syn-3] root@syn.kado.local ~#  mysqladmin -f -p`cat /etc/my.passwd` drop zarafa && mysqladmin -p`cat /etc/my.passwd` create zarafa && rm -r /home/system/zarafa/*                
    Database "zarafa" dropped
    [Syn-3] root@syn.kado.local ~# 
    
    
  • Om tijd te besparen, zorgen we dat de database rechtstreeks geïmporteerd word op de SYN-3 server, zonder tussenkomt van tijdelijke files. Voer uit op de Connectux server:
linux:/md0 # mysqldump --quick -uroot -p'12345' zarafa | ssh root@10.0.0.6 'mysql -p`cat /etc/my.passwd` zarafa'
root@10.0.0.6's password:
  • Afhankelijk van de database grote, kan dit soms een paar uur duren. Met dstat en top kunt u op de syn3 server zien wat er gaande is.

Mocht de conversie onderbroken worden met de melding 'ERROR 1153 (08S01) at line 24818: Got a packet bigger than 'max_allowed_packet' bytes', dan dient u deze instelling hoger te maken in beide mysql config files

User ID's en database conversie

Kopieer de passwd file van de oude server naar /root en gebruik dit script

#!/bin/bash

svcdownchk /service/zarafa-server


SQLPW=`cat /etc/my.passwd`

echo "SYN-3: Reading user ID converions:"
echo "old user id -> username -> new user id"
for OLDUID in `echo 'select externid from users where object_type=1 and externid>0' |mysql -p$SQLPW zarafa`; do
    [ "$OLDUID" == "externid" ] && continue;

    USER=`cat ~/passwd |egrep ".+:.+:$OLDUID:"|cut -f1 -d:`
    NEWUID=`getent passwd |egrep "$USER:.+:.+:"|cut -f3 -d:`
    echo "$OLDUID -> $USER -> $NEWUID"
    if [ "$USER" == "" ];  then
        echo "Old user $OLDUID not found in old passwd file!"
        exit 1
    fi
    if [ "$NEWUID" == "" ];  then
        echo "User $USER does not exist on this system yet!"
        exit 1
    fi
    QUERY="$QUERY""update users set externid='$NEWUID' where (externid='$OLDUID');\n"
done

if [ "$QUERY" == "" ];then
    echo "Something went wrong.."
    exit 1
fi

echo "SYN-3: Updating database:"
echo -e "$QUERY" | mysql -p$SQLPW zarafa || exit 1

echo "SYN-3: Starting zarafa in conversion mode:"
rm /var/log/zarafa/server.log
zarafa-server --ignore-attachment-storage-conflict
sleep 10
tail -f /var/log/zarafa/server.log &

while ! grep 'Startup succeeded' /var/log/zarafa/server.log; do
    echo "SYN-3: Waiting for conversion to finish..."
    sleep 60
done

killall zarafa-server tail

echo "SYN-3: Converting attachments from database to files"
perl /usr/doc/zarafa/db-convert-attachments-to-files root $SQLPW zarafa /home/system/zarafa || exit 1
chown -R zarafa:zarafa /home/system/zarafa || exit 1


svcstart /service/zarafa-server || exit 1
echo "SYN-3: Conversion done, Zarafa should be available now."