Difference between revisions of "Backup system"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(27 intermediate revisions by 7 users not shown)
Line 1: Line 1:
''This functionality is available from [[MOR v0.8 documentation | MOR 8]]''.
=Description=
 
<!---This functionality is available from MOR 8--->
The backup system backs up the MOR database and allows it to be restored at any time.
The backup system backs up the MOR database and allows it to be restored at any time. This functionality is available just for System Admin.
 
The backup system can be configured in Settings:
 
[[Image:backups1.png]]


Backup includes all database with all CDR, Invoices, Users, Providers. etc.
<br><br>
=Configuration=


Go to '''SETTINGS –> Setup –> Settings'''
<br><br>
[[File:Settings_path.png]]
<br><br>
Click on '''Backups''' tab and here you can configure settings of Backups.
<br><br>
[[File:Backups2.jpg]]
<br><br>
If '''Run Backup according below schedule''' is checked, the following settings become active:
If '''Run Backup according below schedule''' is checked, the following settings become active:
 
* '''Exclude Archived Calls table''' – archived calls will not be present in the backup (calls_old table will be ignored).
* '''Store Backups on FTP server''' - stores Backups on FTP server. Please fill FTP server details at [http://wiki.kolmisoft.com/index.php/Configuration_from_GUI#FTP FTP] tab.
* '''Month''' – in which month backup should be made.
* '''Month''' – in which month backup should be made.
* '''Day of every month''' – which day of every month backup should be made.
* '''Day of every month''' – which day of every month backup should be made.
* '''Day of week''' – which day of the week backup should be made.
* '''Day of week''' – which day of the week backup should be made.
* '''Hour''' – which hour backup should be made.
* '''Hour''' – which hour backup should be made.
* '''Keep on local server'' – how many backups to keep on the server. The system deletes the oldest one if the limit is reached.
 
So to make automatic backups at first day of Month at midnight, you would set '''Month''' to Every month, '''Day of every month'''  to 1, '''Day of week''' to Every day and '''Hour''' to 24.
 
* '''Keep on local server''' – how many backups to keep on the server. The system deletes the oldest one if the limit is reached.
* '''Don't start backup if disk space less than''' – checks disk space before making an auto backup.
* '''Don't start backup if disk space less than''' – checks disk space before making an auto backup.


You can find '''Backups''' folder on server by path: '''/usr/local/mor/backups'''. Archived DB Backups are named as '''db_dump_DateTime.sql.bz2'''. You can also find another configuration/Asterisk/GUI/etc files backup folders as well.
<br><br>
== Manual Database Backup ==
1. Connect via ssh to your server.
2. Make database backup:
mysqldump mor >/path/to/file/db_backup.sql
Or with Username and Password if needed:
mysqldump mor -u '''DATABASEUSER''' -p'''DATABASEPASSWORD''' >/path/to/file/db_backup.sql
'''Note:'''
Database User: ''root''
Database Password: ''kolmisoft''
<br><br>
If you use MNP addon, don't forget to make MNP backup:
mysqldump mor_mnp >/path/to/file/mor_mnp_backup.sql
Or with Username and Password if needed:
mysqldump mor_mnp -u '''DATABASEUSER''' -p'''DATABASEPASSWORD''' >/path/to/file/mor_mnp_backup.sql
Please check MySQL documentation for more information.
<br><br>
=Usage=
Go to '''Settings –> Backups'''
<br><br>
[[Image:backups_path.png]]
<br><br>
Here you can see list of all Backups:
<br><br>
[[Image:backups_list.png]]
<br><br>
You can download the backup by clicking the '''Download''' icon or restore the backup by clicking the '''Restore''' icon. When Scheduler (which runs every hour) makes an auto backup, it is seen as type = '''auto''' in the backups list. Click [[Image:icon_add.png]]'''New Backup''' to create a new Manual Backup. Enter any comment and click on '''Create'''
Backups are stored in the /usr/local/mor/backups on the GUI server.
<br><br>
== Restore Backup from other server ==
1. Connect via ssh to your server.
2. Import database Backup:
mysql mor </path/to/file/db.sql
Or with Username and Password if needed:
mysql -u '''DATABASEUSER''' -p'''DATABASEPASSWORD''' mor </path/to/file/db.sql
'''Note:'''
Database User: ''root''
Database Password: ''kolmisoft''
<br><br>
3. Update scripts:


rm -fr /usr/src/mor
svn co http://svn.kolmisoft.com/mor/install_script/trunk/ /usr/src/mor


Now in '''Settings - Backups''', we can click '''New Backup''' to create a new Manual Backup:
4. Update database.


[[Image:backups2.png]]
Your DB version must be the same as GUI.


To check GUI version type this command:


svn info /home/mor | grep URL | awk -F"/" '{print $NF}'


Enter any comment and click on '''Create''' to create the Manual Backup:
Database update must be done gradually, updating each version separately, from Backup version, till the version you need.


[[Image:backups3.png]]
Available MOR versions: MOR 8, MOR 9, MOR 10, MOR 11, MOR 12, MOR X3, MOR X4, MOR X5, MOR X6, MOR X7.


Update database using script:
/usr/src/mor/db/'''MOR_Version'''/import_changes.sh


'''Note:'''


You can download the backup by clicking the '''Download''' icon or restore the backup by clicking the '''Restore''' icon:
Use ''/usr/src/mor/db/12.126/import_changes.sh'' to update database for '''MOR 12'''.


[[Image:backups4.png]]
Use ''/usr/src/mor/db/12/import_changes.sh'' to update database for '''MOR X3'''.


Use ''/usr/src/mor/db/x4/import_changes.sh'' to update database for '''MOR X4'''.


Use ''/usr/src/mor/x5/db/db_update.sh LATEST'' to update database for '''MOR X5'''


When scheduler (which runs every hour) makes an auto backup, it is seen as type = '''auto''' in the backups list:
Use ''/usr/src/mor/x6/update.sh'' to update database for '''MOR X6'''.


[[Image:backups5.png]]
Use ''/usr/src/mor/x7/update.sh'' to update database for '''MOR X7'''.


Use ''/usr/src/mor/x8/update.sh'' to update database for '''MOR X8'''.


Use ''/usr/src/mor/x9/update.sh'' to update database for '''MOR X9'''.
<br><br>
<br><br>
For example, you have MOR X8 but you decided to restore backup from MOR X4. You have to run these scripts:
/usr/src/mor/x5/db/db_update.sh
/usr/src/mor/x6/update.sh
/usr/src/mor/x7/update.sh
/usr/src/mor/x8/update.sh
5. Import Asterisk changes to database using this script:
/usr/src/mor/sh_scripts/asterisk/db/import_changes.sh
<br><br>
== If the server completely dies will the restore be enough to return everything as it was, or are there some other files we should be backing up? ==
The Backup file contains only Database archived dump. Separate configuration/Asterisk/GUI/audio files/etc are not included in this Backup file. You should take care of them separately.
<br><br>
= See also =
= See also =
* [[I have a problem with Backups]]
* [[I have a problem with Backups]]

Latest revision as of 14:40, 30 August 2023

Description

The backup system backs up the MOR database and allows it to be restored at any time. This functionality is available just for System Admin.

Backup includes all database with all CDR, Invoices, Users, Providers. etc.

Configuration

Go to SETTINGS –> Setup –> Settings

Settings path.png

Click on Backups tab and here you can configure settings of Backups.

Backups2.jpg

If Run Backup according below schedule is checked, the following settings become active:

  • Exclude Archived Calls table – archived calls will not be present in the backup (calls_old table will be ignored).
  • Store Backups on FTP server - stores Backups on FTP server. Please fill FTP server details at FTP tab.
  • Month – in which month backup should be made.
  • Day of every month – which day of every month backup should be made.
  • Day of week – which day of the week backup should be made.
  • Hour – which hour backup should be made.

So to make automatic backups at first day of Month at midnight, you would set Month to Every month, Day of every month to 1, Day of week to Every day and Hour to 24.

  • Keep on local server – how many backups to keep on the server. The system deletes the oldest one if the limit is reached.
  • Don't start backup if disk space less than – checks disk space before making an auto backup.

You can find Backups folder on server by path: /usr/local/mor/backups. Archived DB Backups are named as db_dump_DateTime.sql.bz2. You can also find another configuration/Asterisk/GUI/etc files backup folders as well.

Manual Database Backup

1. Connect via ssh to your server.

2. Make database backup:

mysqldump mor >/path/to/file/db_backup.sql

Or with Username and Password if needed:

mysqldump mor -u DATABASEUSER -pDATABASEPASSWORD >/path/to/file/db_backup.sql

Note:

Database User: root

Database Password: kolmisoft

If you use MNP addon, don't forget to make MNP backup:

mysqldump mor_mnp >/path/to/file/mor_mnp_backup.sql

Or with Username and Password if needed:

mysqldump mor_mnp -u DATABASEUSER -pDATABASEPASSWORD >/path/to/file/mor_mnp_backup.sql

Please check MySQL documentation for more information.

Usage

Go to Settings –> Backups

Backups path.png

Here you can see list of all Backups:

Backups list.png

You can download the backup by clicking the Download icon or restore the backup by clicking the Restore icon. When Scheduler (which runs every hour) makes an auto backup, it is seen as type = auto in the backups list. Click Icon add.pngNew Backup to create a new Manual Backup. Enter any comment and click on Create

Backups are stored in the /usr/local/mor/backups on the GUI server.



Restore Backup from other server

1. Connect via ssh to your server.

2. Import database Backup:

mysql mor </path/to/file/db.sql

Or with Username and Password if needed:

mysql -u DATABASEUSER -pDATABASEPASSWORD mor </path/to/file/db.sql

Note:

Database User: root

Database Password: kolmisoft

3. Update scripts:

rm -fr /usr/src/mor
svn co http://svn.kolmisoft.com/mor/install_script/trunk/ /usr/src/mor

4. Update database.

Your DB version must be the same as GUI.

To check GUI version type this command:

svn info /home/mor | grep URL | awk -F"/" '{print $NF}'

Database update must be done gradually, updating each version separately, from Backup version, till the version you need.

Available MOR versions: MOR 8, MOR 9, MOR 10, MOR 11, MOR 12, MOR X3, MOR X4, MOR X5, MOR X6, MOR X7.

Update database using script:

/usr/src/mor/db/MOR_Version/import_changes.sh

Note:

Use /usr/src/mor/db/12.126/import_changes.sh to update database for MOR 12.

Use /usr/src/mor/db/12/import_changes.sh to update database for MOR X3.

Use /usr/src/mor/db/x4/import_changes.sh to update database for MOR X4.

Use /usr/src/mor/x5/db/db_update.sh LATEST to update database for MOR X5

Use /usr/src/mor/x6/update.sh to update database for MOR X6.

Use /usr/src/mor/x7/update.sh to update database for MOR X7.

Use /usr/src/mor/x8/update.sh to update database for MOR X8.

Use /usr/src/mor/x9/update.sh to update database for MOR X9.

For example, you have MOR X8 but you decided to restore backup from MOR X4. You have to run these scripts:

/usr/src/mor/x5/db/db_update.sh
/usr/src/mor/x6/update.sh
/usr/src/mor/x7/update.sh
/usr/src/mor/x8/update.sh

5. Import Asterisk changes to database using this script:

/usr/src/mor/sh_scripts/asterisk/db/import_changes.sh



If the server completely dies will the restore be enough to return everything as it was, or are there some other files we should be backing up?

The Backup file contains only Database archived dump. Separate configuration/Asterisk/GUI/audio files/etc are not included in this Backup file. You should take care of them separately.



See also