mysql壓測

pathfinder_cui發表於2015-11-02
壓測收集統計資訊指令碼
#!/bin/sh

INTERVAL=5
PREFIX=$INTERVAL-sec-status
RUNFILE=/tmp/running
mysql -e 'show global variables' >> mysql-variables
while test -e $RUNFILE; do
   file=$(date +%F_%I)
   sleep=$(date +%s.%N | awk "{print $INTERVAL - (\$1 % $INTERVAL)}")
   sleep $sleep
   ts="$(date +"TS %s.%N %F %T")"
   loadavg="$(uptime)"
   echo "$ts $loadavg" >> $PREFIX-${file}-status
   mysql -e 'show global status' >> $PREFIX-${file}-innodbstatus &
   echo "$ts $loadavg" >> $PREFIX-${file}-innodbstatus
   mysql -e 'SHOW ENGINE INNODB STATUS\G' >> $PREFIX-${file}-innodbstatus &
   echo "$ts $loadavg" >> $PREFIX-${file}-processlist
   mysql -e 'SHOW FULL processlist\G' >> $PREFIX-${file}-processlist &
   echo $ts
done
echo Exiting because $RUNFILE does not exist.

sysbench
Sysbench是一個模組化、跨平臺、多執行緒基準測試工具,主要用於評估測試各種不同的系統引數下的資料庫負載情況.
1.CPU效能
2.磁碟I/O效能
3.排程程式效能
4.記憶體分配已經傳輸速度
5.POSIX執行緒效能
6.資料庫效能(OLTP基準測試)

yum install -y automake wget libtool zlib-devel
wget
tar zxvf  sysbench-0.4.10.tar.gz
cd sysbench-0.4.10
sed -i 's/AC_PROG_LIBTOOL/#AC_PROG_LIBTOOL/g' configure.ac
sed -i '/#AC_PROG_LIBTOOL/a AC_PROG_RANLIB' configure.ac
mkdir /usr/local/sysbench
vim /etc/profile.d/sysbench.sh
export LD_LIBRARY_PATH=/mysql/lib
export PATH=/usr/local/sysbench/bin:$PATH

./autogen.sh
./configure --prefix=/usr/local/sysbench --with-mysql-includes=/usr/include --with-mysql-libs=/usr/lib64
 
make && make install

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29620572/viewspace-1820780/,如需轉載,請註明出處,否則將追究法律責任。

相關文章