Getting started
What’s NewRoadmapOcteth Training ProgramInstallation & Setup
RequirementsArchitectureServer SetupOempro InstallationCommunity Edition InstallSSL CertificatesVersion UpgradeTroubleshootingVideo Tutorials
Video TutorialsAdministration
Quick WalkthroughSecuritySub Admin AccountsSettingsDelivery ServersGlobal SegmentsGlobal Custom FieldsBounce ProcessingSpam ComplaintsSuppression ListPlug-InsDelivery ReportUser ManagementMaintenanceAudience Management
IntroductionSubscriber ListsCustom FieldsSegmentsSubscribersWebhooksWebsite Event TrackingEmail Marketing
IntroductionAuto RespondersEmail CampaignsSender Domain Man.Journeys (Automation)Bounce ProcessingEmail PersonalizationFBL ProcessingEmail Builder IntegrationsEmail DeliverabilitySender Domain ManagementPlug-Ins & Add-Ons
AI Plug-InRSS Plug-InBounce Catcher Add-OnLink Proxy Add-OnDevelopers
IntroductionSingle Sign OnAPIPlug-In DevelopmentDatabaseAdvanced
Reverse ProxyCookbookHelp
TroubleshootingContact UsDatabase Backup Procedures
Introduction
Welcome to the technical help article on taking MySQL database backups of Octeth.
It is important to regularly create backups of your database to ensure that you have a reliable copy of your data in case something goes wrong with your system.
In this article, we will cover two ways to take backups of the Octeth MySQL database:
- a regular SQL dump
- an Innodb backup using Percona's xtrabackup utility.
Before we dive into the instructions, let's briefly go over the difference between the two backup methods.
A regular SQL dump is a file containing the SQL statements needed to recreate the database. This method is suitable for most use cases and is relatively straightforward to set up.
On the other hand, Innodb backups using Percona's xtrabackup utility is a more advanced option that allows you to create hot backups of your database while it is still running. This method is useful if you need to minimize downtime during the backup process.
Prerequisites
In order to take regular SQL dumps of the Octeth database, you will need to have the mysqldump
command line tool installed on your system. This tool is standard on many Linux distributions, but if it is not available on your system, you can install it by running the following command:
apt-get install mysql-client
To take an Innodb backup of the Octeth database using Percona's xtrabackup utility, you will need to install the utility and a few other dependencies on your system. Follow these steps to install and set up Percona's xtrabackup:
- Navigate to the root directory:
- Download the latest version of the percona-release package:
- Install the percona-release package:
- Enable the tools and release repositories:
- Update the package list:
- If MySQL 5.7 server is running;
- Remove the percona-xtrabackup-80 package (if it is installed):
- Install the percona-xtrabackup-24 package:
- If MySQL 8 server is running;
- Install percona-xtrabackup-80 package:
- Install the qpress package:
cd /root/
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
percona-release enable-only tools release
apt update
apt remove percona-xtrabackup-80 -y
apt install -y percona-xtrabackup-24
apt install -y percona-xtrabackup-80
apt install -y qpress
Once you have completed these steps, you should be ready to take an Innodb backup of the Octeth database using Percona's xtrabackup utility.
Regular SQL dump of the database
To take a regular SQL dump of the Octeth database, you will need to use the mysqldump
command line tool. Here are the steps to follow to create a script that you can use to take regular backups of the database:
- Create a directory for storing the backups:
- Create a bash script file inside the
mysql_backups
directory: - Make the back script executable:
- Open the back script file in a text editor and add the following content:
mkdir /root/mysql_backups
touch /root/mysql_backups/mysql_backup.sh
chmod 0755 /root/mysql_backups/mysql_backup.sh
#!/bin/bash
fileName="oempro_mysql_$(date +%s).sql.gz"
echo "Target file: $fileName"
mysqldump -u oempro -p"XXXXXXX" oempro --single-transaction --quick --lock-tables=false | gzip -9 -c > /root/mysql_backups/$fileName
Note: Be sure to replace XXXXXXX
with the correct password for the oempro
user.
To take a backup of the Octeth database using this script, simply run the following command:
/root/mysql_backups/mysql_backup.sh
Alternatively, you can set up a daily scheduled backup by adding the following line to your crontab:
0 1 * * * /root/mysql_backups/mysql_backup.sh
This will run the mysql_backup.sh
script every day at 1:00 AM.
Innodb backup using Percona's xtrabackup utility
To take an Innodb backup of the Octeth database using Percona's xtrabackup utility, you will need to have the utility installed and configured on your system. Follow the instructions in the "Prerequisites" section to install and set up Percona's xtrabackup.
Once you have Percona's xtrabackup installed and set up, you can follow these steps to create a bash script for taking Innodb backups of the Octeth database:
- Create a MySQL credentials file at
/root/.my.cnf
- Create a bash script file for taking Innodb backups:
- Make the bash script executable:
cat <<"EOM" > /root/.my.cnf
[client]
user=root
password=XXXXXXX
host=127.0.0.1
EOM
Note: Be sure to replace XXXXXXX
with the correct password for the root
user.
cat <<"EOM" > /root/mysql_backups/innodb_backup.sh
#!/bin/bash
DAYWEEK=`date +%u`
DAYMONTH=`date +%d`
fileName="innodb_backup.xbstream.gz"
echo "Target file: $fileName"
ulimit -n 1000000
xtrabackup --backup --no-server-version-check --stream=xbstream --parallel=4 --datadir=/opt/oempro/_dockerfiles/mysql/data/ --target-dir=./ 2> /tmp/backup |pigz > /root/mysql_backups/$fileName
EOM
chmod 755 /root/mysql_backups/innodb_backup.sh
To take an Innodb backup of the Octeth database using this script, simply run the following command:
/root/mysql_backups/innodb_backup.sh
Alternatively, you can set up a daily scheduled backup by adding the following line to your crontab:
0 1 * * * /root/mysql_backups/innodb_backup.sh
This will run the innodb_backup.sh
script every day at 1:00 AM.
Conclusion
In this technical help article, we covered two ways to take MySQL database backups of Octeth: a regular SQL dump and an Innodb backup using Percona's xtrabackup utility. Both methods have their own advantages and use cases, and you can choose the one that best fits your needs.
Regardless of which method you choose, it is important to regularly test your backups to ensure that they are functioning properly and that you are able to restore from them in case of an emergency. Your system administrator should be responsible for testing the backup and restore system and making sure that backups are being taken without any problems.
We hope this article has been helpful in guiding you through the process of taking MySQL database backups of Octeth. If you have any further questions or need additional assistance, please don't hesitate to ask.