Tuesday, April 19, 2011

Steps to install Sysbench for Linux ( Centos 5 )

Download your Sysbench source from 


Extract the tar file.
Before proceed to execute the command below in the Linux shell, run the 

shell> ldconfig -p| grep mysql

to check if libmysqlclient is install, result screen would be as following
--------------------------------------------------------------------------------------------------------
libmysqlclient.so.16 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.16
libmysqlclient.so (libc6,x86-64) => /usr/lib64/libmysqlclient.so
--------------------------------------------------------------------------------------------------------

if it's empty, proceed to install the "libmysqlclient" by download the "MySQL-shared-5.5.9-1.linux2.6.x86_64.rpm" and install it via execute the command below at where your rpm file is.

     rpm -ivh MySQL-shared-5.5.9-1.linux2.6.x86_64.rpm


After all the checking steps above is done, execute the following linux commands steps by steps.

shell > aclocal
shell > libtoolize --force --copy
sysbench_installation_root_folder >  ./autogen.sh    (this file is inside the sysbench source folder)
sysbench_installation_root_folder > ./configure
sysbench_installation_root_folder > make
sysbench_installation_root_folder > make install 



Below is the READ ONLY test

shell > sysbench --num-threads=16 --max-requests=100000 --test=oltp --oltp-table-size=500000 --mysql-socket=/var/lib/mysql/mysql.sock --oltp-read-only --mysql-user=sqlUser --mysql-password=pswd --mysql-db=test run

Install sysbench error

If you happened to have see this error when you install your Sysbench

/usr/bin/ld: cannot find -lmysqlclient_r

Check whether your libmysqlclient is there by execute

shell> ldconfig -p| grep mysql

Result screen would be similar as below, if the libmysqlclient is already installed.

--------------------------------------------------------------------------------------------------------
libmysqlclient.so.16 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.16
libmysqlclient.so (libc6,x86-64) => /usr/lib64/libmysqlclient.so
--------------------------------------------------------------------------------------------------------


OR else it is empty.

The solution if the result screen is empty is to download "MySQL-shared-5.5.9-1.linux2.6.x86_64.rpm" and install it. Execute the linux command as below, if you had download the rpm file. 

         shell > rpm -ivh MySQL-shared-5.5.9-1.linux2.6.x86_64.rpm


Afterward, you are able to continue install your Sysbench without the error as below shown.



MySQL Purge binlog Safely

First of all, please check slave server status with the SQL query below:

show slave status;

look for the "Relay_Master_Log_File" column, and see which master binlog the slave had replicated up to.
example data: mysql-bin.000096


At your master 
mysql> PURGE BINARY LOGS TO 'mysql-bin.000096';

Master will clean up the mysql binlog up to mysql-bin.000096 ( the file with this name will still remain there)



Wednesday, April 6, 2011

to allow the user to be able to execute linux command

add the <user_name> to the 
/etc/sudoers 

e.g line add

support ALL=(ALL) NOPASSWD:ALL

Because the file is a readonly file, you first need to change the file permission to allow write to the file by root user

chmod g+rw /etc/sudoers

and you have to change it back to readonly file

chmod g-r /etc/sudoers