1、检测erlang是否支持ssl
打印ok表示支持;
如果支持,则直接配置tsung.xml
2、不支持,先确保linux系统已经安装了openssl
也可重新安装:
yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel java-1.8.0-openjdk-devel
3、重新编译安装erlang
解压安装包,进入erlang安装文件夹;
1、安装依赖项 yum install -y epel-release 2、添加存储库条目 wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm rpm -Uvh erlang-solutions-1.0-1.noarch.rpm 3、安装 yum install -y erlang 4、验证是否安装成功 erl -version
4、重新编译tsung
需要重新解压,进入解压之后的安装文件夹;
wget http://tsung.erlang-projects.org/dist/tsung-1.7.0.tar.gz # 以1.7.0版本为例 tar -zxf tsung-1.7.0.tar.gz # 解压 cd tsung-1.7.0 # 进入目录 ./configure # 配置,生成 Makefile 文件 make # 编译 make install # 安装
5、配置tsung.xml
<?xml version="1.0"?> <!DOCTYPE tsung SYSTEM "/usr/local/tsung/share/tsung/tsung-1.0.dtd"> <tsung loglevel="debug" version="1.0" dumptraffic="true"> <!-- Client side setup --> <clients> <client host="localhost" use_controller_vm="true" maxusers="1000"/> </clients> <!-- Server side setup --> <servers> <server host="baidu.com" port="443" type="ssl"></server> </servers> <!-- to start os monitoring (cpu, network, memory). Use an erlang agent on the remote machine or SNMP. erlang is the default --> <monitoring> <monitor host="myserver" type="snmp"></monitor> </monitoring> <load> <!-- several arrival phases can be set: for each phase, you can set the mean inter-arrival time between new clients and the phase duration --> <arrivalphase phase="1" duration="30" unit="minute"> <users maxnumber="1000" arrivalrate="2" unit="second"></users> </arrivalphase> </load> <options> <option type="ts_http" name="user_agent"> <user_agent probability="80">Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Galeon/1.3.21</user_agent> <user_agent probability="20">Mozilla/5.0 (Windows; U; Windows NT 5.2; fr-FR; rv:1.7.8) Gecko/20050511 Firefox/1.0.4</user_agent> </option> </options> <sessions> <session name="http-example" probability="100" type="ts_http"> <!-- full url with server name, this overrides the "server" config value --> <request> <http url="https://www.baidu.com" method="GET" version="1.1"></http> </request> </session> </sessions> </tsung>