赞
踩
因部署完对象存储,需要进行性能测试,使用到cosbench,进而稍加整理至此
COSBench 是一个用于测试云对象存储系统的分布式基准测试工具,也允许用户为额外的存储系统创建适配器。
由两个主要组件组成
Driver(Load Generator):
Controller:
两个组件可以混合部署在一个节点上,也可以分开来部署
1、java: 需要java1.6 版本及以上
2、nc(nmap-ncat): 用来检测服务端口
[root@ceph-node1 ~]# yum install java nc
[root@ceph-node1 ~]# java -version #测试java是否可用
openjdk version "1.8.0_312"
OpenJDK Runtime Environment (build 1.8.0_312-b07)
OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
[root@ceph-node1 ~]# wget https://github.com/intel-cloud/cosbench/releases/download/v0.4.2.c4/0.4.2.c4.zip [root@ceph-node1 ~]# unzip 0.4.2.c4.zip 官方英文使用文档(超详细,可以翻翻看) [root@ceph-node1 0.4.2.c4]# ll *.pdf -rw-r--r--. 1 root root 348912 Jul 9 2014 3rd-party-licenses.pdf -rw-r--r--. 1 root root 985318 Jul 9 2014 COSBenchAdaptorDevGuide.pdf -rw-r--r--. 1 root root 2516640 Apr 27 2016 COSBenchUserGuide.pdf 服务调用脚本说明 [root@ceph-node1 0.4.2.c4]# ll *.sh -rw-r--r--. 1 root root 2639 Oct 30 00:25 cli.sh #通过命令行操作cosbench -rw-r--r--. 1 root root 2944 Apr 27 2016 cosbench-start.sh #其他启动脚本调用的脚本 -rw-r--r--. 1 root root 1423 Dec 30 2014 cosbench-stop.sh #其他启动脚本调用的脚本 -rw-r--r--. 1 root root 727 Apr 27 2016 start-all.sh #在当前节点启动driver和controller组件 -rw-r--r--. 1 root root 724 Apr 27 2016 stop-all.sh #在当前节点停止driver和controller组件 -rw-r--r--. 1 root root 1062 Jul 9 2014 start-controller.sh #在当前节点启动controller -rw-r--r--. 1 root root 1912 Oct 30 00:22 start-driver.sh #在当前节点启动driver -rw-r--r--. 1 root root 809 Jul 9 2014 stop-controller.sh #在当前节点关闭controller -rw-r--r--. 1 root root 1490 Apr 27 2016 stop-driver.sh #在当前节点关闭driver
默认driver配置的页面地址为127.0.0.1,要修改为当前服务器IP,用以其他节点访问
[root@ceph-node1 0.4.2.c4]# cat /root/0.4.2.c4/start-driver.sh
#!/bin/bash
ip=192.168.1.51 #默认为127.0.0.1,将之修改为部署节点的IP,供其他节点访问
num=1
base_port=18088
……
启动前为了保证driver和controller之间交互正常,需要关闭HTTP代理 [root@ceph-node1 0.4.2.c4]# unset http_proxy 启动controller和driver [root@ceph-node1 0.4.2.c4]# sh start-all.sh Launching osgi framwork ... Successfully launched osgi framework! Booting cosbench driver ... . Starting cosbench-log_0.4.2 [OK] . Starting cosbench-tomcat_0.4.2 [OK] Starting cosbench-config_0.4.2 [OK] Starting cosbench-http_0.4.2 [OK] Starting cosbench-cdmi-util_0.4.2 [OK] Starting cosbench-core_0.4.2 [OK] Starting cosbench-core-web_0.4.2 [OK] Starting cosbench-api_0.4.2 [OK] Starting cosbench-mock_0.4.2 [OK] Starting cosbench-ampli_0.4.2 [OK] Starting cosbench-swift_0.4.2 [OK] Starting cosbench-keystone_0.4.2 [OK] Starting cosbench-httpauth_0.4.2 [OK] Starting cosbench-s3_0.4.2 [OK] Starting cosbench-librados_0.4.2 [OK] Starting cosbench-scality_0.4.2 [OK] Starting cosbench-cdmi-swift_0.4.2 [OK] Starting cosbench-cdmi-base_0.4.2 [OK] Starting cosbench-driver_0.4.2 [OK] Starting cosbench-driver-web_0.4.2 [OK] Successfully started cosbench driver! Listening on port 0.0.0.0/0.0.0.0:18089 ... Persistence bundle starting... Persistence bundle started. ---------------------------------------------- !!! Service will listen on web port: 18088 !!! ---------------------------------------------- ====================================================== Launching osgi framwork ... Successfully launched osgi framework! Booting cosbench controller ... . Starting cosbench-log_0.4.2 [OK] . Starting cosbench-tomcat_0.4.2 [OK] Starting cosbench-config_0.4.2 [OK] Starting cosbench-core_0.4.2 [OK] Starting cosbench-core-web_0.4.2 [OK] Starting cosbench-controller_0.4.2 [OK] Starting cosbench-controller-web_0.4.2 [OK] Successfully started cosbench controller! Listening on port 0.0.0.0/0.0.0.0:19089 ... Persistence bundle starting... Persistence bundle started. ---------------------------------------------- !!! Service will listen on web port: 19088 !!! ----------------------------------------------
[root@ceph-node1 0.4.2.c4]# netstat -nplt |grep 18088
tcp6 0 0 :::18088 :::* LISTEN 6084/java
[root@ceph-node1 0.4.2.c4]# netstat -nplt |grep 19088
tcp6 0 0 :::19088 :::* LISTEN 6235/java
[root@ceph-node1 0.4.2.c4]# ps aux |grep java
root 6084 5.3 4.4 3562620 178000 pts/1 Sl 02:26 0:10 java -Dcosbench.tomcat.config=conf/driver-tomcat-server.xml -server -cp main/org.eclipse.equinox.launcher_1.2.0.v20110502.jar org.eclipse.equinox.launcher.Main -configuration conf/.driver -console 18089
root 6235 5.2 3.8 3555108 153032 pts/1 Sl 02:26 0:10 java -Dcosbench.tomcat.config=conf/controller-tomcat-server.xml -server -cp main/org.eclipse.equinox.launcher_1.2.0.v20110502.jar org.eclipse.equinox.launcher.Main -configuration conf/.controller -console 19089
root 6327 0.0 0.0 112812 980 pts/1 S+ 02:29 0:00 grep --color=auto java
使用cli.sh查看启动信息
[root@ceph-node1 0.4.2.c4]# sh cli.sh info
Drivers:
driver1 http://127.0.0.1:18088/driver
Total: 1 drivers
Active Workloads:
Total: 0 active workloads
由上信息得知,controller和driver都已启动
报错提示:
如果不安装nc,会报错
which: no nc in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
No appropriate tool found to detect cosbench driver status.
如果不安装java,会报
Ncat: Connection refused.
访问http://:19088/controller/index.html验证
controller可以管理多个driver,在默认的一个driver之外,可以部署多个driver,用以平均负载。driver有多种部署方式
这里实验环境,使用方法2实验
修改controller配置文件: [root@ceph-node1 0.4.2.c4]# cat conf/controller.conf [controller] drivers = 3 log_level = INFO log_file = log/system.log archive_dir = archive [driver1] name = driver1 url = http://192.168.1.51:18088/driver [driver2] name = driver2 url = http://192.168.1.51:18188/driver [driver3] name = driver3 url = http://192.168.1.51:18288/driver
[root@ceph-node1 0.4.2.c4]# sh start-all.sh ………… Successfully started cosbench driver! Listening on port 0.0.0.0/0.0.0.0:18089 ... Persistence bundle starting... Persistence bundle started. ---------------------------------------------- !!! Service will listen on web port: 18088 !!! ---------------------------------------------- ………… Successfully started cosbench controller! Listening on port 0.0.0.0/0.0.0.0:19089 ... Persistence bundle starting... Persistence bundle started. ---------------------------------------------- !!! Service will listen on web port: 19088 !!! ----------------------------------------------
默认driver使用的是18088端口,这里其他端口用18188/18288
命令格式:sh start-driver.sh n ip base-port (默认会创建出来两个driver节点) 参数详解: n:第几个节点(不重复即可) ip:部署节点ip base-port:部署使用的端口 启动 [root@ceph-node1 0.4.2.c4]# sh start-driver.sh 2 192.168.1.51 18188 ……………… Successfully started cosbench driver! Listening on port 0.0.0.0/0.0.0.0:18189 ... Persistence bundle starting... Persistence bundle started. ---------------------------------------------- !!! Service will listen on web port: 18188 !!! ---------------------------------------------- …………………… Successfully started cosbench driver! Listening on port 0.0.0.0/0.0.0.0:18289 ... Persistence bundle starting... Persistence bundle started. ---------------------------------------------- !!! Service will listen on web port: 18288 !!! ----------------------------------------------
[root@ceph-node1 0.4.2.c4]# ps aux |grep java
root 8103 2.8 4.3 3568764 175888 pts/1 Sl 03:35 0:13 java -Dcosbench.tomcat.config=conf/driver-tomcat-server.xml -server -cp main/org.eclipse.equinox.launcher_1.2.0.v20110502.jar org.eclipse.equinox.launcher.Main -configuration conf/.driver -console 18189
root 8263 2.4 4.2 3564640 172748 pts/1 Sl 03:35 0:11 java -Dcosbench.tomcat.config=conf/driver-tomcat-server.xml -server -cp main/org.eclipse.equinox.launcher_1.2.0.v20110502.jar org.eclipse.equinox.launcher.Main -configuration conf/.driver -console 18289
root 8431 18.5 4.0 3563672 161632 pts/1 Sl 03:42 0:11 java -Dcosbench.tomcat.config=conf/driver-tomcat-server.xml -server -cp main/org.eclipse.equinox.launcher_1.2.0.v20110502.jar org.eclipse.equinox.launcher.Main -configuration conf/.driver -console 18089
root 8582 15.0 3.5 3550292 142732 pts/1 Sl 03:42 0:08 java -Dcosbench.tomcat.config=conf/controller-tomcat-server.xml -server -cp main/org.eclipse.equinox.launcher_1.2.0.v20110502.jar org.eclipse.equinox.launcher.Main -configuration conf/.controller -console 19089
root 9092 0.0 0.0 112812 976 pts/1 S+ 03:43 0:00 grep --color=auto java
[root@ceph-node1 0.4.2.c4]# cat conf/s3-config-sample.xml <?xml version="1.0" encoding="UTF-8" ?> <workload name="s3-sample" description="sample benchmark for s3"> <storage type="s3" config="accesskey=<accesskey>;secretkey=<scretkey>;proxyhost=<proxyhost>;proxyport=<proxyport>;endpoint=<endpoint>" /> <workflow> <workstage name="init"> <work type="init" workers="1" config="cprefix=s3testqwer;containers=r(1,2)" /> </workstage> <workstage name="prepare"> <work type="prepare" workers="1" config="cprefix=s3testqwer;containers=r(1,2);objects=r(1,10);sizes=c(64)KB" /> </workstage> <workstage name="main"> <work name="main" workers="8" runtime="30"> <operation type="read" ratio="80" config="cprefix=s3testqwer;containers=u(1,2);objects=u(1,10)" /> <operation type="write" ratio="20" config="cprefix=s3testqwer;containers=u(1,2);objects=u(11,20);sizes=c(64)KB" /> </work> </workstage> <workstage name="cleanup"> <work type="cleanup" workers="1" config="cprefix=s3testqwer;containers=r(1,2);objects=r(1,20)" /> </workstage> <workstage name="dispose"> <work type="dispose" workers="1" config="cprefix=s3testqwer;containers=r(1,2)" /> </workstage> </workflow> </workload>
main的方式是将读写任务写在一个work里,混合读写
也可以直接跳过prepare和main阶段,直接进行写的操作,再直接进行读
示例:
<workstage name="write">
<work name="write" workers="64" totalOps="100000">
<operation type="write" config="cprefix=cosbench;containers=r(1,1);objects=r(1,100000);sizes=c(4)KB" />
</work>
</workstage>
<workstage name="read">
<work name="read" workers="64" totalOps="100000">
<operation type="read" config="cprefix=cosbench;containers=r(1,1);objects=r(1,100000)" />
</work>
</workstage>
[root@ceph-node1 0.4.2.c4]# cat conf/s3-config-test.xml <?xml version="1.0" encoding="UTF-8" ?> <workload name="s3-test1" description="10-100-4kb-test"> <storage type="s3" config="accesskey=OZGQE03XOX2DDD77M9OX;secretkey=yvqhvuWg7mGKWfx3JGggtgM6LdDnkeJhxj8MHJeg;endpoint=http://192.168.1.51:7480" /> <workflow> <workstage name="init"> <work type="init" workers="1" config="cprefix=cosbench;containers=r(1,1)" /> </workstage> <workstage name="prepare"> <work type="prepare" workers="1" config="cprefix=cosbench;containers=r(1,1);objects=r(1,100);sizes=c(4)KB" /> </workstage> <workstage name="main"> <work name="main" workers="8" runtime="30"> <operation type="read" ratio="80" config="cprefix=cosbench;containers=u(1,1);objects=u(1,100)" /> <operation type="write" ratio="20" config="cprefix=cosbench;containers=u(1,1);objects=u(100,200);sizes=c(4)KB" /> </work> </workstage> <workstage name="cleanup"> <work type="cleanup" workers="1" config="cprefix=cosbench;containers=r(1,1);objects=r(1,200)" /> </workstage> <workstage name="dispose"> <work type="dispose" workers="1" config="cprefix=cosbench;containers=r(1,1)" /> </workstage> </workflow> </workload>
两种启动方式
[root@ceph-node1 0.4.2.c4]# sh cli.sh submit conf/s3-config-test.xml
Accepted with ID: w3
上传文件执行submit
1、正在运行中的任务
2、结束的任务
3、点击结束任务列中【view details】详情中可查看测试结果
主要看后四个值!!
也可以查看定义的各个任务,查看是否有失败的任务
End……
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。