Shantanu's Blog

Corporate Consultant

April 21, 2014


Install Joomla on centOS

Here are the steps those needs to be followed in order to install Joomla on centOS system. Once installed, we can disable InnoDB and restore the database dump backup to convert all tables to default TokuDB engine.

1) install php and http
2) Download and extract joomla
3) Export path
4) Create symbolic link for mysql socket file
5) Disable selinux
6) Disable firewall
7) Start http deamon
8) Start TokuDB mysql

yum install php php-mysql http

cd /var/www/html/
mkdir joomla
cd joomla



export PATH=$PATH:/home/ec2-user/percona-5.5.30-tokudb-7.0.1-fedora-x86_64/bin
ln -s  /var/lib/mysql/mysql.sock /tmp/mysql.sock

echo 0 >/selinux/enforce

vi /etc/sysconfig/selinux

service iptables stop
/etc/init.d/httpd start

cd /home/ec2-user/percona-5.5.30-tokudb-7.0.1-fedora-x86_64/
./bin/mysqld_safe &

mysql>grant all on *.* to 'joomla'@'localhost' identified by 'joomla' with grant option;
grant all on *.* to 'joomla'@'%' identified by 'joomla' with grant option;

Labels: ,

April 07, 2014


Logical Snapshots

1) In order to use LVM we need to store the mysql data on LVM partition. So the /etc/my.cnf file should point to new data directory and not the default /var/lib/mysql

vi /etc/my.cnf

2) The /data folder should be hosted by lvm managed disk. In order to create partition in LVM format, use the following steps when you add a new disk or when you format the server for the first time.

# make sure the new disk is detected
server1:~# fdisk -l

# change the format of the new disk - use the options shown below when ever prompted
fdisk /dev/xvdj


# check the new name of the LVM disk
fdisk -l

# add it to LVM
pvcreate /dev/xvdj1

# name the LVM
vgcreate lvm /dev/xvdj1

# create logical volume
lvcreate --name=mysql_data   --size=2000M lvm

# format the newly created volume
mkfs.ext3 /dev/lvm/mysql_data
# mount the volume
mkdir /data
mount /dev/lvm/mysql_data /data

# make sure that the data directory is pointing to the /data folder in my.cnf
# restore all the data from backup sql files

3) Create a lvm snapshot when mysql service is stopped for a few minutes:

# check the VG status

# create a snapshot of data directory
lvcreate --name=mysql_snap  --snapshot --size=2100M  /dev/lvm/mysql_data

# mount the snapshot
mkdir /mnt/mysql-snap
mount /dev/mapper/lvm-mysql_data /mnt/mysql-snap/

4) Create snapshots with timestamp and also mount them for easy access.

lvcreate --name=mysql_snap_7apr14  --snapshot --size=2100M  /dev/lvm/mysql_data

mkdir /mnt/mysql-snap_7apr14
mount /dev/mapper/lvm-mysql_snap_7apr14 /mnt/mysql-snap_7apr14/

It is however not possible to take a snapshot of snapshot.

# lvcreate --name=mysql_snap_7apr14b  --snapshot --size=24000M  /dev/lvm/mysql_snap1
  Snapshots of snapshots are not supported yet.

So you can only take a snapshot of the original drive.

# lvcreate --name=mysql_snap_7apr14a  --snapshot --size=21000M  /dev/lvm/mysql_data
  Logical volume "mysql_snap_7apr14a" created

//compress and unzip data

umount /original_data
dd if=/dev/mapper/lvm_new-mysql_original_data | gzip > snap01.gz

lvcreate --name=mysql_data_new_pratik   --size=20000M lvm_new
time gzip -d -c snap01.gz | dd of=/dev/mapper/mysql_data_new_pratik


// change the disk allocated to any volume

# vgchange -an lvm
  Can't deactivate volume group "lvm" with 3 open logical volume(s)

# Unmount any snapshots in order to disable them
umount /mnt/mysql-snap

# lvextend  -L+10G /dev/mapper/lvm-mysql_data
  Extending logical volume mysql_data to 111.56 GiB
  Logical volume mysql_data successfully resized

March 01, 2014


OCR in Google Drive

Google drive supports OCR (Optical Character Recognition)

But you need to enable it from settings. Here is how to enable and use it to search the text found in your image.

January 21, 2014


Did you know google code Downloads are disabled?

When I tried to upload a file to my google code project, I got this message:

Google Code will not support creating new downloads starting January 15th, 2014. See here for more information.

The "here" word links to google blog that google expects us to read often.

I can see that the download option was disabled with sufficient notice. But google should have sent an email about the change. A pop-up while browsing the google code would have avoided the confusion.
I wasted a lot of time figuring out what is going wrong.

After killing Google reader for no apparent reason, this is the next casualty. I do not know who is the next?

Labels: ,

January 13, 2014


Copy a file to s3 using boto

Boto has built-in utility to upload a file to s3

/usr/local/bin/s3put -d 3 -a XXXXXXXXX -s XXXXXXX -b mtld-sql -k latest/  /mnt/data_backup/db/mowser.tar.gz

That should copy the file
From Local: /mtn/data_backup/db/mowser.tar.gz
To Cloud: mtd-sql/latest/mnt/data_backup/db/mowser.tar.gz

Here's an example using the -k and -p options:

python /tmp/s3put -d 3 -a XXXXXXXXX -s XXXXXXX  -b mtld-sql -k latest/  -p /mnt/data_backup/db/ /mnt/data_backup/db/mowser.tar.gz

The -k gives you mtld-sql/latest/
the -p removes /mtn/data_backup/db/ "KEY" prior to copying the to S3

Result copy:
From Local: /mtn/data_backup/db/mowser.tar.gz
To Cloud:  /mtd-sql/latest/mowser.tar.gz 


A typical command would look like this:
 /usr/local/bin/s3put -a xxx -s yyy -b glaciercopy -p `pwd` inter.sql

-p switch will remove the /home/ubuntu subfolder while saving to s3
-d 3 debug level 3 for verbose output

Labels: ,


June 2001   July 2001   January 2003   May 2003   September 2003   October 2003   December 2003   January 2004   February 2004   March 2004   April 2004   May 2004   June 2004   July 2004   August 2004   September 2004   October 2004   November 2004   December 2004   January 2005   February 2005   March 2005   April 2005   May 2005   June 2005   July 2005   August 2005   September 2005   October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006   January 2007   February 2007   March 2007   April 2007   June 2007   July 2007   August 2007   September 2007   October 2007   November 2007   December 2007   January 2008   February 2008   March 2008   April 2008   July 2008   August 2008   September 2008   October 2008   November 2008   December 2008   January 2009   February 2009   March 2009   April 2009   May 2009   June 2009   July 2009   August 2009   September 2009   October 2009   November 2009   December 2009   January 2010   February 2010   March 2010   April 2010   May 2010   June 2010   July 2010   August 2010   September 2010   October 2010   November 2010   December 2010   January 2011   February 2011   March 2011   April 2011   May 2011   June 2011   July 2011   August 2011   September 2011   October 2011   November 2011   December 2011   January 2012   February 2012   March 2012   April 2012   May 2012   June 2012   July 2012   August 2012   October 2012   November 2012   December 2012   January 2013   February 2013   March 2013   April 2013   May 2013   June 2013   July 2013   September 2013   October 2013   January 2014   March 2014   April 2014  

This page is powered by Blogger. Isn't yours?