Skip to main content

Changing Distributions

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

This procedure is based on installing a target system to which the data is migrated. This new system will then take the place of the first, at network level.

Prerequisites

  • Install a BlueMind version identical to the original system on the target system: if the original system uses BlueMind 5.0.x, the target system must have BlueMind 5.0.x.
  • Install on the target server all plugins used on the source server (LDAP import, company signatures...)
  • Run the installation wizard (or setup wizard) on the target server.
    • if the original external-url is bluemind.domain.tld, the BlueMind on the target system must be configured with bluemind.domain.tld as the external-url.
    • set up a subscription valid for this OS. In this case, you can reuse the same subscription, with the new server replacing the old one.
  • The root user on the target server must be able to authenticate as root on the origin server, ideally using key authentication.
  • The rsync utility must be installed on both systems.

Data Migration

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

  1. Hot synchronization of data from the source server to the target server - time-consuming operation, but does not cause downtime
  2. Cold synchronization - fast operation, but causes a service interruption
  3. Replacing Servers

Hot synchronization

This synchronization allows you to make the initial copy of data without interruption of the service.

To do so:

  1. Connect as root on the target server: su -

  2. Stop services on it:

    bmctl stop
    systemctl stop postfix.service
  3. Synchronize BlueMind data using the rsync utility:

    rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-hsm/ /var/spool/bm-hsm/
    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.

Synchronization frequency

To minimize downtime during synchronization, It is recommended to perform hot synchronization as often as possible. This allows to limit the volume of data to be transmitted between the two machines.

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

Cold synchronization

  1. Stop services on original and target servers:

    bmctl stop
    systemctl stop postfix.service
  2. From the target server, perform a new data synchronization:

    rsync -avH --delete root@origsrv.domain.tld:/var/spool/cyrus/ /var/spool/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/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. From the target server, restart the PostgreSQL of the original server:

    ssh root@origsrv.domain.tld "systemctl start postgresql.service"
  4. From the target server, perform a database dump of the original server:

    ssh root@origsrv.domain.tld "PGPASSWORD=bj pg_dump --format=c --username=bj --host localhost bj" > /tmp/dump-bj.sql
    ssh root@origsrv.domain.tld "PGPASSWORD=bj pg_dump --format=c --username=bj --host localhost bj-data" > /tmp/dump-bj-data.sql
  5. From the target server, copy the files from the original server:

    rsync -av -r root@origsrv.domain.tld:/etc/bm/\* /etc/bm
    rsync -av root@origsrv.domain.tld:/etc/nginx/sw.htpasswd /etc/nginx/sw.htpasswd
    rsync -av root@origsrv.domain.tld:/etc/ssl/certs/bm_cert*.pem /etc/ssl/certs
    rsync -av -r root@origsrv.domain.tld:/var/lib/bm-ca/\* /var/lib/bm-ca
    rsync -av root@origsrv.domain.tld:/usr/share/bm-elasticsearch/config/elasticsearch.yml /usr/share/bm-elasticsearch/config/elasticsearch.yml
    rsync -av root@origsrv.domain.tld:/etc/postfix/main.cf /etc/postfix/main.cf
    rsync -av root@origsrv.domain.tld:/etc/postfix/master.cf /etc/postfix/master.cf
    rsync -av root@origsrv.domain.tld:/etc/postfix/master_relay_transport-flat /etc/postfix/master_relay_transport-flat
    rsync -av root@origsrv.domain.tld:/etc/postfix/master_relay_transport.db /etc/postfix/master_relay_transport.db
    rsync -av root@origsrv.domain.tld:/etc/postfix/transport-flat /etc/postfix/transport-flat
    rsync -av root@origsrv.domain.tld:/etc/postfix/transport.db /etc/postfix/transport.db
    rsync -av root@origsrv.domain.tld:/etc/postfix/virtual_alias-flat /etc/postfix/virtual_alias-flat
    rsync -av root@origsrv.domain.tld:/etc/postfix/virtual_alias.db /etc/postfix/virtual_alias.db
    rsync -av root@origsrv.domain.tld:/etc/postfix/virtual_domains-flat /etc/postfix/virtual_domains-flat
    rsync -av root@origsrv.domain.tld:/etc/postfix/virtual_domains.db /etc/postfix/virtual_domains.db
    rsync -av root@origsrv.domain.tld:/etc/postfix/virtual_mailbox-flat /etc/postfix/virtual_mailbox-flat
    rsync -av root@origsrv.domain.tld:/etc/postfix/virtual_mailbox.db /etc/postfix/virtual_mailbox.db
  6. From the target server, restart PostgreSQL:

    systemctl start postgresql.service
  7. Re-mount the database on the target server:

    su - postgres
    dropdb bj
    dropdb bj-data
    createdb bj
    createdb bj-data
    export nb_cpu=$(cat /proc/cpuinfo |grep "processor"|wc -l)
    pg_restore -C --jobs=${nb_cpu} -d bj /tmp/dump-bj.sql
    pg_restore -C --jobs=${nb_cpu} -d bj /tmp/dump-bj-data.sql
    exit

Replacing servers

  1. Stop the original server
  2. Reconfigure target server to assign IP address of original server
  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

Log into the BlueMind Administration console as admin0@global.virt and:

  1. Go to the section Security > Firewall and immediately click "Save" to force the BlueMind firewall's rules regeneration
  2. Go to System Management > Manage messaging system, click "Run" to regenerate the mail postfix routing tables
  3. 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"
  4. Start reconfiguration of bm-tick monitoring tool :
    bm-cli tick reconfigure