Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, March 19, 2015

Performance Testing with SIPp

Performance Testing with SIPp:  


Installation:

Download SIPp from http://sourceforge.net/projects/sipp/files/sipp/

./configure --with-pcap
make
make install

Testing:


Server:

  • ./sipp -sn uas

Client:

  • ./sipp -sn uac 192.168.1.10

Advance client options:

  • ./sipp -sd uac > uac.xml
  • ./sipp -sf uac.xml
  • ./sipp -sn uac -i 192.168.1.5 -d 60000 -l 1 -m 1 -r 1 -s 1001 sip.example.com
-i   bind local IP
-d  call duration ( 60s )
-l  limit concurrent calls
-r  call rate per second
-s username or extension
sip.example.com is remote SIP server.


Send RTP stream:


  • ./sipp -sn uac_pcap -i 192.168.1.5 -d 60000 -l 1 -m 1 -r 1 -s 1001 sip.example.com




Monday, September 22, 2014

MySQL Replication setup in 10 minutes

  ________ ________
| | | |
| | | |
| master|>----->----->----->| slave |
| | | |
|_______| |_______|
     


1. configure master's /etc/mysql/my.cnf and add following line in [mysqld] section:
server-id=1 binlog-format = mixed log-bin=mysql-bin datadir=/var/lib/mysql innodb_flush_log_at_trx_commit=1 sync_binlog=1
2. Restart mysqld server and create replication user that your slave will use to authenticate and connect to master:


CREATE USER replicant@<slave-server-ip>;
GRANT REPLICATION SLAVE ON *.* TO replicant@<<slave-server-ip>> IDENTIFIED BY 'choose-secret-password';


3. Create backup file with the binlog position. It will affect performance of your existing database server, but won't lock your tables:


mysqldump -u root -p --skip-lock-tables --single-transaction --flush-logs --hex-blob --events --master-data=2 -A > ~/mysql_full_dump.sql


4. Now, find out MASTER_LOG_FILE and MASTER_LOG_POS values from "mysql_full_dump.sql" using following command, we will use them later:


head dump.sql -n80 | grep "MASTER_LOG_POS"


Above command output look like following:


-- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=107;


5. scp mysql_full_dump.sql user@slave-server-ip:~/

6. Edit slave server's /etc/my.cnf file to add following lines:


server-id = 101 binlog-format = mixed log_bin = mysql-bin relay-log = mysql-relay-bin log-slave-updates = 1 read-only = 1


7. Restart the mysql slave daemon and then import SQL dump: 


mysql -u root -p < ~/mysql_full_dump.sql


8. Log into mysql console on slave and run following command to setup replication:


mysql> CHANGE MASTER TO MASTER_HOST='master-server-ip',MASTER_USER='replicant',MASTER_PASSWORD=''slave-server-password', MASTER_LOG_FILE='Above head command output', MASTER_LOG_POS='Above head command output';


9. Run command command to start slave:


mysql> START SLAVE;


10. Check replication progress:


mysql> SHOW SLAVE STATUS \G


If all is well then you will see "Waiting for master to send event"

Notes: My mistake if you accidentally change any row or data on slave server, then revert your change and run following command:


mysql> STOP SLAVE;SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;START SLAVE;










Monday, October 22, 2012

How to mount LVM partitions from rescue mode (Fedora/CentOS/RedHat)

Boot from your rescue media and "skip" filesystem mount.

1. scan for volume groups:

#lvm vgscan -v

2. Activate all volume groups:

#lvm vgchange -a y

3. List logical volume

#lvm lvscan

4. Mount your filesystem and do your work :) 

Thursday, December 29, 2011

How To Compile Linux Kernel

Compiling custom kernel has its own advantages and disadvantages.Compiling kernel needs to understand few things and then just type couple of commands. This step by step howto covers compiling Linux kernel version 2.6.xx under Debian GNU Linux.

Few step to compile kernel.

# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2

Notes : Make sure GCC and GNU make utility installed on your system before compile kernel.

# tar cvjf linux-x.y.z.tar.bz2
# cd linux-x.y.z

Compile kernel

# make menuconfig

Start compiling to create a compressed kernel image, enter:
# make

compiling to kernel modules
# make modules

Install kernel modules
# make modules_install

To install kernel
# make install

It will install three files into /boot directory as well as modification to your kernel grub configuration file

System.map-2.6.25
config-2.6.25
vmlinuz-2.6.25

Create an initrd image for new installed kernel
# cd /boot
# mkinitrd -o initrd.img-2.6.25 2.6.25

Modify Grub configuration file - /boot/grub/menu.lst
# vi /boot/grub/menu.lst

title Debian GNU/Linux, kernel 2.6.25 Default
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hdb1 ro
initrd /boot/initrd.img-2.6.25
savedefault
boot

Note: its hard to edit this file without knowledge of options so better way is use update-grub command it will do it automaticaly for you.

# update-grub

Now time comes up for testing reboot your system and boot with new kernel and enjoy your system. Good Bye