mariabackup using IBM Spectrum Protect

There are several ways to protect MariaDB databases, where we are going to focus on using the mariabackup tool.

1.Install the IBM Spectrum Protect Client API

# rpm -ivh gsk*.rpm
# rpm –ivh *api*.rpm

# dpkg -i gsk*.deb
# dpkg –i *api*.deb

2. Install the SPFS software

# rpm -ivh spfs*.rpm
# rpm –ivh spictera*.rpm

# dpkg -i spfs*.deb
# dpkg –i spictera*.deb

3. Configure the Spectrum Protect client

# vi /opt/Tivoli/tsm/client/api/bin64/dsm.sys
SERVERNAME spfs
TCPSERVERADDRESS tsm.backupserver.com
ERRORLOGNAME /var/log/dsmerror_spfs.log

4. Register the node on the backup server

TSM> REGISTER NODE SPFS secret DOMAIN=SPFS

5. Configure the SPFS file system

5.1 Create option file

# echo SERVERNAME spfs > /etc/spfs/dsm.opt

5.2 set initial password

# setpassword /etc/spfs/TSM.PWD
secret

5.3 Create spfs configuration

# vi /etc/spfs/spfs.opt
MOUNTPOINT /backup
NODENAME spfs
NODEPWDFILE /etc/spfs/TSM.PWD
OPTIONFILE /etc/spfs/dsm.opt

6. mounting the SPFS file system

# mkdir /backup
# mount.spfs /backup

Backing up MariaDB

# mariadb-backup — backup — user=backup— password=secret — parallel=10 — stream=xbstream > /backup/bu.stream

Restoring from backup

Step 1: stop MariaDB

# systemctl stop mariadb

Step 2: remove data files

# cd /var/lib/mysql
# rm -rf *

Step 3: restore data files

# mbstream -x < /backup/bu.stream

Step 4: prepare

# mariadb-backup — prepare — target-dir=$(pwd)

Step 5: change ownerships of files

# chown -R mysql.mysql .

Step 6: start MariaDB

# systemctl start mariadb

If you want to restore from an older version, than one can change step 3 to the version of interest.

Eg previous backup version

# mbstream -x < “/backup/bu.stream(-1)”

Follow us on Twitter: http://twitter.com/spictera
Follow us on LinkedIn: http://LinkedIn.com/company/spictera

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store