Showing posts with label backups. Show all posts
Showing posts with label backups. Show all posts

Tuesday, 14 April 2020

Backup & Restore of Mariadb Server

Hello, again!

This is just a small blog post on how to backup and restore a MariaDB server, without using MysqlDump, but by directly copying the files in /var/lib/mysql.

Backing up

First of course we need to shutdown mariadb.

# systemctl status mariadb
# systemctl stop mariadb

Copying files:

tar zcvf database_backup_`date +%F`.tgz /var/lib/mysql

Restoring

When putting things back, things start to go wrong1.

Copying the files to a new host, causes this:

2020-04-14 10:45:32 0 [ERROR] InnoDB: Operating system error number 13 in a file operation. 2020-04-14 10:45:32 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. 2020-04-14 10:45:32 0 [ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions

So, if the below code works, than SELinux is causing the issue:

sudo semanage permissive -a mysqld_t

Now you added mysql_t to permissive, as shown by the below printout:

]# semanage permissive -l

Builtin Permissive Types


Customized Permissive Types

mysqld_t

Turning it back to enforcing, means running:

# semanage permissive -d mysqld_t
libsemanage.semanage_direct_remove_key: Removing last permissive_mysqld_t module (no other permissive_mysqld_t module exists at another priority).

We need to relabel the new /var/lib/mysql directory:

sudo semanage fcontext -a -t mysqld_db_t "/var/lib/mysql(/.*)?"
sudo restorecon -Rv /var/lib/mysql

Checking the current file contexts:

$ ls --directory --context /var/lib/mysql
unconfined_u:object_r:mysqld_db_t:s0 /var/lib/mysql

MariaBackup

I need to check out MariaBackup2 3, as a better solution for creating backups compared to mysqldump.

References

[1] Security-Enhanced Linux with MariaDB
https://mariadb.com/kb/en/selinux/
[2] Backing up and restoring databases
https://mariadb.com/kb/en/backing-up-and-restoring-databases/
[3] MariaBackup
https://mariadb.com/kb/en/mariabackup/
[4] Full Backup and Restore with MariaBackup
https://mariadb.com/kb/en/full-backup-and-restore-with-mariabackup/

Thursday, 21 February 2019

Backup & Restore of Payara Server

How do I backup and restore my domain in Payara (or glassfish for that matter.)

$ ./asadmin backup-domain --backupDir ~/mmud_backups/payara_backups domain1

It ends up in ~/mmud_backups/payara_backups/domain1/domain1_2019_01_27_v00001.zip

$ ./asadmin restore-domain --filename ~/mmud_backups/payara_backups/domain1/domain1_2019_01_27_v00001.zip --backupdir ~/mmud_backups/payara_backups domain1
Restored the domain (domain1) to ~/payara5/glassfish/domains/domain1
Command restore-domain executed successfully.

References

Payara - Backup & Restore of Payara Server
https://blog.payara.fish/backup-restore-of-payara-server
Payara - How to upgrade Payara Server 5
https://blog.payara.fish/how-to-upgrade-payara-server-5-reloaded

Thursday, 31 August 2017

Google Takeout

The wife asked how to download all the photos in Google Photos at once, to store on her computer for easy viewing and backups and all that stuff.

It seems there's a Google producttm for that.

Google Takeout1 2 made by an engineering team at Google with a funny name3.

References

[1] Googel Product Forums
https://productforums.google.com/forum/#!topic/photos/sLseLCfw6Pw
[2] Wikipedia - Google Takeout
https://en.wikipedia.org/wiki/Google_Takeout
[3] Wikipedia - Google Data Liberation Front
https://en.wikipedia.org/wiki/Google_Data_Liberation_Front