天天看點

tsung性能測試環境部署腳本tsung_slave_setup

#!/bin/bash

#system init

#sysctl.conf

echo "net.ipv4.tcp_syncookies=1" >> /etc/sysctl.conf

echo "net.ipv4.tcp_tw_reuse=1" >> /etc/sysctl.conf

echo "net.ipv4.tcp_tw_recycle=1" >> /etc/sysctl.conf

echo "net.ipv4.tcp_fin_timeout=30" >> /etc/sysctl.conf

echo "net.ipv4.ip_local_port_range=1024 65535" >> /etc/sysctl.conf

echo "fs.nr_open=10240000" >> /etc/sysctl.conf

echo "fs.file-max=10240000" >> /etc/sysctl.conf

sysctl -p

#firewalld

systemctl disable firewalld.service

#ulimit

echo "* soft nofile 1024000" > /etc/security/limits.conf

echo "* hard nofile 1024000" >> /etc/security/limits.conf

echo "* soft nproc 1024000" >> /etc/security/limits.conf

echo "* hard nproc 1024000" >> /etc/security/limits.conf

echo "root soft nproc unlimited" > /etc/security/limits.d/20-nproc.conf

#sshd

sed -i 's/\#RSAAuthentication/RSAAuthentication/g' /etc/ssh/sshd_config

sed -i 's/\#PubkeyAuthentication/PubkeyAuthentication/g' /etc/ssh/sshd_config

systemctl restart sshd.service

#yum

yum -y install unixODBC unixODBC-devel perl perl-devel gcc openssl-devel gcc-c++ ncurses-devel gtk2-devel gnuplot gd libpng zlib bzip2 cpan mesa* freeglut* wget

#install soft

cd /usr/local/src

wget http://192.168.1.176:10086/tsung/{otp_src_20.2.tar.gz,Template-Toolkit-2.26.tar.gz,tsung-1.7.0.tar.gz,wxWidgets-3.1.0.tar.bz2}

tar -xf wxWidgets-3.1.0.tar.bz2

cd wxWidgets-3.1.0

./configure --with-opengl --enable-debug --enable-unicode >/dev/null

if [ $? != "0" ];then

echo "wxWidgets-3.1.0 configure fail "

exit 100

fi

make >/dev/null && make install >/dev/null

echo "wxWidgets-3.1.0 make fail "

echo " wxWidgets install successful"

tar xf otp_src_20.2.tar.gz

cd otp_src_20.2

./configure --prefix=/usr/local/erlang >/dev/null

echo "otp_src_20.2 configure fail "

echo "otp_src_20.2 make fail "

ln -sf /usr/local/erlang/bin/erl /usr/local/bin/erl

echo "erlang install successful"

echo "ERLANG_HOME=/usr/local/erlang" >> /etc/profile

echo "TSUNG_HOME=/usr/local/tsung1.7" >> /etc/profile

echo 'PATH=$TSUNG_HOME/bin:$ERLANG_HOME/bin:$PATH' >> /etc/profile

echo 'export TSUNG_HOME ERLANG_HOME PATH' >> /etc/profile

source /etc/profile

tar zxf tsung-1.7.0.tar.gz

cd tsung-1.7.0

./configure --prefix=/usr/local/tsung1.7 >/dev/null

echo "tsung-1.7.0 configure fail "

echo "tsung-1.7.0 make fail "

ln -sf /usr/local/tsung1.7/bin/tsung /usr/local/bin/tsung

echo "tsung install successful"