>_Backup com Bacula – Instalação no CentOS 6.5 – 1.4

Entendendo um pouco da estrutura de backup do Bacula.

Módulos do Bacula:

Director Daemon
Console Manager
File Daemon
Storage Daemon
Catalogo
Monitor

Bacula Director (bacula-dir.conf):

Gerenciador; Núcleo do programa; é responsável por supervisionar todas as operações de backup, restauração, controle e verificação de arquivos.

Bacula Storage:

Responsável pelo armazenamento, leitura e escrita em fita, disco ou outros dispositivos. Deve ser instalado onde os arquivos serão armazenados, podendo ser instalado em mais de uma máquina.

Bacula File Daemon:

Este é o cliente do Bacula. Deve ser instalado em todas as máquinas onde serão realizados os backups.

Instalação/Configuração no CentOS 6.5 64bits.

baculac

Observação: Neste tutorial de exemplo foi desativado o iptables e o selinux.

Instalação dos necessários para o Bacula.

# yum install bacula-director-mysql bacula-storage-mysql bacula-client bacula-console bacula-console-qt  mysql-server mysql

Ativando os serviços do Bacula na inicialização do sistema operacional.

# chkconfig bacula-fd on
# chkconfig bacula-sd on
# chkconfig bacula-dir on

Ativando o MySQL para iniciar junto com o a inicialização do sistema operacional e em seguida iniciando o serviço.

# chkconfig mysqld on
# service mysqld start

No diretório /usr/libexec/bacula/ estão os scripts de configuração do banco de dados. Neste diretório contém vários scripts interessantes, vale a pena dar uma olhada.

# cd /usr/libexec/bacula/

Executando os scripts de configuração do banco de dados do MySQL.

./grant_mysql_privileges 
./create_mysql_database 
./make_mysql_tables

Configurando os arquivos bacula-dir.conf, bacula-sd.conf, bacula-fd.conf e bconsole.conf. Estas configurações se deve a variável de senhas.

bacula-dir.conf

# vim /etc/bacula/bacula-dir.conf
 22   Password = "@@DIR_PASSWORD@@"         # Console password
para
 22   Password = "senha-console"         # Console password
160   Password = "@@FD_PASSWORD@@"          # password for FileDaemon
para
160   Password = "senha-cliente"          # password for FileDaemon
188   Password = "@@SD_PASSWORD@@"
para
188   Password = "senha-storage"
311   Password = "@@MON_DIR_PASSWORD@@"
para
311   Password = "senha-monitor"

bacula-sd.conf

# vim bacula-sd.conf
 26   Password = "@@SD_PASSWORD@@"
para
 26   Password = "senha-storage"

 35   Password = "@@MON_SD_PASSWORD@@"
para
 35   Password = "senha-monitor"

bacula-fd.conf

 
# vim bacula-fd.conf
 15   Password = "@@FD_PASSWORD@@"
para
 15   Password = "senha-cliente"
 24   Password = "@@MON_FD_PASSWORD@@"
para
 24   Password = "senha-monitor"

bconsole.conf

# vim bconsole.conf
  9   Password = "@@DIR_PASSWORD@@"
para
  9   Password = "senha-console"

Iniciando os serviços do Bacula.

# /etc/init.d/bacula-fd start
Starting bacula-fd:                                        [  OK  ]
# /etc/init.d/bacula-sd start
Starting bacula-sd:                                        [  OK  ]
# /etc/init.d/bacula-dir start
Starting bacula-dir:                                       [  OK  ]

Bconsole:

O Bconsole é o console do bacula, um programa responsável por permitir que o administrador possa interagir com o Director enquanto o serviço está em execução. Através dele é possível visualizar o status de um job, examinar conteúdos do catálogo, examinar os arquivos de backup, restaurar backup, rodar um backup, manipular storages e clientes.

Acessando o bconsole.

# bconsole 
Connecting to Director localhost:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
Enter a period to cancel a command.

