Restoration of merce backup on newly installed merce

RESTORATION OF BACKUP ON A NEW SETUP OF MTRACKS AND CONVERSION OF SAME INTO MASTER FOR A MULTI
LOCATION SETUP.


This is described for the case when backup of an existing master server of merce was taken from
NFL Noida to the gatekeeper. After carrying out this process a new hdd was setup where in
Mtracks was setup.

The requirement was to restore the merce master as it was earlier. The steps followed were as
follows :

  1. Let us say that the mtracks machine which was a merce master has IP 1.2.3.4 and the
    machine on which backup was taken has IP 5.6.7.8 in the directory
    /var/warehourse/mercebackup/ of the directories described in described at
    Backup of merce
  2. In /var/tmp create 2 folders
    • mtracks_noida - this will contain all the files of 1.2.3.4 mtracks setup which
      will be replaced by the backup files of the earlier merce server
    • backup_merce - this will contain all the files that had to be scp from 5.6.7.8
      where backup was taken.
  3. Shutdown sendmail, sendmail-rx, apache, cyrus, xinetd
  4. Restore the database of the earlier backup
    • mysqldump -u root -p merce > /var/tmp/mtracks_noida/mtracks_noida.sql
    • Provide the password for mysql admin user root as per
      /etc/merce/passwords.txt
    • mysqldump -u root -p merce
    • Login as per the password described above
    • drop database merce;
    • Copy the database dump whose backup was taken at 5.6.7.8 in
      /var/tmp/backup_merce/backup_merce.sql
    • mysql -u root -p merce < /var/tmp/backup_merce/backup_merce.sql
    • Provide the password
    • mysql -u root -p merce
    • Login and execute "show tables;"
    • select * from user;
    • This will show the details for the various users whose backup was taken.
  5. Generate the qfiles for creating user mailboxes.
    • As described in step 1. cyrus has been stopped. Start cyrus
    • /etc/init.d/cyrus start
    • As a merce user execute qfilegen.pl - as described in the
      Generate qfiles HOWTO
    • If all the qfiles put in pending are transferred to done then the mailboxes have
      been successfully created. If they go in bad then follow the remedial steps as per
      Generate qfiles HOWTO
  6. Restore the /var/spool/imap/user and /var/lib/imap/user from backup to the mtracks
    machine.
    • on 1.2.3.4 take backup of existing /var/spool/imap/user
    • tar -cvpf mtracks_user_spool.tar /var/spool/imap/user. Copy the tar to /var/tmp/mtracks_backup
    • on 1.2.3.4 take backup of existing /var/lib/imap/user
    • tar -cvpf mtracks_user_lib.tar /var/lib/imap/user. Copy the tar to /var/tmp/mtracks_backup
    • As per the backup procedure described at
      Backup of Merce take the bakcup via xbackup from 5.6.7.8
      /var/warehouse/mercebackup/var/spool/imap/user to 1.2.3.4 /var/spool/imap user and similarly for /var/lib/imap/user and /var/spool/uucp
  7. Once all the mailboxes have been restored reconstruct the mailboxes of the users.
    • cd /usr/lib/cyrus/bin
    • su cyrus
    • ./reconstruct -r user
    • exit
  8. After all the mailboxes have been reconstructed telnet on imap port to check the a
    particular users mail
    • telnet localhost imap
    • . login
      (Note the "." at the beginning of the
      command. An intranet id and password can be obtained from /opt/merce/update/done)
    • 1 list "Mail" *
    • 2 select inbox
    • If the inbox is selected then the reconstruction is proper
    • exit
  9. Conversion of mtracks -> Merce Master. During this process remember that you already
    have the merce.mc and merce-rx.mc present in your backup.
    • Modification of Netconfig.pm and SiteConfig.sh should be the same as of the
      backup merce files because eventually we are replicating the mail system. But
      "DO NOT COPY PASTE THE Netconfig.pm and SiteConfig.sh" from backup to the existing
      system because the passwords for mysql administration, ldap user, etc. would be
      different. If required take a print out of the backup pm and sh files and then
      manually carry out the changes.
    • As for sendmail.cf and sendmail-rx.cf :
      • Scp /var/warehouse/mercebackup/etc/mail/merce.mc and
        /var/warehouse/mercebackup/etc/sendmail.cf from 5.6.7.8 to 1.2.3.4's
        /var/tmp/sendmail_tmp.cf and /var/tmp/merce_tmp.cf respectively
      • On 1.2.3.4 vimdiff /var/tmp/merce_tmp.cf /etc/mail/merce.mc
      • These are the changes that must be made to /etc/merce.mc to restore
        old configuration except for the manual changes to sendmail.cf
      • Make these changes to /etc/mail/merce.mc on 1.2.3.4
      • On 1.2.3.4 from merce.mc generate sendmail_tmp.cf in /var/tmp
      • m4 /usr/share/sendmail/m4/cf.m4 /etc/mail/merce.mc >
        /var/tmp/sendmail_tmp.cf
      • vimdiff /var/tmp/sendmail_tmp.cf /etc/sendmail.cf
      • The differences are the manual changes that are required to be made
        to sendmail.cf after generation from merce.mc
      • Similary carry out the changes in /etc/mail/merce-rx.mc and /etc/mail/sendmail-rx.mc
      • Restore /etc/mail/mailertable from 5.6.7.8 to 1.2.3.4
  10. Restart sendmail, sendmail-rx and check the telnet on port no. 25, 10024, 10025. If
    connection is refused on 25 restart sendmail-rx, refusal on 10024 restart amavis,refusal on
    10025 restart sendmail. Check telnet connectivity on these ports once again.
  11. Setup apache.
    • On 1.2.3.4 take the backup of the existing /etc/apache2/ directory
    • tar -cvfp mtracks_apache.tar /etc/apache2
    • mv mtracks_apache.tar /var/tmp/mtracks_noida
    • On 5.6.7.8 tar -cvpf backup_apache2.tar /var/warehouse/mercebackup/etc/apache2
    • scp backup_apache2.tar at 1.2.3.4 /var/tmp/backup_merce/
    • On 1.2.3.4 cd /etc/
    • rm -r apache2 (Remember that backup has been taken. Untar the backup in a tmp
      directory to ensure the structure is the same before deleting apache2 directory)
    • cp /var/tmp/backup_merce/backup_apache2.tar /etc/
    • tar -xvpf /etc/backup_apache2.tar
    • Follow the same procedure to restore /var/warehouse/mercebackup/etc/named.conf
      and /var/warehouse/mercebackup/etc/resolve.conf
    • restart apache and named
    • Check for access to the internet. In one window execute the command : tail -f
      /opt/merce/apache/log/access. And in another window check for net accses.There are 3 ways of carrying out the same:
      1. http_proxy=:8080 lynx http://google.com
      2. Method 2
        • telnet 8080
        • GET http://www.google.com http/1.0
        • This should display html source of the page requested
      3. curl -P -U http://www.google.com. This will prompt
        for password. The username and passsword can be obtained from a file is
        /opt/merce/update/done.
  12. Setup uucp as per the documentation created by Vaibhav. Restart xinted.
  13. Setup smtp auth as per the documentation created by Vaibhav.
  14. Once all the services have been configured cyrus, named, sendmail, sendmail-rx, uucp, smtp
    auth carry out the following checks
    • local mail flow - telnet to localhost at port 25 and send mail to localuser.
    • external outgoing mail flow - telnet to localhost at prot 25 and send mail to external
      domain
    • external incoming mail flow - mail from external domain to local user
    • Mail from Merce master to all the slaves. For an email id on each slave
      location (can be obtained by looking up to the /etc/aliases file) send mail from
      master and trace the same
    • Mail flow from one slave to another via master.
  15. Remember to take the backup of each and every file or directory that is going to be
    replaced. At the end of this process you have 2 directories - /var/tmp/mtracks_noida
    containing the files replaced by the backup files and /var/tmp/backup_merce containing the
    files copied from the backup machine to the main machine.