Skip to end of metadata
Go to start of metadata

This article describes how to change the distribution BlueMind works on. It can be used to update the distribution (Ubuntu 12.04 to Ubuntu 14.04 for instance).

This procedure is based on installing a target system to which the data is migrated. This new system will then replace the original one at the network level.

Prerequisites

  • install BlueMind on the target system in an identical version to the original system and configured with the same external-url. The Setup Wizard must have been run on the target server. E.g.:
    • if the original system uses BlueMind 3.5.12-2, the target system must have BlueMind 3.5.12-2 installed
    • if the original external-url is bluemind.domain.tld, the target system's BlueMind must be configured with the external-url bluemind.domain.tld
  • the target system's root user must be able to authenticate as root on the original server, ideally using key authentication.
  • the rsync utility must be installed on both systems.

Migration

Data migration is done in three steps to minimize service downtime:

  • hot synchronization of server data to the target server - this is a time-consuming operation but does not cause service interruption
  • cold synchronization - quick operation but causes service interruption
  • switching servers

Hot synchronization

Allows you to make an initial copy of data without interrupting the service:

  1. connect to the target server as root
  2. stop services on the target servers:

    # bmctl stop
    # service postfix stop
  3. synchronize BlueMind data using the rsync utility:

    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/cyrus/ /var/spool/cyrus/
    # rsync -avH --delete root@origsrv.domain.tld:/var/lib/cyrus/ /var/lib/cyrus/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-hsm/ /var/spool/bm-hsm/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/sieve/ /var/spool/sieve/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-elasticsearch/ /var/spool/bm-elasticsearch/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-docs/ /var/spool/bm-docs/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-filehosting/ /var/spool/bm-filehosting/

These operations can be interrupted and/or performed several times.

Note: The shorter the time between hot synchronization and cold synchronization, the faster cold synchronization will be.

Cold synchronization

  1. Stop services on the servers (original and target):

    # bmctl stop
    # service postfix stop
  2. In the target server, synchronize the data again:

    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/cyrus/ /var/spool/cyrus/
    # rsync -avH --delete root@origsrv.domain.tld:/var/lib/cyrus/ /var/lib/cyrus/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-hsm/ /var/spool/bm-hsm/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/sieve/ /var/spool/sieve/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-elasticsearch/ /var/spool/bm-elasticsearch/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-docs/ /var/spool/bm-docs/
    # rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-filehosting/ /var/spool/bm-filehosting/
  3. In the target server, do a database dump for the original server data:

    # ssh root@origsrv.domain.tld "PGPASSWORD=bj pg_dump -U bj -h localhost bj" > /tmp/db.sql
  4. In the target server, copy the original server's files to the target server:

    # scp -r root@origsrv.domain.tld:/etc/bm/* /etc/bm
    # scp root@origsrv.domain.tld:/etc/bm/bm.ini /etc/bm/bm.ini
    # scp -r root@origsrv.domain.tld:/etc/bm-hps/* /etc/bm-hps
    
    # scp root@origsrv.domain.tld:/etc/ssl/certs/bm_cert.pem /etc/ssl/certs/bm_cert.pem
    
    # scp -r root@origsrv.domain.tld:/var/lib/bm-ca/* /var/lib/bm-ca
    
    # scp root@origsrv.domain.tld:/etc/bm/mcast.id /etc/bm/mcast.id
    # scp root@origsrv.domain.tld:/usr/share/bm-elasticsearch/config/elasticsearch.yml /usr/share/bm-elasticsearch/config/elasticsearch.yml
    
    # scp root@origsrv.domain.tld:/etc/imapd* /etc/
    # scp root@origsrv.domain.tld:/etc/cyrus* /etc/
    
    # scp root@origsrv.domain.tld:/etc/postfix/main.cf /etc/postfix/main.cf
    # scp root@origsrv.domain.tld:/etc/postfix/master.cf /etc/postfix/master.cf
    # scp root@origsrv.domain.tld:/etc/postfix/master_relay_transport-flat /etc/postfix/master_relay_transport-flat
    # scp root@origsrv.domain.tld:/etc/postfix/master_relay_transport.db /etc/postfix/master_relay_transport.db
    # scp root@origsrv.domain.tld:/etc/postfix/transport-flat /etc/postfix/transport-flat
    # scp root@origsrv.domain.tld:/etc/postfix/transport.db /etc/postfix/transport.db
    # scp root@origsrv.domain.tld:/etc/postfix/virtual_alias-flat /etc/postfix/virtual_alias-flat
    # scp root@origsrv.domain.tld:/etc/postfix/virtual_alias.db /etc/postfix/virtual_alias.db
    # scp root@origsrv.domain.tld:/etc/postfix/virtual_domains-flat /etc/postfix/virtual_domains-flat
    # scp root@origsrv.domain.tld:/etc/postfix/virtual_domains.db /etc/postfix/virtual_domains.db
    # scp root@origsrv.domain.tld:/etc/postfix/virtual_mailbox-flat /etc/postfix/virtual_mailbox-flat
    # scp root@origsrv.domain.tld:/etc/postfix/virtual_mailbox.db /etc/postfix/virtual_mailbox.db
  5. Import the database into the target server:

    # su - postgres
    $ dropdb bj
    $ createdb bj
    $ exit
    # PGPASSWORD=bj cat /tmp/db.sql | psql -U bj -h localhost bj

Switching servers

  1. Stop the original server
  2. Reconfigure the target server with the original server's IP address
  3. Restart the target server and connect to the network instead of the original server so that it can be reached instead of the original server

Post-migration

Connect to the BlueMind Administration console as admin0@global.virt and:

  • Go to the section Security > Firewall and immediately click "Save" to force the BlueMind firewall's rules regeneration
  • Go to System Management > Mail Maintenance, click "Run" to regenerate the mail postfix routing tables
  • Go to System Management > System Configuration and replace the old IP address in the "My Networks" field by the new address or the address range for which you want the relay open and click "Save"
  • No labels