Thursday, April 18, 2013

How to take backup of sharded tables in mysql

There is an immense need of taking backup of tables which are sharded when you are working on critical servers.
Shard tables are an important part of any database and therefore system administrator should be able to provide the backup of these table at any given time.

Usage : To backup shard tables

mysql <databasename> -h <host> -u <user> -p <password> -e 
'show tables like <shard_table>%"' | grep -v Tables_in | xargs mysqldump --skip-lock-tables <databasename>  --host=<host> --user=<user> --password=<password> > table.sql

Saturday, September 17, 2011

Java Error InvalidAlgorithmParameterException: the trustAnchors on EC2 Amazon Jenkins

InvalidAlgorithmParameterException: the trustAnchors on EC2 Amazon

This error is due to the fact that gmail cert is not included in the JAVA HOME cacerts or else when the apache tomcat is not knowing as to where to pick the trusted cacerts file in any of the case here the complete procedure to do the same.

[root@server1 ~]# echo $JAVA_HOME

[root@server1 ~]$ openssl s_client -connect > /tmp/smtp.cert

( openssl can be available by install openssl package )

It will generate a certificate

Edit /tmp/smtp.cert and remove everything before or after the following tags(both begin certificate and end certificate should be included)

Now import the file /tmp/smtp.cert to JAVA_HOME cacerts

[root@server1 ~]# $JAVA_HOME/bin/keytool -import -alias -keystore $JAVA_HOME/jre/lib/security/cacerts -file /tmp/smtp_gmail.cert

It will ask for password first time, make sure you remember this password.

you can check the list in cacerts, which increases by number, to check it

[root@server1 ~]# $JAVA_HOME/bin/keytool -list -keystore # $JAVA_HOME/jre/lib/security/cacerts

Now if you are using tomcat or any other application based on tomcat, just include the following paths in or if you have a startup-script for your apps then include it.$JAVA_HOME/jre/lib/security/cacerts

Wednesday, July 28, 2010

How to convert .mp3 format to .ogg format

Packages required for installation on both Redhat and Debian based servers.

For Redhat

sh# yum install libmad libid3tag which are available in rpm forge repository.

download and install mpg321 rpm which is available on the internet or you can download it from

sh# rpm -Uvh mpg321-

next is to install vorbis-tools

sh# yum install vorbis-tools

For Ubuntu

sh# apt-get install mpg321 vorbis-tools


suppose you are have test.mp3 and need to convert it into test.ogg
run the mentioned command

sh # mpg321 test.mp3 -w - | oggenc -o test.ogg -

Note : Don't forget to put trailing "-"

Wednesday, July 21, 2010

Degrade PHP-5.3 to PHP-5.2 in Ubuntu

The mentioned script would degrade php-5.3 to php-5.2 in ubuntu.

#! /bin/sh
php_packages=`dpkg -l | grep php | awk '{print $2}'`

sudo apt-get remove $php_packages

sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list

sudo mkdir -p /etc/apt/preferences.d/

for package in $php_packages;
do echo "Package: $package
Pin: release a=karmic
Pin-Priority: 991
" | sudo tee -a /etc/apt/preferences.d/php

sudo apt-get update

sudo apt-get install $php_packages