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
if [ $? != "0" ];then
echo "wxWidgets-3.1.0 make fail "
exit 100
fi
echo " wxWidgets install successful"

cd /usr/local/src
tar xf otp_src_20.2.tar.gz
cd otp_src_20.2
./configure --prefix=/usr/local/erlang >/dev/null
if [ $? != "0" ];then
echo "otp_src_20.2 configure fail "
exit 100
fi
make >/dev/null && make install >/dev/null
if [ $? != "0" ];then
echo "otp_src_20.2 make fail "
exit 100
fi
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

cd /usr/local/src
tar zxf tsung-1.7.0.tar.gz
cd tsung-1.7.0
./configure --prefix=/usr/local/tsung1.7 >/dev/null
if [ $? != "0" ];then
echo "tsung-1.7.0 configure fail "
exit 100
fi
make >/dev/null && make install >/dev/null
if [ $? != "0" ];then
echo "tsung-1.7.0 make fail "
exit 100
fi
ln -sf /usr/local/tsung1.7/bin/tsung /usr/local/bin/tsung
echo "tsung install successful"

echo '''
192.168.4.72 master
192.168.4.73 slavea
192.168.4.75 slaveb
192.168.4.76 slavec
192.168.4.77 slaved
192.168.4.78 slavee
192.168.4.79 slavef
192.168.4.80 slaveg
192.168.4.81 slaveh
192.168.4.82 slavei
192.168.4.83 slavej
''' >> /etc/hosts


#cd /usr/local/src
#tar zxf Template-Toolkit-2.26.tar.gz
#cd Template-Toolkit-2.26
#cpan App::cpanminus

原文地址:https://www.cnblogs.com/NiceTime/p/9192631.html