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
isbluemind.domain.tld
, the BlueMind on the target system must be configured withbluemind.domain.tld
as theexternal-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.
- if the original
- The
root
user on the target server must be able to authenticate asroot
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:
- Hot synchronization of data from the source server to the target server - time-consuming operation, but does not cause downtime
- Cold synchronization - fast operation, but causes a service interruption
- Replacing Servers
Hot synchronization
This synchronization allows you to make the initial copy of data without interruption of the service.
To do so:
-
Connect as
root
on the target server:su -
-
Stop services on it:
bmctl stop
systemctl stop postfix.service -
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.
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
-
Stop services on original and target servers:
bmctl stop
systemctl stop postfix.service -
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/ -
From the target server, restart the PostgreSQL of the original server:
ssh root@origsrv.domain.tld "systemctl start postgresql.service"
-
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 -
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 -
From the target server, restart PostgreSQL:
systemctl start postgresql.service
-
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
- Stop the original server
- Reconfigure target server to assign IP address of original server
- 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:
- Go to the section Security > Firewall and immediately click "Save" to force the BlueMind firewall's rules regeneration
- Go to System Management > Manage messaging system, 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"
- Start reconfiguration of bm-tick monitoring tool :
bm-cli tick reconfigure