はじめに

こんにちは。インフラエンジニアレベル1のf_prgです。
業務で、EC2(Amazon Linux)にJMeterをインストールしたのでその方法をご紹介します。

openjdkのインストールをします

[root@ip-10-0-0-98 ~]# yum -y install java-1.8.0-openjdk.x86_64

JMeterのセットアップをします

http://jmeter.apache.org/
にアクセスしまして
http://jmeter.apache.org/download_jmeter.cgi
よりダウンロードしてセットアップします。

[root@ip-10-0-0-98 ~]$ cd /opt
[root@ip-10-0-0-98 opt]$ curl -O http://ftp.jaist.ac.jp/pub/apache/jmeter/binaries/apache-jmeter-2.13.tgz
[root@ip-10-0-0-98 opt]$ tar vxzf apache-jmeter-2.13.tgz
[root@ip-10-0-0-98 opt]$ mv apache-jmeter-2.13 apache-jmeter

JMeterのパスを通します

[root@ip-10-0-0-98 ~]# echo 'export PATH=$PATH:/opt/apache-jmeter/bin/' >> /etc/profile.d/jmeter.sh
[root@ip-10-0-0-98 ~]# cat /etc/profile.d/jmeter.sh
export PATH=$PATH:/opt/apache-jmeter/bin/
[root@ip-10-0-0-98 ~]# source /etc/profile.d/jmeter.sh

サンプルの実行をしてみます

[root@ip-10-0-0-98 ~]# jmeter -n -t /opt/apache-jmeter/bin/examples/CSVSample.jmx -l /opt/apache-jmeter/bin/examples/CSVSample.jtl
Creating summariser 
Created the tree successfully using /opt/apache-jmeter/bin/examples/CSVSample.jmx
Starting the test @ Sun Apr 12 01:50:42 UTC 2015 (1428803442571)
Waiting for possible shutdown message on port 4445
summary =     12 in   3.2s =    3.7/s Avg:   252 Min:   147 Max:   336 Err:     0 (0.00%)
Tidying up ...    @ Sun Apr 12 01:50:45 UTC 2015 (1428803445895)
... end of run
[root@ip-10-0-0-98 ~]# jmeter -n -t /opt/apache-jmeter/bin/examples/PerformanceTestPlanMemoryThread.jmx
Creating summariser 
Created the tree successfully using /opt/apache-jmeter/bin/examples/PerformanceTestPlanMemoryThread.jmx
Starting the test @ Sun Apr 12 02:24:55 UTC 2015 (1428805495733)
Waiting for possible shutdown message on port 4445
summary +      2 in     7s =    0.3/s Avg:    25 Min:     1 Max:    49 Err:     2 (100.00%) Active: 1 Started: 1 Finished: 0
summary +     10 in    30s =    0.3/s Avg:     0 Min:     0 Max:     1 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =     12 in    37s =    0.3/s Avg:     4 Min:     0 Max:    49 Err:    12 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     1 Min:     0 Max:     4 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =     22 in    67s =    0.3/s Avg:     2 Min:     0 Max:    49 Err:    22 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     0 Min:     0 Max:     1 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =     32 in    97s =    0.3/s Avg:     2 Min:     0 Max:    49 Err:    32 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     0 Min:     0 Max:     1 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =     42 in   127s =    0.3/s Avg:     1 Min:     0 Max:    49 Err:    42 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     0 Min:     0 Max:     1 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =     52 in   157s =    0.3/s Avg:     1 Min:     0 Max:    49 Err:    52 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     0 Min:     0 Max:     1 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =     62 in   187s =    0.3/s Avg:     1 Min:     0 Max:    49 Err:    62 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     0 Min:     0 Max:     1 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =     72 in   217s =    0.3/s Avg:     1 Min:     0 Max:    49 Err:    72 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     0 Min:     0 Max:     1 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =     82 in   247s =    0.3/s Avg:     1 Min:     0 Max:    49 Err:    82 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     0 Min:     0 Max:     1 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =     92 in   277s =    0.3/s Avg:     1 Min:     0 Max:    49 Err:    92 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     0 Min:     0 Max:     1 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =    102 in   307s =    0.3/s Avg:     0 Min:     0 Max:    49 Err:   102 (100.00%)
summary +     10 in    30s =    0.3/s Avg:     1 Min:     0 Max:     6 Err:    10 (100.00%) Active: 1 Started: 1 Finished: 0
summary =    112 in   337s =    0.3/s Avg:     1 Min:     0 Max:    49 Err:   112 (100.00%)
summary +      9 in    24s =    0.4/s Avg: 40098 Min:     0 Max: 360877 Err:     9 (100.00%) Active: 0 Started: 1 Finished: 1
summary =    121 in   361s =    0.3/s Avg:  2983 Min:     0 Max: 360877 Err:   121 (100.00%)
Tidying up ...    @ Sun Apr 12 02:30:56 UTC 2015 (1428805856717)
... end of run

まとめ

今回のセットアップはここまでです。
jmxはGUIで作ったほうが良さそうですね。
前は、windows3台とmac1台からjmeterを回した記憶があります。懐かしい。

参考資料・リンク

http://jmeter.apache.org/

元記事はこちら

EC2(Amazon Linux)にJMeterをセットアップする方法