Verificando o status de cada serviço.

*status
Status available for:
     1: Director
     2: Storage
     3: Client
     4: All
Select daemon type for status (1-4): 2
Automatically selected Storage: File
Connecting to Storage daemon File at storage.example.com:9103

Failed to connect to Storage daemon File.
====
You have messages.

Corrigindo o problema.

Observação: Jamais utilize o Address = localhost sempre utilize o IP ou o FQDN.

bacula-dir.conf

# vim /etc/bacula/bacula-dir.conf
186   Address = storage.example.com                # N.B. Use a fully qualified name here
para
186   Address = ba-vm-bkp-01                # N.B. Use a fully qualified name here
157   Address = client.example.com
para
157   Address = ba-vm-bkp-01

Reiniciando o serviço.

# /etc/init.d/bacula-dir restart
Shutting down bacula-dir:                                  [  OK  ]
Starting bacula-dir:                                       [  OK  ]

Acessando o bconsole novamente.

[root@ba-vm-bkp-01 bacula]# bconsole 
Connecting to Director localhost:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
Enter a period to cancel a command.

Verificando o status.

*status
Status available for:
     1: Director
     2: Storage
     3: Client
     4: All
Select daemon type for status (1-4): 2
Automatically selected Storage: File
Connecting to Storage daemon File at ba-vm-bkp-01:9103

bacula-sd Version: 5.0.0 (26 January 2010) x86_64-redhat-linux-gnu redhat 
Daemon started 08-Abr-15 15:01, 0 Jobs run since started.
 Heap: heap=135,168 smbytes=13,943 max_bytes=77,750 bufs=53 max_bufs=54
Sizes: boffset_t=8 size_t=8 int32_t=4 int64_t=8

Running Jobs:
No Jobs running.
====

Jobs waiting to reserve a drive:
====

Terminated Jobs:
====

Device status:
Device "FileStorage" (/tmp) is not open.
====

Used Volume status:

Perfeito.

status
Status available for:
     1: Director
     2: Storage
     3: Client
     4: All
Select daemon type for status (1-4): 3
Automatically selected Client: bacula-fd
Connecting to Client bacula-fd at ba-vm-bkp-01:9102

bacula-fd Version: 5.0.0 (26 January 2010)  x86_64-redhat-linux-gnu redhat 
Daemon started 08-Abr-15 15:01, 0 Jobs run since started.
 Heap: heap=135,168 smbytes=11,627 max_bytes=11,774 bufs=47 max_bufs=48
 Sizeof: boffset_t=8 size_t=8 debug=0 trace=0

Running Jobs:
Director connected at: 08-Abr-15 15:09
No Jobs running.
====

Terminated Jobs:
====
*

Perfeito.

Novamente no bconsole, vamos gerar o primeiro backup do próprio servidor.

# bconsole 
Connecting to Director localhost: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: primeiro-bkp
Defined Pools:
     1: Default
     2: File
     3: Scratch
Select the Pool (1-3): 2
Connecting to Storage daemon File at ba-vm-bkp-01:9103 ...
Sending label command for Volume "primeiro-bkp" Slot 0 ...
3910 Unable to open device "FileStorage" (/tmp): ERR=dev.c:549 Could not open: /tmp/primeiro-bkp, ERR=Permissão negada

Label command failed for Volume primeiro-bkp.
Do not forget to mount the drive!!!
*

Corrigindo

# vim /etc/bacula/bacula-sd.conf
 55   Archive Device = /tmp
para
 55   Archive Device = /backup
# mkdir /backup
# chown -R bacula.bacula /backup/
# /etc/init.d/bacula-sd restart
Shutting down bacula-sd:                                   [  OK  ]
Starting bacula-sd:                                        [  OK  ]

Criando o primeiro label.

[root@ba-vm-bkp-01 bacula]# bconsole 
Connecting to Director localhost: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: primeiro-bkp
Defined Pools:
     1: Default
     2: File
     3: Scratch
