What is Multi-Cloud? How to improve your cloud strategy for 2018

For the past few years cloud computing has made it’s stable grounds in every tech company. With the wider adoption of clouds, the better services and tools and the vast investments in automation and scalability, now it’s time to pay a bit more attention on the quality of the service and end user experience and multi-cloud is the strategic approach that will be the main driving power in 2018.

Read More

Easy live partition resizing on Ubuntu 16.04

Overview

A great benefit of the cloud servers is the easy scaling of resources up and down. But after scaling to a larger cloud machine and acquiring more storage space, you should extend the Linux partitions on it as well as the file system, in order to use that new space.

The tricky part here comes when you want to resize the root partition and some old methods included taking your server off, mounting the storage drive on another Linux machine and resizing the partitions. That of course is very inconvenient in the case of a production server and there are better ways to resize your root partition without having to take it offline.

Read More

How to setup LXD Linux containers on Ubuntu 16.04 cloud machine?

Overview

Containers are a great tool for any scale, from a small dev environment set up on a cloud machine to a large and scalable applications infrastucture. The main benefits are the lightweight, fast and easy setup and the plenty of flexibility.

In this tutorial we’ll take a look at LXD containers – one of the most popular at the moment, especially good for its “virtual machine” like containerization.

Read More

How to setup automatic MySQL backup on Ubuntu/Debian and CentOS

   Overview

   This tutorial is to guide you on setting up a simple, automatic MySQL database backups using mysqldump and a cron job.

   Prerequisites

       

  •        Installed and running MySQL server
  •    

  •        SSH access
  •    

  •        root or sudo user

   Step 1: Backing up  a MySQL database

   You can use the ‘mysqldump’ that comes in any standard MySQL installation to do a database dump from the shell. To backup the ‘exampledb’ database to a file do:

   

       mysqldump -uroot -p exampledb > exampledb.sql

   Note that there is no space between the ‘-u’ switch and the user (root). With the ‘-p’ switch and paramater after it the ‘mysqldump’ will prompt you to enter a password.

   This command will output plain SQL queries in the exampledb.sql, but as they are text they can be compressed really good to save space. So to make a compressed backup, let’s do:

   

       mysqldump -uroot -p exampledb | gzip > exampledb.sql.gz

   You can use these commands to make manual backups of your databases. If you want to backup all databases on a server, use the ‘–all-databases’ switch instead of database name, like this:

   

       mysqldump -uroot -p –all-databases| gzip > mysql_server.sql.gz

   Step 2: Setting an automated scheduled backup of a MySQL database

   Now that you know how to make manual database backups, let’s automate them with a cron job. You must set up a cron job that calls the ‘mysqldump’ tool on a schedule.

   First let’s make a directory  for storing the backups:

   

       mkdir /var/backups/mysql

   As backups are more usefull when they provide history, let’s give the backup file with more meaningful name by adding the date and time when the backup was taken:

   

       mysqldump -uroot -p exampledb | gzip > /var/backups/mysql/exampledb.$(date +”%Y_%m_%d_%I_%M”).sql.gz

   To automate the backup process ‘mysqldump’ must have the user password inline, so it’s highly recommended to set up an additional database user specifically for backups.

   Open a crontab editor:

   

       crontab -e

   and add the following line at the bottom:

   

       0 1 * * *    mysqldump -uroot -p exampledb | gzip > /var/backups/mysql/exampledb.$(date +”\%Y_\%m_\%d_\%I_\%M”).sql.gz

   The “0 1 * * *” stands for a schedule on every 01:00 or everyday at one after midnight. The cron line format is “m h  dom mon dow   command”, where: 

       

  •        m – is for minutes
  •    

  •        h – is for hour
  •    

  •        dom – is the day of the month
  •    

  •        mon – is the month 
  •    

  •        dow – day of the week

   The  ‘*’ symbol in any of these means “on every” minute, hour, day and so.

    

   Saving the crontab will set your backup on schedule and you are good to go.