How Install Bacula Backup Server and Client On CentOS
How Install Bacula Backup Server and Client On CentOS
Introduction:
Bacula is an open source network backup program enabling you to backup, restore, and verify
data across your network. There are Bacula clients for Linux, Windows, and Mac making it a
cross-platform network wide solution. It is very flexible and robust, which makes it, while
slightly cumbersome to configure, suitable for backups in many situations. A backup system is
an important component in most server infrastructures, as recovering from data loss is often a
critical part of disaster recovery plans. In this tutorial, we will show you how to install and
configure the server components of Bacula on a Centos 7 server.
1. Prerequisites:
You must have super user (sudo) access on a Centos 7 server. Also, the server will
require adequate disk space for all of the backups that you plan on retaining at any
given time. You should enable Private Networking on your Bacula server, and all of
your client servers that are in the same datacenter region. This will allow your servers
to use private networking when performing backups, reducing network overhead.
1. Overview:
Bacula is made up of several components and services used to manage which
files to backup and backup locations:
1. Bacula Director: a service that controls all backup, restore, verify, and archive
operations.
4. Bacula Storage: it is programs that performs the storage and recovery of data
to the physical media.
5. Bacula Catalog: is responsible for maintaining the file indexes and volume
databases for all files backed up, enabling quick location and restoration of
archived files. The Catalog supports three different databases MySQL,
PostgreSQL, and SQLite.
o Installation:
Bacula uses an SQL database, such as MySQL or Mariadb, to manage its
backups catalog. We will use Mariadb. First we will login as root user.
#su
- Advertisement -
Once the installation is complete, we need to start MySQL service and configure it to
automatically start on system reboot with the following command:
Note: i am using password as “centos” wherever i need to setup password. create your own
password.
Next run the following commands one by one to create database and necessary tables for
Bacula. Here “-u root” means that login with root account and “-p” means prompt for mysql
root password in my case is “centos”.
# /usr/libexec/bacula/grant_mysql_privileges -u root -p
# /usr/libexec/bacula/create_mysql_database -u root -p
# /usr/libexec/bacula/make_mysql_tables -u root -p
Next, we want to run a simple security script that will remove some dangerous defaults and
lock down access to our database system a little bit.
# sudo mysql_secure_installation
The prompt will ask you for your current root password. Enter the password. For the rest of
the questions, you should simply hit the Enter key through each prompt to accept the default
values. This will remove some sample users and databases, disable remote root logins, and
load these new rules so that MySQL immediately respects the changes we have made.
Now we need to set the password for the Bacula database user.
# mysql -u root –p
Now set the password for the Bacula database user. Use this command, but replace “centos”
with strong password:
By default, Bacula is set to use the PostgreSQL library. Because we are using MySQL, we need
to set it to use the MySQL library instead.
Enter 1 (MySQL):
Selection Command
-----------------------------------------------
1 /usr/lib64/libbaccats-mysql.so
2 /usr/lib64/libbaccats-sqlite3.so*+
3 /usr/lib64/libbaccats-postgresql.so
We need to change the file permissions so that only the bacula process (and a superuser) can
access these locations:
Bacula has several components that must be configured independently in order to function
correctly. The configuration files can all be found in the /etc/bacula directory.
In this file we will Update Bacula server hostname, bacula mysql user password, Bacula console
password, Bacula file daemon password etc. Be mindful that you should use a fully qualified
domain name for adding clients or simply use the IP address instead. Edit just those words
are Bold.
[…]
Client {
Name = bacula-fd
Address = 192.168.100.146
FDPort = 9102
Catalog = MyCatalogPassword = “centos” # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
[…]
}
[…]
Console {
Name = bacula-mon
Password = “centos”
CommandACL = status, .status
}
Now move on to the rest of the file. Now we will Update Bacula Console.
Edit file /etc/bacula/bconsole.conf
# vi /etc/bacula/bconsole.conf
Director {
Name = bacula-dir
DIRport = 9101
address = localhost
Password = “centos”
}
Edit file /etc/bacula/bacula-sd.conf
# vi /etc/bacula/bacula-sd.conf
Update the password, Find the red lines and delete them, do not uncomment them. Also set
your Archive device path.
Set password here.
[...]
Director {
Name = bacula-dir
Password = "centos"
Device {
Name = FileStorage
RemovableMedia = no;
AlwaysOpen = no;
[...]
Edit file /etc/bacula/bacula-fd.conf,
# vi /etc/bacula/bacula-fd.conf
Director {
Name = bacula-dir
Password = "centos"
Now we finished all passwords and address modifications. Next restart all bacula daemons and
make them to start automatically on every reboot.
Bacula has been successfully installed and configured. You can now add clients, jobs and
volumes by updating the Bacula Config files. Alternatively you can use webmin to make the
work simpler. It is quite easier then updating the Config files manually.
Webmin is a web-based interface for system administration for Linux/Unix. Using any modern
web browser, you can setup user accounts, Apache, DNS, file sharing and much more.
# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.900-1.noarch.rpm
Now we will Add rule for Firewall, If we want to access the bacula server from a remote
system, allow the webmin port “10000” and bacula ports “9101”, “9102”, “9103” through
your firewall. Open terminal and run these commands one by one.
#firewall-cmd --reload
Access Webmin
Then try to login again if logged in then your firewall rules are need to set.
Click on the “Bacula Backup System” link. Initially the Bacula server won’t start automatically.
To start Bacula server click on “Module Configuration” link on the right of the “Bacula Backup
System” page.
That’s it. here you can schedule backups according to your desire.
Best of Luck. !!!!
Ajuste: Mejor Rendimiento y Tratamiento
de Cuellos de Botella de Respaldo
1. →
2. Backup→
3. Ajuste: Mejor Rendimiento y Tratamiento de Cuellos de Botella de Respaldo
synchronous_commit = on
Realizando un vacuumdb periódico en la base de datos (postgreSQL), con el
paso del tiempo el gran cambio de registros acaba haciendo que la inserción en la
base de datos consuma más tiempo. [1]
[1] Sugerencia de Edmar Araújo.
Referencias: http://www.postgresql.org/docs/9.0/static/app-vacuumdb.html | Carlos
Eduardo Smanioto -> Otimização – Uma Ferramenta Chamada
Vacuum: http://www.devmedia.com.br/otimizacao-uma-ferramenta-chamada-
vacuum/1710
b) MySQL
innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT
De forma predeterminada, innodb_flush_log_at_trx_commit sería 1, lo que
significa que el registro de transacciones se almacena en el disco en cada
confirmación en el banco y las transacciones no se perderán en caso de una falla
del sistema operativo. Dado que Bacula utiliza muchas transacciones pequeñas,
puede reducir la E/S de registro y aumentar el rendimiento de la copia de
seguridad exponencialmente configurándolo en 0, lo que significa que no habrá
almacenamiento de registro para cada transacción. Como en caso de interrupción
del trabajo sería necesario reiniciar el trabajo de respaldo de cualquier forma, por
lo que es una opción muy interesante.
Ejecute mysqltuner (apt-get install mysql tuner) e implemente los cambios
sugeridos.
Red (SD y FD)
Agregue más interfaces (bonding / NIC Teaming) y conmutadores más
rápidos (puede usar el comando de red de estado de Bacula o la aplicación
ethtool para verificar la velocidad de su conexión ethernet).
Establezca el Network Buffer Size = bytes, que especifica el tamaño inicial del
búfer de red. Este tamaño se ajusta a la baja si el sistema operativo operativo no lo
acepta, a costa de muchas llamadas al sistema (no deseadas). El valor
predeterminado es 32,768 bytes. Se eligió el estándar para que sea lo
suficientemente amplio para la transmisión a través de Internet, pero en una red local
se puede aumentar para mejorar el rendimiento. Algunos usuarios han notado una
mejora de 10 veces en la transferencia de datos usando 65,536 bytes en este valor.
Evite el tráfico a través de firewalls y enrutadores.
Utilice Jumbo Frames.
Personaliza el Kernel (Ref.: Https://fasterdata.es.net/host-tuning/linux/).
Ejemplo:
echo "
# allow testing with buffers up to 128MB
net.core.rmem_max = 134217728
net.core.wmem_max = 134217728
# increase Linux autotuning TCP buffer limit to 64MB
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
# recommended default congestion control is htcp
net.ipv4.tcp_congestion_control=htcp
# recommended for hosts with jumbo frames enabled
# net.ipv4.tcp_mtu_probing=1
# recommended for CentOS7+/Debian8+ hosts
net.core.default_qdisc = fq" >> /etc/sysctl.conf
reboot
Sistema Operativo
RAM (> 8GB)
vm.dirty_ratio = 2
vm.dirty_background_ratio = 1
vm.swappiness = 10
vm.zone_reclaim_node = 0
Disk Access
Utilice el sistema de archivos XFS, ya que sobresale en la realización de
operaciones de entrada / salida (E/S) en paralelo debido a su diseño, que se basa
en grupos de asignación (un tipo de subdivisión de los volúmenes físicos en los
que se utiliza XFS, abreviado para AG) . Debido a esto, XFS permite una
escalabilidad extrema de los subprocesos de E/S, el ancho de banda del sistema
de archivos y el tamaño de los archivos y el sistema de archivos en sí, mientras
abarca múltiples dispositivos de almacenamiento físico.
Utilice el «deadline disk schedulere».
Utilice RAID con un buen controlador de batería (por ejemplo, ARECA).