King0770-Notes-YAMM: Difference between revisions
Line 35: | Line 35: | ||
===Install ZCS onto the new machine=== | ===Install ZCS onto the new machine=== | ||
<code><pre> ./install </pre></code> | <code><pre> <zcs_install_directory>./install.sh </pre></code> | ||
Make sure to install the same ZCS packages. | Make sure to install the same ZCS packages. |
Revision as of 19:54, 21 July 2010
YAMM = Yet Another Migration Method
Summary of steps
- Export ldap and mysql data from the production server
- Prepare the new server
- Import ldap and mysql data into the new server
Section I - Export ldap and mysql data from the production machine
It might help to create a directory to store the exported data.
mkdir /tmp/migration
Export LDAP
~/libexec/zmslapcat /tmp/migration
Export MYSQL
source ~/bin/zmshutil; zmsetvars
~/mysql/bin/mysqldump -u root --password=$mysql_root_password --socket=$mysql_socket --all-databases --single-transaction >> /tmp/migration/mysqlinfo.sql
mysql --batch --skip-column-names -e "show databases" | grep -e mbox -e zimbra > /tmp/migration/mysql.db.list
Section II - Prepare the new server
Highly recommend that the new machine use the same ZCS version as the production machine.
Install ZCS onto the new machine
<zcs_install_directory>./install.sh
Make sure to install the same ZCS packages.
After the install, make sure you use the same ldap and mysql passwords from the production machine. To view the passwords from the production machine, run the following command:
zmlocalconfig -s | grep pass | grep -e ldap -e mysql
Use the following tools on the new machine to change the ldap & mysql passwords:
zmldappasswd
zmmypasswd
**After the password changes, restart ZCS services on the new machine.**
Don't forget to install the same zimlets, and don't forget your custom changes.
Section III - Import ldap and mysql data into the new server=
Copy the ldap & mysql data from the production server
rsync -av -e ssh root@production.domain.com:/tmp/migtration /tmp/
Drop mysql DB's
source ~/bin/zmshutil; zmsetvars
for db in `mysql --batch --skip-column-names -e "show databases" | grep -e ^mbox -e zimbra`; do mysql -u root --password=$mysql_root_password -e \
"drop database $db"; echo -e "Dropped $db"; done
Create the necessary DB's
for db in `cat /tmp/migration/mysql.db.list`; do mysql -e "create database $db character set utf8"; echo "created $db"; done
Import production mysql data into the new machine
mysql < /tmp/migration/mysqlinfo.sql
Import ldap data from the new machine
ldap stop
cd /opt/zimbra/data/ldap
mv hdb OLD.hdb
mkdir -p hdb/db; mkdir hdb/logs
~/openldap/sbin/slapadd -q -b "" -F /opt/zimbra/data/ldap/config -cv -l /tmp/migration/ldap.bak
**Most likely, you will need to edit the ldap.bak file and replace the production server name with the new server name**
Copy store and index files from the production machine to the new machine
rm -rf /opt/zimbra/store/*
rsync -av -e ssh root@production.domain.com:/opt/zimbra/store/ /opt/zimbra/store/
rsync -av -e ssh root@production.domain.com:/opt/zimbra/index/ /opt/zimbra/index/