Scheduling Backups in Jelastic

By | February 1, 2013

Data backup is very important task for businesses and large enterprises that maintain databases and important corporate information. Sometimes, losing data can cost millions and such event could impact on the profitability of companies. Even home users should always perform backup operations in order to avoid irreversible losses of data and important information.

Scheduled backups are data backup processes which proceed automatically on a scheduled basis without additional computer or user intervention. The advantage of using scheduled backups is obvious: instead of manual backups, a backup process can be run during off-peak hours when data is unlikely to be accessed, precluding or reducing the impact of backup window downtime.

We received a lot of requests and questions from our users on how to back up data from their Jelastic environments. This post is the answer.

You can run scheduled backups for your application using the Jelastic VDS service and cron. The backups will occur on the schedule you specify.

In this tutorial you will learn how to automatically backup your Jelastic databases using cron. Backing up your databases is an essential step and can save hours of frustration if something would happen to your databases (hard drive corruption, database corruption, mistakes, rollbacks etc). You can use crontab to run commands at regular time. For example, you can schedule a backup of your files every Monday. Commands can be scheduled to the minute. The crontab command works by reading a crontab file. A crontab file is a plain text file that lists all the jobs you have scheduled. Each line of the crontab file consists of the command with all its options and arguments, and the date and time to run it.

Create environment

1. Go to and sign up if you haven’t done it yet or log in with your Jelastic credentials by clicking the Sign In link on the page.

2. Ask Jelastic to create a new environment.

3. In the Environment topology dialog pick VDS and MySQL as a database you want to use. Switch on PublicIPv4 for your database. Then set the cloudlet limit and click Create.


Wait just a minute for your environment to be created.


Establish an SSH connection as it is described here.

4. Use the yum command to install the MySQL package (mysql.x86_64).

yum install mysql.x86_64

5. Create a new directory for your future backup files. For example:

mkdir /root/backups

Setting up a scheduled backup

1. To run cron use the next command:

crontab -e

Only the root user can specify another user’s crontab file. The crontab file opens in the vim editor.

2. The first time that you use a file, it is blank. Press Insert until you proceed to INSERT mode in vim editor.

3. Use the next command format to establish scheduled backups from your database:

*/1 * * * * /usr/bin/mysqldump -u root -p{database_password} -h {database_publicIPv4} –all-databases –routines –lock-tables=0 | gzip > /root/backups/mysqlbackup_$(date +%m-%d-%Y-%H%M).sql.gz

In this case every minute (*/1 * * * *) we backup all databases (–all-databases) from our MySQL server and save the backup files in the root/backups directory that we have created earlier (gzip > /root/backups/mysqlbackup_$(date +%m-%d-%Y-%H%M).sql.gz).

4. Exit from INSERT mode and switch to command mode by pressing ESC button then save changes:


5. Navigate to the backup folder you have created earlier to check the results:

ls /root/backups


Data backup and using Jelastic VDS can provide you with numerous benefits. Protect your electronic data by regularly performing backup operations.

Due to Jelastic vertical scaling feature the cost of such backups is almost minimal, especially considering that resources are needed periodically. Such an approach is even more cost effective than old school VPS hosting. Jelastic just gives your application the amount of RAM and the CPU power it needs, and recycles that back when you no longer need these resources.

Stay tuned!

Subscribe to get the latest updates