Difference between revisions of "Backups"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
m
Line 40: Line 40:
 
With Mysql, the command to backup your database into a file is :
 
With Mysql, the command to backup your database into a file is :
 
<source lang="bash">
 
<source lang="bash">
mysqldump -u user -pyourpass --result-file=dolibarr.version.date.sql base_de_données
+
mysqldump -u user -pyourpass --result-file=dolibarr.version.date.sql databasename
 
</source>
 
</source>
 
{{ToTranslate}}
 
{{ToTranslate}}
where ''user'' is MySQL user that Dolibarr use to connect to database, ''yourpass'' is password of MySQL account user (warning, no space between the p and yourpass), ''date'' is the date you can add into output file name (ça vous aidera à vous y retrouver, plus tard, si vous avez plusieurs versions de sauvegardes), et ''base de données'' est le nom de la base de données que Dolibarr utilise.
+
where ''user'' is MySQL user that Dolibarr use to connect to database, ''yourpass'' is password of MySQL account user (warning, no space between the p and yourpass), ''date'' is the date you can add into output file name (this will help you to find later a backup file if you have a lot of backups), and ''databasename'' is the name of Dolibarr database.
Ces informations (utilisateur, mot de passe et base de données) sont disponibles dans votre fichier de configuration ''dolibarr/htdocs/conf/conf.php''
+
Thoose informations (user, password and database) are available into your configuration file ''dolibarrdir/htdocs/conf/conf.php''
  
 
== The documents ==
 
== The documents ==

Revision as of 15:28, 26 August 2009

There is several reason why it is important to "backup" a complete instance of Dolibarr. For example:

  • Because you plan to make an upgrade and want to do a go back to previous version if it fails.
  • Because you want to move Dolibarr from one server to another server.
  • And of course, to be able to make a restore to be safe if something bad happens (crash disk, hack corruption, ...)

For all this reasons, it is recommended to make backup of all data used and saved by Dolibarr.

What to save ?

Dolibarr save its data in 3 different spaces. They all must be saved before each version upgrade to be sure to be able to get back its data if a problem occurs or if you want to go back on previous version. This is the 3 kind of data you need to save to be sure to loose nothing.

The configuration file

The configuration file should not be modified by upgrade process, but it is more prudent to save it also when you do an upgrade. The configuration file is called conf.php and you can find it into directory dolibarrdir/htdocs/conf/. Make a copy of this file into the dedicated area of your backup. This backup is however optional as you can still rebuild this file if you know all your connexion id (this file contains only parameters to connect to database and directory where you Dolibarr is installed). When making a restore, it is still possible to rebuild this file by an installation from scratch.

The database

The database contains all data you have added from Dolibarr screens (except the attached files that are presented in next chapter). Saving the database must be done in a global way (all content). See the chapter "How" later in this document.

Documents

All documents related to your Dolibarr instance are saved into directory defined into your config file dolibarrdir/htdocs/conf/conf.php. If you kept the choice by default during first installation, it should be something like dolibarrdir/documents. This directory must be completely saved. When making an upgrade, the upgrade process should not change this directory, however this directory can be read and write by web server at any time, it might be altered by a bad action or a bug. To be sure to keep all your joined files and be able to restore them if they are accidentally deleted or altered, just make a copy of all content of this directory.

When ?

Frequency of backups depends on how often you use Dolibarr and what you accept to loose if something happens. More the frequency is important, less you will loose data if need to erase you software with a backup.

How ?

The configuration file

A simple copy of file conf/conf.php into a directory dedicated to your backup is enough.

The database

If you use a recent version of Dolibarr, connect with Dolibarr administrator account. Then go to Home -> System tools -> Backups. Choose options for your backup (if possible, keep all default values).

If you prefer a manual mode, you can also use your own database admin tools. With Mysql, the command to backup your database into a file is :

mysqldump -u user -pyourpass --result-file=dolibarr.version.date.sql databasename

En verysmall.png Page waiting for translation. To translate, create an account, go back and clic on "Modify".
Fr verysmall.png Page en attente de traduction. Pour traduire, créez un compte, revenez et cliquez sur "Modifier".
Es verysmall.png Página a traducir. Para traducirla, cree una cuenta, vuelva a la página y haga clic en "editar".
It verysmall.png Pagina da tradurre. Per tradurla, crea un utente, torna indietro e clicca su "modifica".
Pt verysmall.png Página a aguardar por tradução. Para traduzir, crie uma conta, volte atrás e clique em "Modificar".
De verysmall.png Seite wartet auf Übersetzung. Um Übersetzung zu erstellen, richte einen Account ein, geh zurück und klicke auf "bearbeiten".
Zh verysmall.png 页面等待翻译。若要翻译本页,先创建一个帐户、登录并返回本页后单击“编辑”。

where user is MySQL user that Dolibarr use to connect to database, yourpass is password of MySQL account user (warning, no space between the p and yourpass), date is the date you can add into output file name (this will help you to find later a backup file if you have a lot of backups), and databasename is the name of Dolibarr database. Thoose informations (user, password and database) are available into your configuration file dolibarrdir/htdocs/conf/conf.php

The documents

Une copie du répertoire des documents (dolibarr/documents par défaut) dans un répertoire de sauvegarde dédié suffit. Si vous avez réalisez la sauvegarde de la base via l'outil système de Dolibarr, le fichier dump base de donnée se trouve également inclus dans cette copie.

Restore

This topic is axplained into page Restores