# Configuring the backup jobs

The configuration of the backups is done in an .ini file, by default `/etc/tis/tisbackup-config.ini`:

- a global section where general parameters are specified;

- then for each backup a section will be created;

## [global] section

Here are the mandatory parameters of the global section.

- the beginning of the global section starts with:

      [global]

- specify directory where to store backups:

      backup_base_dir = /backup/data/

- define the maximum age of the backups (variable used by the cleanup function):

      backup_retention_time=140

- define the maximum time in hours between each backup. When this time is exceeded, then checknagios goes critical:

      maximum_backup_age=30

Another non-mandatory parameter allows to define the rsync compression level: `compression_level=7`.

## Backup types

Note

to test with a Windows box

Globally, the backups are done through an SSH connection and the steps are:

- creating the section in the configuration file;

- installing ssh on the Linux client;

- making an ssh key exchange between the tisbackup server and the client to back up;

Here are the different types of backup possible with tisbackup.

### Backing up a MySQL database

    [srvintranet_mysql_mediawiki]
    type=mysql+ssh
    server_name=srvintranet
    private_key=/root/.ssh/id_dsa
    db_name=mediawiki
    db_user=user
    db_passwd=password

Mandatory parameters:

- `[srvintranet_mysql_mediawiki]`: name of the section starts with the name you give to it;

- `type`: specifies the backup type for the Mysql database dump;

- `server_name`: defines the server to be backed up by its DNS name or IP address;

- `private_key`: defines the name of the private key to be used to connect to the client;

- `db_name`: defines the name of the database to dump;

- `db_user`: defines the name of a user with the right to dump on the basis of;

- `db_passwd`: defines the user’s password;

### Backing up a PostgreSQL database

    [srvasterisk-pgsql]
    type=pgsql+ssh
    server_name=srvasterisk
    private_key=/root/.ssh/id_rsa
    db_name=asterisk

Mandatory parameters:

- `[srvasterisk-pgsql]`: name of the section starts with the name you give to it;

- `type`: specifies the backup type for the Mysql database dump;

- `server_name`: defines the server to be backed up by its DNS name or IP address;

- `private_key`: defines the name of the private key to be used to connect to the client;

- `db_name`: defines the name of the database to dump;

### Backing up a file server

    [srvfiles-home]
    type=rsync+ssh
    server_name=srvfiles
    remote_dir=/home
    private_key=/root/.ssh/id_dsa
    exclude_list=".mozilla",".thunderbird",".x2go","*.avi"
    bwlimit = 100

Mandatory parameters:

- `[srvfiles-home]`: name of the section starts with the name you give to it;

- `type`: specifies the backup type for the Mysql database dump;

- `server_name`: defines the server to be backed up by its DNS name or IP address;

- `remote_dir`: defines the folder on the remote host to backup;

- `private_key`: defines the name of the private key to be used to connect to the client;

  Attention

  In case of Windows client, specificities are to be expected:

  By default we use the root user for backups, for windows we will use the Administrator account (pay attention to the sensitive box).

      remote_user=Administrator

  Through cygwin, the directory to be backed up will always start with `/cygdrive`, so it must be specified in the `remote_dir` parameter.

      remote_dir=/cygdrive/c/WINDOWS/

Hint

Other non-mandatory parameters can be used. The `listdrivers` option allows you to see them. The two most frequently used parameters are:

- `exclude_list`: defines the files to be excluded from the backup;

- `bwlimit`: defines the maximum speed of the backup;

### Backing up a XenCenter virtual machine

#### On local storage

    [wsmanage]
    type=xen-xva
    xcphost=srvxen1
    server_name=wsmanage
    password_file=/root/xen_passwd
    backup_retention_time=2
    halt_vm=True
    enable_https=False

Mandatory parameters:

- `[wsmanage]`: name of the section starts with the name you give to it;

- `type`: specifies the backup type for the Mysql database dump;

- `xcphost`: defines the XCP server where the VM is found by its DNS name or IP;

- `server_name`: defines the server to be backed up by its DNS name or IP address;

- `password_file`: defines a file where are stored the user and the password to be used for exporting the .xva file;

- `backup_retention_time`: defines the maximum number of exports for the virtual machine;

- `halt_vm`: True = stop the virtual machine then export, False = snapshot the virtual machine then export the `xva` without stopping the virtual machine;

- `enable_https`: activate or deactivate https protocol for transfer;

#### On remote storage

    [srvads-copy]
    type=copy-vm-xcp
    server_name=srvxen1
    vm_name=srvads
    storage_name=iscsi-sr1
    password_file=/root/xen_passwd
    network_name=test-dcardon
    max_copies=3

Mandatory parameters:

- `[srvads-copy]`: name of the section starts with the name you give to it;

- `type`: specifies the backup type for the Mysql database dump;

- `server_name`: defines the server to be backed up by its DNS name or IP address;

- `vm_name`: defines the virtual machine to be backed up (its name-label in XCP);

- `storage_name`: defines the storage to where to copy the virtual machine (its name-label in XCP);

- `password_file`: defines a file where are stored the user and the password to be used for exporting the .xva file;

- `network_name`: defines the network to which to copy the VM (its name-label in XCP);

- `max_copies`: maximum number of exports for the virtual machine;

#### XenCenter metadata

[srvxen1-metadata] type=xcp-dump-metadata server_name=srvxen1 password_file=/root/xen_passwd

Mandatory parameters:

- `[srvxen1-metadata]`: name of the section starts with the name you give to it;

- `type`: specifies the backup type for the Mysql database dump;

- `server_name`: defines the server to be backed up by its DNS name or IP address;

- `password_file`: defines a file where are stored the user and the password to be used for exporting the .xva file;

Attention

For maximum security put the password file in the root directory with read-write access only for it.

    vi /root/xen_passwd

example of the content of the file:

    user
    password

implementation of restricted rights

    chmod 600 /root/xen_passwd