Codigo Libre

Bacula JP Centos 6

Septiembre 2012

Ing. Jose Paredes

Este Escenario tenemos el servidor de Bacula que es el bacula.capital.acl y el cliente sera oraserv.fcld.

Para esto se requiere tener configurado MYSQL.

Primer Paso :

Instalamos los paquetes:

[root@nixon ~]# yum -y install bacula-director-mysql bacula-storage-mysql bacula-console

Segundo Paso:

Configurar y Crear la Bases Datos de Bacula en MYSQL:

[root@nixon ~]# /usr/libexec/bacula/grant_mysql_privileges -p

[root@nixon ~]# /usr/libexec/bacula/create_mysql_database -p

[root@nixon ~]# /usr/libexec/bacula/make_mysql_tables -p

Entramos a MYSQL:

[root@nixon ~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 5.1.52 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL v2 license

 

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

 

Configuramos la clave para bacula:

mysql> set password for bacula=password(‘kikla’);

Query OK, 0 rows affected (0.00 sec)

mysql> set password for bacula@localhost=password(‘kikla’);

Query OK, 0 rows affected (0.00 sec)

 

Confirmamos lo realizado:

mysql> select user,host,password from mysql.user;

+——–+——————-+——————————————-+

| user | host | password |

+——–+——————-+——————————————-+

| root | localhost | *83E80D49E4AE55FD9D329CD7E7EEA89763E71BA9 |

| root | nixon.capital.acl | *83E80D49E4AE55FD9D329CD7E7EEA89763E71BA9 |

| root | 127.0.0.1 | *83E80D49E4AE55FD9D329CD7E7EEA89763E71BA9 |

| bacula | % | *83E80D49E4AE55FD9D329CD7E7EEA89763E71BA9 |

| bacula | localhost | *83E80D49E4AE55FD9D329CD7E7EEA89763E71BA9 |

+——–+——————-+——————————————-+

5 rows in set (0.00 sec)

Vemos la Bases Datos:

 

mysql> show databases;

+——————–+

| Database |

+——————–+

| information_schema |

| bacula |

| mysql |

| test |

+——————–+

4 rows in set (0.00 sec)

 

Entramos en la Base Datos Bacula:

 

mysql> use bacula;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

 

Vemos las tablas:

 

mysql> show tables;

+——————+

| Tables_in_bacula |

+——————+

| BaseFiles |

| CDImages |

| Client |

| Counters |

| Device |

| File |

| FileSet |

| Filename |

| Job |

| JobHisto |

| JobMedia |

| Location |

| LocationLog |

| Log |

| Media |

| MediaType |

| Path |

| PathHierarchy |

| PathVisibility |

| Pool |

| Status |

| Storage |

| UnsavedFiles |

| Version |

+——————+

24 rows in set (0.00 sec)

 

Salimos:

mysql> exit

Bye

 

Tercer Paso:

 

Configurar el Server:

[root@nixon ~]# vim /etc/bacula/bacula-dir.conf

En la linea 22:Ponemos la clave

Password = “kikla”

 

En la linea 94: Agregamos el metodo de comprension

Compression = GZIP

En la linea 110: Directorio que le haremos backup al cliente

File = /opt/Backups/oraserv5

 

En la linea 158: IP o nombre del cliente que haremos backup

Address = oraserv5

 

En la linea 161:Especificamos la clave otra vez

Password = “kikla”

 

En la linea 187: IP o nombre del server

Address = bacula.capital.acl

 

En la linea 189: Especificamos la clave otra vez

Password = “kikla”

 

En la linea 236:Especificamos la clave para Bacula en MYSQL

dbname = “bacula”; dbuser = “bacula”; dbpassword = “kikla”

 

En la linea 286: Tiempo retencion de los backup

Volume Retention = 90 days

 

En la linea 287: Agregamos el maximo de volumen por trabajo

Maximum Volume Jobs=1

 

En la linea 288: Agregamos encabezado por defecto que tendran los backup

Label Format = JP-

 

En lineas 312-316: Comentamos esas lineas

#Console {

# Name = bacula-mon

# Password = “@@MON_DIR_PASSWORD@@”

# CommandACL = status, .status

#}

 

Editamos el archivo que pondra a funcionar nuestro catalogo:

[root@nixon ~]# vim /usr/libexec/bacula/make_catalog_backup.pl

 

En la linea 108: Agregamos

exec(“HOME=’$wd’ mysqldump -f -u$args{db_user} -p$args{db_password} –opt $args{db_name} > ‘$wd/$args{db_name}.sql'”);

 

Iniciamos el Bacula dir:

 

[root@nixon ~]# service bacula-dir start

Starting bacula-dir: [ OK ]

 

Colocamos que inicie automático:

[root@nixon ~]# chkconfig bacula-dir on

Cuarto Paso :

Configuramos el archivo de configuracion del almacenamiento bacula para la conexión:

 

[root@nixon ~]# vim /etc/bacula/bacula-sd.conf

 

En la linea 26 Especificamos la clave otra vez

Password = “kikla”

 

En las lineas 33-37: Comentamos

#Director {

# Name = bacula-mon

# Password = “@@MON_SD_PASSWORD@@”

# Monitor = yes

#}

 

Iniciamos el Bacula sd:

 

[root@nixon ~]# service bacula-sd start

Starting bacula-dir: [ OK ]

 

Colocamos que inicie automatico:

[root@nixon ~]# chkconfig bacula-sd on

 

Quinto Paso:

 

Configurar el Bacula bconsole:

[root@nixon ~]# vim /etc/bacula/bconsole.conf

Director {

Name = bacula-dir

DIRport = 9101

address = bacula.capital.acl

Password = “kikla”

}

 

Sexto Paso:

 

Configurar el cliente oraserv5:

 

Instalacion de los paquetes en el cliente:

 

[root@oraserv5 Backups]# yum -y install bacula-client bacula-console

Configuramos Bacula File en el cliente:

[root@oraserv5 Backups]# vim /etc/bacula/bacula-fd.conf

Director {

Name = bacula-dir

Password = “kikla”

}

 

En las lineas 22-26: Eliminamos esas lineas

 

Iniciamos el Bacula fd:

 

[root@oraserv5 Backups]# service bacula-fd start

Starting bacula-fd: [ OK ]

 

Colocamos que inicie automatico:

[root@oraserv5 Backups]# chkconfig bacula-fd on

 

Septimo Paso:

 

Configurar el bconsole en el cliente:

 

[root@oraserv5 Backups]# vim /etc/bacula/bconsole.conf

Director {

Name = bacula-dir

DIRport = 9101

address = nixon.capital.acl

Password = “kikla”

}

 

Vamos a crear el directorio donde colocaremos que le haremos backup en el cliente:

 

[root@oraserv5 oraserv5]# mkdir -p /opt/Backups/oraserv5/

 

[root@oraserv5 oraserv5]# chown -R oracle.oinstall /opt/Backups/oraserv5/

Octavo Paso:

Vamos correr el backup desde el cliente oraserv5, tambien lo puede hacer desde el server.

Antes vamos agrear un achivo de dentro del directorio que haremos backup, para indetificar que se hizo el backup.

[root@oraserv5 oraserv5]# cat > bacula.txt

Estamos probando bacula.

Saludos,

Inicio del Backup:

[root@oraserv5 ~]# bconsole
onnecting to Director nixon.capital.acl:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
Enter a period to cancel a command.
*label

Automatically selected Catalog: MyCatalog

Using Catalog “MyCatalog”

Automatically selected Storage: File

Enter new Volume name: JP-oraserv5-2011-12-12:2:55

Defined Pools:

1: Default

2: File

3: Scratch

Select the Pool (1-3): 2

Connecting to Storage daemon File at bacula.capital.acl:9103 …

Sending label command for Volume “JP-oraserv5-2011-12-12:2:55″ Slot 0 …

3000 OK label. VolBytes=221 DVD=0 Volume=”JP-oraserv5-2011-12-12:2:55″ Device=”FileStorage” (/tmp)

Catalog record for Volume “JP-oraserv5-2011-12-12:2:55”, Slot 0 successfully created.

Requesting to mount FileStorage …

3906 File device “FileStorage” (/tmp) is always mounted.

*run

A job name must be specified.

The defined Job resources are:

1: BackupClient1

2: BackupCatalog

3: RestoreFiles

Select Job resource (1-3): 1

Run Backup job

JobName: BackupClient1

Level: Incremental

Client: bacula-fd

FileSet: Full Set

Pool: File (From Job resource)

Storage: File (From Job resource)

When: 2011-12-12 14:55:55

Priority: 10

OK to run? (yes/mod/no): yes

Job queued. JobId=1

You have messages.

*

12-Dec 14:56 bacula-dir JobId 1: No prior Full backup Job record found.

12-Dec 14:56 bacula-dir JobId 1: No prior or suitable Full backup found in catalog. Doing FULL backup.

12-Dec 14:56 bacula-dir JobId 1: Start Backup JobId 1, Job=BackupClient1.2011-12-12_14.56.03_04

12-Dec 14:56 bacula-dir JobId 1: Using Device “FileStorage”

12-Dec 14:56 bacula-sd JobId 1: Wrote label to prelabeled Volume “JP-oraserv5-2011-12-12:2:55” on device “FileStorage” (/tmp)

12-Dec 14:56 bacula-sd JobId 1: Job write elapsed time = 00:00:01, Transfer rate = 245 Bytes/second

12-Dec 14:56 bacula-dir JobId 1: Bacula bacula-dir 5.0.0 (26Jan10): 12-Dec-2011 14:56:06

Build OS: i686-pc-linux-gnu redhat (Final)

JobId: 1

Job: BackupClient1.2011-12-12_14.56.03_04

Backup Level: Full (upgraded from Incremental)

Client: “bacula-fd” 5.0.0 (26Jan10) x86_64-unknown-linux-gnu,redhat,(Final)

FileSet: “Full Set” 2011-12-12 14:56:03

Pool: “File” (From Job resource)

Catalog: “MyCatalog” (From Client resource)

Storage: “File” (From Job resource)

Scheduled time: 12-Dec-2011 14:55:55

Start time: 12-Dec-2011 14:56:06

End time: 12-Dec-2011 14:56:06

Elapsed time: 0 secs

Priority: 10

FD Files Written: 2

SD Files Written: 2

FD Bytes Written: 43 (43 B)

SD Bytes Written: 245 (245 B)

Rate: 0.0 KB/s

Software Compression: None

VSS: no

Encryption: no

Accurate: no

Volume name(s): JP-oraserv5-2011-12-12:2:55

Volume Session Id: 1

Volume Session Time: 1323713812

Last Volume Bytes: 914 (914 B)

Non-fatal FD errors: 0

SD Errors: 0

FD termination status: OK

SD termination status: OK

Termination: Backup OK

12-Dec 14:56 bacula-dir JobId 1: Begin pruning Jobs older than 41 years 5 months 25 days 18 hours 56 mins 6 secs.

12-Dec 14:56 bacula-dir JobId 1: No Jobs found to prune.

12-Dec 14:56 bacula-dir JobId 1: Begin pruning Jobs.

12-Dec 14:56 bacula-dir JobId 1: No Files found to prune.

12-Dec 14:56 bacula-dir JobId 1: End auto prune.

*exit

Listo ya tenemos nuestro backup debe de haber un archivo llamado JP-oraserv5-2011-12-12:2:55 en /tmp del server:

[root@nixon tmp]# ls

JP-oraserv5-2011-12-12:2:55

Noveno Paso:

Vamos a recuperar el Backup:

La recuperario nos colocara en /tmp del cliente en un directorio llamado bacula-restores y dentro del mismo los directorios que configuramos para realizar backup.

Podemos lanzar la recuperacion desde el server o cliente, en este caso lo haremos desde el server:

[root@nixon tmp]# bconsole

Connecting to Director bacula.capital.acl:9101

1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)

Enter a period to cancel a command.

*restore

Automatically selected Catalog: MyCatalog

Using Catalog “MyCatalog”

First you select one or more JobIds that contain files

to be restored. You will be presented several methods

of specifying the JobIds. Then you will be allowed to

select which files from those JobIds are to be restored.

To select the JobIds, you have the following choices:

1: List last 20 Jobs run

2: List Jobs where a given File is saved

3: Enter list of comma separated JobIds to select

4: Enter SQL list command

5: Select the most recent backup for a client

6: Select backup for a client before a specified time

7: Enter a list of files to restore

8: Enter a list of files to restore before a specified time

9: Find the JobIds of the most recent backup for a client

10: Find the JobIds for a backup for a client before a specified time

11: Enter a list of directories to restore for found JobIds

12: Select full restore to a specified Job date

13: Cancel

Select item: (1-13): 5

Automatically selected Client: bacula-fd

Automatically selected FileSet: Full Set

+——-+——-+———-+———-+———————+—————————–+

| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |

+——-+——-+———-+———-+———————+—————————–+

| 1 | F | 2 | 43 | 2011-12-12 14:56:06 | JP-oraserv5-2011-12-12:2:55 |

+——-+——-+———-+———-+———————+—————————–+

You have selected the following JobId: 1

Building directory tree for JobId(s) 1 …

1 files inserted into the tree.

You are now entering file selection mode where you add (mark) and

remove (unmark) files to be restored. No files are initially added, unless

you used the “all” keyword on the command line.

Enter “done” to leave this mode.

cwd is: /

$ ls

opt/

$ ls /opt

$ mark opt

2 files marked.

$ lsmark

*opt/

*Backups/

*oraserv5/

*bacula.txt

$ done

Bootstrap records written to /var/spool/bacula/bacula-dir.restore.1.bsr

The job will require the following

Volume(s) Storage(s) SD Device(s)

===========================================================================

JP-oraserv5-2011-12-12:2: File FileStorage

Volumes marked with “*” are online.

2 files selected to be restored.

Run Restore job

JobName: RestoreFiles

Bootstrap: /var/spool/bacula/bacula-dir.restore.1.bsr

Where: /tmp/bacula-restores

Replace: always

FileSet: Full Set

Backup Client: bacula-fd

Restore Client: bacula-fd

Storage: File

When: 2011-12-12 15:05:20

Catalog: MyCatalog

Priority: 10

Plugin Options: *None*

OK to run? (yes/mod/no): yes

Job queued. JobId=2

*

12-Dec 15:05 bacula-dir JobId 2: Start Restore Job RestoreFiles.2011-12-12_15.05.26_06

12-Dec 15:05 bacula-dir JobId 2: Using Device “FileStorage”

12-Dec 15:05 bacula-sd JobId 2: Ready to read from volume “JP-oraserv5-2011-12-12:2:55” on device “FileStorage” (/tmp).

12-Dec 15:05 bacula-sd JobId 2: Forward spacing Volume “JP-oraserv5-2011-12-12:2:55” to file:block 0:221.

12-Dec 15:05 bacula-sd JobId 2: End of Volume at file 0 on device “FileStorage” (/tmp), Volume “JP-oraserv5-2011-12-12:2:55”

12-Dec 15:05 bacula-sd JobId 2: End of all volumes.

12-Dec 15:05 bacula-dir JobId 2: Bacula bacula-dir 5.0.0 (26Jan10): 12-Dec-2011 15:05:28

Build OS: i686-pc-linux-gnu redhat (Final)

JobId: 2

Job: RestoreFiles.2011-12-12_15.05.26_06

Restore Client: bacula-fd

Start time: 12-Dec-2011 15:05:28

End time: 12-Dec-2011 15:05:28

Files Expected: 2

Files Restored: 2

Bytes Restored: 35

Rate: 0.0 KB/s

FD Errors: 0

FD termination status: OK

SD termination status: OK

Termination: Restore OK

12-Dec 15:05 bacula-dir JobId 2: Begin pruning Jobs older than 41 years 5 months 25 days 19 hours 5 mins 28 secs.

12-Dec 15:05 bacula-dir JobId 2: No Jobs found to prune.

12-Dec 15:05 bacula-dir JobId 2: Begin pruning Jobs.

12-Dec 15:05 bacula-dir JobId 2: No Files found to prune.

12-Dec 15:05 bacula-dir JobId 2: End auto prune.

*exit

You have new mail in /var/spool/mail/root

[root@nixon tmp]

[root@oraserv5 oraserv5]# pwd

/tmp/bacula-restores/opt/Backups/oraserv5

[root@oraserv5 oraserv5]# ls

bacula.txt

[root@oraserv5 oraserv5]# cat bacula.txt

Estamos probando bacula.

Saludos,

Listo ya tenemos la configuracion de un servidor de Backup con Bacula.

Decimo Paso:

Herramienta grafica para realizar Backup con Bacula.

[root@oraserv5 oraserv5]# yum -y install bacula-console-bat

 

Luego cofiguramos:

[root@oraserv5 oraserv5]# vim /etc/bacula/bat.conf

Director {

Name = bacula-dir

DIRport = 9101

address = nixon.capital.acl

Password = “kikla”

}

Listo vamos al menu habrimos la herramienta:

QUIENES SOMOS?

codigolibrelogo
La Fundación Código Libre Dominicano (FCLD) tiene como objetivo principal promover y defender la libertad de uso, de aprendizaje, conocimiento, distribución y compartición de los derechos de los usuarios y programadores en relación al software.

Donaciones

Es de mucha importancia para nosotros el apoyo y el reconocimiento de cada miembro de la Fundación código libre dominicano, por lo que si prefieres de alguna manera contribuir puedes hacerlo por el siguiente método.

Siguenos

128-facebookgoogleplustwitteryoutubeInstagram

Quien está conectado

5 visitantes conectados ahora
1 visitantes, 4 bots, 0 miembros
Copyright © 2016. Designed by MediaExperto