Backup and recovery

Backup

The backup in beCPG is fully automated via a daemon (program running constantly on the system).

The backup includes:

  • The backup of the search index ;
  • The backup of the data from databases ;
  • The backup of contents and setting data.

The backup order is important and by default guaranteed by beCPG scripts and carried out in this order :

  • 00:00 Statistics update (Cube OLAP)
  • 03:00 Creation of the search index backups
  • 03:30 Creation of the databases backups
  • 04:00 Backups of contents and setting

All data is saved on the data disk /mnt/becpg-data (/dev/sdb) . It is important to back up this disk once a day around 5am using your hypervisor. The rest of this document $BACKUP_DIR corresponds to this backup once recovered on the machine.

Data recovery

The recovery of the system is done while the system is off.

Stop the service

On the beCPG server:

docker-compose stop becpg
docker-compose stop solr

Copy files

On the beCPG server:

mv /var/lib/docker/volumes/inst1_becpg_data/var/lib/docker/volumes/inst1_becpg_data_old
cp $BACKUP_DIR/docker/volumes/inst1_becpg_data/var/lib/docker/volumes /var/lib/docker/volumes/

Using rsync:

rsync -P --exclude 'solr4Backup' --exclude 'lucene-indexes' \
  --exclude 'backup-lucene-indexes' --exclude 'keystore' \
  -r -a --delete -v $BACKUP_DIR/docker/volumes/inst1_becpg_data/_data/ /var/lib/docker/volumes/inst1_becpg_data/_data/

Recovery of MySQL databases

MySQL backups are located under:

$BACKUP_DIR/docker/volumes/inst1_becpg_backups/_data/:

  • becpg-db
  • olap-db

Select the backup you want to restore and unzip the backup.

gunzip db_18_01_17.gz
gunzip becpg_olap_18_01_17.gz

Import old databases to MySQL:

For main database:

echo "DROP DATABASE db;" | docker-compose exec becpg-db mysql -u root -pbecpg
echo "CREATE DATABASE db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" \
| docker-compose exec becpg-db mysql -u root -pbecpg
docker-compose exec becpg-db mysql -d root -pbecpg db <db_18_01_17

For Olap database:

echo "DROP DATABASE becpg_olap;" | docker-compose exec olap-db mysql -u root -pbecpg
echo "CREATE DATABASE becpg_olap DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" \
| docker-compose exec olap-db mysql -u root -pbecpg
ddocker-compose exec olap-db mysql -u root -pbecpg becpg_olap <becpg_olap_18_01_17

Restart the service

cd /opt/becpg-srv-instances/inst1
docker-compose restart

Notes:

It is important to keep a backup of the configured Virtual Machine. This documentation does not cover the recovery or installation of the Virtual Machine.

results matching ""

    No results matching ""