在liunx系统安装负载生成器(Load Generator)

#初始化系统

yum -y update

yum -y install ntpdate

ntpdate asia.pool.ntp.org

yum -y install wget make cmake vim gcc gcc-c++ ncurses ncurses-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers pcre pcre-devel zlip zlip-devel libtool-ltdl-devel openssh-clients 

#下载资源

mkdir -p  /srv/source

cd /srv/source/

wget https://sourceforge.net/projects/mcrypt/files/Libmcrypt/Production/libmcrypt-2.5.7.tar.gz

tar xf libmcrypt-2.5.7.tar.gz && cd libmcrypt-2.5.7
./configure && make -j16 && make install
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/
ldconfig

#内核参数调整
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.tcp_keepalive_time = 1200" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_tw_buckets = 5000" >> /etc/sysctl.conf
echo "net.core.somaxconn = 2048" >> /etc/sysctl.conf

#修改最大连接数
echo "* soft nofile 32768" >> /etc/security/limits.conf
echo "* hard nofile 65536" >> /etc/security/limits.conf

#关闭ipv6
touch /etc/modprobe.d/ipv6.conf
echo "install ipv6 /bin/true" > /etc/modprobe.d/ipv6.conf
echo "IPV6INIT=no" >> /etc/sysconfig/network
chkconfig ip6tables off

#创建别名
echo "alias le='netstat -lpant | grep LISTEN'" >> /root/.bashrc
source /root/.bashrc

#关闭防火墙

chkconfig --del iptables
service iptables stop

#下载loadGenerator,LoadRunner Generator for Linux.zip,下载地址:http://pan.baidu.com/s/1o6OQpfk

#安装前重启一下系统

reboot

#安装loadGenerator

yum -y install glibc.i686
yum -y install libstdc++.so.5

mkdir -p /home/LoadRunner/
cp Linux.tar.gz /home/LoadRunner/
cd /home/LoadRunner/
tar -zxvf /home/LoadRunner/Linux.tar.gz
rm -rf /home/LoadRunner/Linux.tar.gz
chmod +x -R /home/LoadRunner/Linux/
cd /home/LoadRunner/Linux/
./installer.sh

#环境变量 

echo 'export PRODUCT_DIR=/opt/HP/HP_LoadGenerator' >> /root/.bashrc
echo 'export M_LROOT=$PRODUCT_DIR' >> /root/.bashrc
echo 'export LD_LIBRARY_PATH=${M_LROOT}/bin' >> /root/.bashrc
echo 'export PATH=${M_LROOT}/bin:$PATH' >> /root/.bashrc
source /root/.bashrc

#启动

cd /opt/HP/HP_LoadGenerator/bin/
./m_daemon_setup start

 #查看进程是否启动,如下图所示:

PS:如果开启防火墙,需要将相应的端口打开。

#与本地windows下Controller建立连接 :

建立场景, 选择要执行的脚本,在Design模式下,点击 右边的Generators, 
在弹出的小窗口中点击Add, 添加新的Load Generator, 
在name处填写压力机的IP地址,在Platform处,选择UNIX, 
点击more,在Unix Environment 标签下, 勾选Don’t use RSH 项。 
点击 “OK”按钮, 
在Load Generators 页面中选择在刚添加的负载机上, 点击“Connect”, 连接成功。

 

 

 

posted @ 2017-09-18 16:08  alsoalso  阅读(384)  评论(0编辑  收藏  举报