25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

How to enable database backup on a Vultr instance?

by | Feb 9, 2019

Database backups are vital to recover your business critical databases.

Database failures can usually occur due to corruption of database files, damage to the file systems, software and hardware failures, etc.

So, a reliable database backup is always necessary for the database recovery.

At Bobcares, we help server owners setup regular database backups as part of our Managed Cloud Services.

Today, we’ll discuss how we setup Vultr database backup and fix common errors with it.

 

Vultr Database backup – How to do it?

Databases backups are really important when dealing with live websites. It’s really important to maintain regular database backups regardless of your business type.

Vultr offers automatic backup features that allow you to take free snapshots of your whole Vultr instance. But, the downside is that we can restore whole server from snapshot, not individual databases. It can also cause data inconsistencies in write intensive databases.

So, our Support Engineers take further steps to ensure consistent database backup on Vultr server. Now, let’s discuss the different methods to create database backup on Vultr instance.

1) Using mysqldump utility

Our Support Experts use the mysqldump utility to backup up MySQL or MariaDB databases. Databases are usually backed in .sql format. For example, to backup a single database, we use the following command.

mysqldump -u username -p database_name > database_backup.sql

 

Here, username is the name of the database user, database_name is the database to be backed up. And database_backup.sql is the file name where the database is backed up. This command will prompt for the MySQL user password. Once we give the correct password, we’ve the database backup in the file database_backup.sql.

However, if you have multiple MySQL databases on your system, it becomes a tedious task. In such cases, our Support Engineers write custom backup script to take the dump of all the databases on the Vultr instance.

Similarly, we use the pg_dump utility to backup PostgreSQL databases. For instance, we run the following command as super user(root) to backup a single PostrgreSQL database.

pg_dump -U username database_name > database_backup

 

Further, we use the command pg_dumpall if all the PostgreSQL databases need to be backed up.

 

a) Enable automatic backups

However, it’s a tiresome task to execute the above commands manually. That’s why, our Server Experts always receive  customer requests to automatically set the backup. In such cases, we create custom backup scripts to backup all databases at once and schedule it using cron jobs.

For example, consider we want to backup multiple databases. Firstly, we create a database user to handle these backups and assign proper privileges to this user. After that, we create a backup directory with environment and log files. Further, we export the MySQL backup user credentials to the environment file. Finally, we create a custom script to backup all the databases.

In addition to that, we write cron jobs to schedule this backup script to run at alternate intervals.

 

b) Enable remote backups

Further, keeping the database backups on the same server is a risk, because there’s no way to recover the backups when your Vultr instance crashes. That’s why, we always recommend customers to store database backups in remote storage locations like Google Drive, Amazon S3 etc.

Alternatively, in some cases we create custom scripts to transfer the database backups to a backup server or an alternate server on another location. For instance, in some cases we use FTP/SFTP to transfer the backups to remote host. Likewise, we use rsync command to sync the database backups from one server to another.

 

2) Using Backup tools

Another way to backup the databases is to use backup tools such as Automysqlbackup, MySQLDumper, etc. These utilities can be used to schedule automatic database backups at regular intervals.

For example, we can easily install Automysqlbackup utility in Ubuntu servers. The default location of the backups will be /var/lib/automysqlbackup. We specify the database user, password, the database to be backed up in the configuration file /etc/default/automysqlbackup.

[Need to setup database backup on your Vultr instance? Click here and get one of our Support Experts to look into your requirement.]

Vultr Database backup – Common failure points

Let’s now see the common errors that can occur during the Vultr database backup process and how our Support Experts fix them.

1) Mysqldump errors

Sometimes, users receive weird errors when using mysqldump command to backup the databases. Once such error is given below.

mysqldump: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) when trying to connect

 

This can be due to MySQL downtime, incorrect permissions of MySQL socket file, MySQL running on a custom port, and so on. So, here our Support Engineers check each of these causes and rule out each possibility to fix the issue.

Similarly, mysqldump errors can occur when users give incorrect username or password, improper privileges for the database user, and more.

 

2) Backup tool errors

Likewise, database backup tools can also throw errors if not properly configured. One such error that we recently saw with Automysqlbackup utility is given below.

#Checking for permissions to write to folders:
base folder /var/backup ... does not exist. Exiting.
Note: Supplied more than one argument, ignoring ALL arguments - using default and global config file only.
Note: /etc/automysqlbackup/automysqlbackup.conf was not found - no global config file.
Error: No basedir found

 

Here, our Support Engineers ensure that the backup directory is valid and accessible. Moreover, we correct the permissions of this directory to fix the issue.

This error list is not complete. You can come up with number of errors while configuring database backups.

[Need an expert to fix your Vultr database backup errors? Our Database Experts can help you here.]

Conclusion

In short, it’s really important to maintain consistent database backups for disaster recovery. Today, we’ve discussed how our Dedicated Engineers setup database backups on a Vultr instance and fix the common errors with it.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF