Adeelarifbhatti-Notes

Revision as of 22:50, 24 November 2009 by Cfremon (talk | contribs) (Adding category)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

For migrating LDAP,mysql and store data, go for the following!!!

mkdir /backup

chown zimbra.zimbra /backup su zimbra zmcontrol stop;


/opt/zimbra/libexec/zmslapcat /backup exit mkdir /backup/zim-db-data cp -rp /opt/zimbra/db/data/* /backup/zim-db-data mkdir /backup/zim-logger-db/ cp -rp /opt/zimbra/logger/db/* /backup/zim-logger-db/ mkdir /backup/conf-all cp -rp /opt/zimbra/conf/* /backup/conf-all/ mkdir /backup/detail-database


su zimbra mysql.server start source ~/bin/zmshutil ; zmsetvars mysql --batch --skip-column-names -e "show databases" | grep -e mbox -e zimbra > /backup/mysql.db.list mkdir /backup/detail-database

for db in `cat /backup/mysql.db.list`; do

~/mysql/bin/mysqldump $db -S $mysql_socket -u root --password=$mysql_root_password > /backup/detail-database/$db.sql
     echo "Dumped $db"
          done

mysql.server stop

mkdir /backup/store cp -rp /opt/zimbra/store/* /backup/store mkdir /backup/index cp -rp /opt/zimbra/index/* /backup/index/*


>>>>>>>>>>>>Restoring to new server cp the /backup directory and cp to new server

rm -rf /opt/zimbra/openldap-data/* cp -rp /backup/zim-db-data/* /opt/zimbra/db/data/ /opt/zimbra/openldap/sbin/slapadd -q -b "" -f /opt/zimbra/conf/slapd.conf -cv -l /backup/ldap/ldap.bak cp -rp /backup/conf-all/* /opt/zimbra/conf/

rm -rf /opt/zimbra/db/data/* rm -rf /opt/zimbra/logger/db/*

cp -rp /backup/zim-logger-db/* /opt/zimbra/logger/db/ cp -rp /backup/zim-db-data/* /opt/zimbra/db/data/ cp -rp /backup/store/* /opt/zimbra/store/

>>>>> Restoring mysql

su zimbra source ~/bin/zmshutil ; zmsetvars

for db in `cat /backup/mysql.db.list |grep mbox` do

   mysql -u root --password=$mysql_root_password -e "drop database $db"
   echo -e "Dropped $db"

done

mysql -u root --password=$mysql_root_password -e "drop database zimbra"

for db in `cat /backup/mysql.db.list` do

   mysql -e "create database $db character set utf8"
   echo "Created $db"

done mysql zimbra < /backup/detail-database/zimbra.sql for sql in /backup/detail-database/mbox* do

   mysql `basename $sql .sql` < $sql
   echo -e "Updated `basename $sql .sql` \n"

done exit

mkdir index cp -rp /backup/index/* /opt/zimbra/index/ zmcontrol start

Jump to: navigation, search