Thursday, May 14, 2020

Mariabackup for taking backup of mariadb databases

Today i have taken backup using mariabackup, with this utility you can take online full and incremental backups.
Below are the steps to be followed:

1. Create user as for backup:

MariaDB [(none)] > Create user 'mariabackup'@'localhost' identified by 'password';

MariaDB [(none)] > Grant reload,process,lock tables, replication client on *.* to 'mariabackup'@'localhost';

2. Install Maria backup:

#yum install MariaDB-backup

you will observe packages being installed and at the end will get message Complete !

3. Create a directory for backups, in my case i created /backup

4. take backups :

   #mariabackup --backup --target-dir=/backup --user=mariabackup --password=password

Backup will start and at the end you will get a message completed OK !

now we can go to the directory and check files created, you will see multiple files along with DB files that have backup related info -

backup-my.cnf,  xtrabackup_info, xtrabackup_checkpoints 


Wednesday, May 6, 2020

Mariadb Installation on Centos7

I recently installed Mariadb10.0 on Centos , this was on Azure. To start with i have created a VM on AZURE with centos and post Completion installed Mariadb.

Installing mariadb is fairly simple and below are the steps to be followed..:

1. Enable Mariadb Repository , create a file /etc/yum.repos.d/MariaDB.repo and add:
      name = MariaDB
    baseurl = http://yum.mariadb.org/10.4/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1

2. Next step is to install MariaDB server and Client packages , use yum:

     # yum install Mariadb-Server MariaDB-Client 

    this will download the required packages and complete the installation. Galera packages are also installed as it comes bundled in this version.

3. Start Mariadb :

    # Systemctl start Mariadb
    # Systemctl status Mariadb

At this point Mariadb should be up and running. Configuration file can be found in /etc/mariadb.d/server.cnf and default directory 
is in /var/lib/mysql.

With Mariadb 10.4 you can login to database without root password:

  #mysql -uroot

  Mariadb> 



Saturday, April 25, 2020

Docker Commands

I worked on docker and am sharing basic docker commands for reference:

1. To check running containers : This command lists running docker container

$ docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                  NAMES
df3589d324rg        ubuntu           "docker-entrypoint.s…"   About a minute ago   Up About a minute   80    ubuntu
2e0eabc266d9        postgres            "docker-entrypoint.s…"   5 minutes ago        Up 5 minutes        5432/tcp               db

2. To stop running containers: This command stops running container, i have taken first 4 characters of the first container from above commands

$ docker stop ContainerID

$ docker stop df35

3. To remove a container : After stopping the container, remove with the below commands

$ docker rm df35


4. Lists all the network

$docker network ls

NETWORK ID          NAME                DRIVER              SCOPE
eaa996cb5b14        bridge              bridge              local
f46cc1338e5a        host                host                local
9e826c05fcfd        none                null                local


Sunday, April 12, 2020

Jenkins Installation

Today am going to discuss about Jenkins installation.
Jenkins can be installed on both unix and windows, i recently installed on my windows 7 laptop and thought of sharing the process in detail with screenshots. 
First we need to download jenkins from website -

https://jenkins.io/download/

Select relevant option from the below, i selected windows:



















Once downloaded jenkin.msi needs to be run 



you will need to select installation location , i chose the default one :


 


Click on next to proceed:








few clicks our installation is completed 



In next step jenkins will start it's configuration 

In next step jenkins installation need a password stored in a file as per the screenshot, navigate to the file and enter the password.





Copy the password and enter, post the jenkins configuration will proceed further:



In next step jenkins with download , install plugins to create new jenkins jobs



Once above is completed , create new user page will appear




Fill in above details and next page will give default URL:Port of jenkins. We can change the below as per the requirement.






Finally our configuration is completed 


Tuesday, March 31, 2020

MongoDB

I have worked on MongoDB for sometime and wanted to share some knowledge gathered during this time.

Saturday, March 21, 2020

Shell script to execute mysql query

We can run mysql queries via shell scripts, since this is required at times .

Say  a query is to be scheduled via crontab and shell script.


Here is a simple shell script example, as an example:


vi testscript.sh


-----------------------------------------------------------------------

#!/usr/bin/bash

DBUSER='username'

DBPASSWD='Password'

Query='show databases'   -- example query


mysql -u $DBUSER -p $DBPASSWD  <


$Query

EOF

----------------------------------------------------------------------

The above is a simple script to show databases and is executed with shell script..

# sh testscript.sh

We can schedule the above in crontab to run at a designated time.

Many such scripts can be written to automate daily tasks - backups etc..