Select the Pool (1-3): 2
Connecting to Storage daemon File at ba-vm-bkp-01:9103 ...
Sending label command for Volume "primeiro-bkp" Slot 0 ...
3000 OK label. VolBytes=214 DVD=0 Volume="primeiro-bkp" Device="FileStorage" (/backup)
Catalog record for Volume "primeiro-bkp", Slot 0  successfully created.
Requesting to mount FileStorage ...
3906 File device "FileStorage" (/backup) is always mounted.
# bconsole 
Connecting to Director localhost:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
Enter a period to cancel a command.

Executando o comando run para criar o primeiro job de backup local.

*run
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
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:     2015-04-09 10:42:20
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=7

Verificando o status do job criado com o comando m

*m
You have no messages.
*m
09-Abr 10:42 bacula-dir JobId 7: Start Backup JobId 7, Job=BackupClient1.2015-04-09_10.42.22_06
09-Abr 10:42 bacula-dir JobId 7: Using Device "FileStorage"
09-Abr 10:42 bacula-sd JobId 7: Volume "primeiro-bkp" previously written, moving to end of data.
09-Abr 10:42 bacula-sd JobId 7: Ready to append to end of Volume "primeiro-bkp" size=29640760
09-Abr 10:42 bacula-sd JobId 7: Job write elapsed time = 00:00:01, Transfer rate = 0  Bytes/second
09-Abr 10:42 bacula-dir JobId 7: Bacula bacula-dir 5.0.0 (26Jan10): 09-Abr-2015 10:42:24
  Build OS:               x86_64-redhat-linux-gnu redhat 
  JobId:                  7
  Job:                    BackupClient1.2015-04-09_10.42.22_06
  Backup Level:           Incremental, since=2015-04-09 10:27:36
  Client:                 "bacula-fd" 5.0.0 (26Jan10) x86_64-redhat-linux-gnu,redhat,
  FileSet:                "Full Set" 2015-04-08 16:26:23
  Pool:                   "File" (From Job resource)
  Catalog:                "MyCatalog" (From Client resource)
  Storage:                "File" (From Job resource)
  Scheduled time:         09-Abr-2015 10:42:20
  Start time:             09-Abr-2015 10:42:24
  End time:               09-Abr-2015 10:42:24
  Elapsed time:           0 secs
  Priority:               10
  FD Files Written:       0
  SD Files Written:       0
  FD Bytes Written:       0 (0 B)
  SD Bytes Written:       0 (0 B)
  Rate:                   0.0 KB/s
  Software Compression:   None
  VSS:                    no
  Encryption:             no
  Accurate:               no
  Volume name(s):         
  Volume Session Id:      2
  Volume Session Time:    1428585871
  Last Volume Bytes:      29,641,160 (29.64 MB)
  Non-fatal FD errors:    0
  SD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Backup OK

09-Abr 10:42 bacula-dir JobId 7: Begin pruning Jobs older than 44 years 9 months 24 days 13 hours 42 mins 24 sec.
09-Abr 10:42 bacula-dir JobId 7: No Jobs found to prune.
09-Abr 10:42 bacula-dir JobId 7: Begin pruning Jobs.
09-Abr 10:42 bacula-dir JobId 7: No Files found to prune.
09-Abr 10:42 bacula-dir JobId 7: End auto prune.

Alguns pontos importantes:
A autenticação do Bacula é bidirecional.
A instalação do Bacula client (fd) no próprio servidor Bacula tem como função realizar o próprio backup.
No centos é preciso configurar o servidor Bacula por completo, diferentemente do Debian.

Continua …
Fonte da pesquisa:
www.bacula.com.br
www.dicas-l.com.br
tidahora.com.br

>_Backup com Bacula – Instalação no CentOS 6.5 – 1.4
Tagged on:

One thought on “>_Backup com Bacula – Instalação no CentOS 6.5 – 1.4

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

%d blogueiros gostam disto: