1.下载
wget https://github.com/intel-cloud/cosbench/releases/download/v0.4.2.c4/0.4.2.c4.zip
2.解压下载依赖包
[root@lab102 cosbench]# unzip 0.4.2.zip
[root@lab102 cosbench]# yum install java-1.7.0-openjdk nmap-ncat
3.运行cosbench
[xxx@test-c117 ~]$ cd 0.4.2.c4
[xxx@test-c117 ~]$ chmod +x *.sh
[xxx@test-c117 ~]$ unset http_proxy
[xxx@test-c117 ~]$ ./start-all.sh
4.创建s3用户
[root@s1 ~]# radosgw-admin user create --uid=test1 --display-name="test1" --access-key=test1 --secret-key=test1
{
"user_id": "test1",
"display_name": "test1",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"auid": 0,
"subusers": [],
"keys": [
{
"user": "test1",
"access_key": "test1",
"secret_key": "test1"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"max_size_kb": -1,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"max_size_kb": -1,
"max_objects": -1
},
"temp_url_keys": []
}
- 配置文件
1.vi my_s3_ceph.conf 复制一下的内容
<?xml version="1.0" encoding="UTF-8" ?>
<workload name="my-s3-ceph" description="my s3 benchmark for s3">
<storage type="s3" config="accesskey=AAA;secretkey=XoH;endpoint=http://1.1.1.1:7480;path_style_access=true" />
<workflow>
<workstage name="init">
<work type="init" workers="1" config="cprefix=cephs3cosbench;containers=r(1,2)" />
</workstage>
<workstage name="prepare">
<work type="prepare" workers="1" config="cprefix=cephs3cosbench;containers=r(1,2);objects=r(1,10);sizes=c(64)KB" />
</workstage>
<workstage name="main">
<work name="main" workers="200" runtime="300">
<operation type="read" ratio="0" config="cprefix=cephs3cosbench;containers=u(1,2);objects=u(1,10)" />
<operation type="write" ratio="100" config="cprefix=cephs3cosbench;containers=u(1,2);objects=u(11,20);sizes=c(100)KB" />
</work>
</workstage>
<workstage name="cleanup">
<work type="cleanup" workers="1" config="cprefix=cephs3cosbench;containers=r(1,2);objects=r(1,20)" />
</workstage>
<workstage name="dispose">
<work type="dispose" workers="1" config="cprefix=cephs3cosbench;containers=r(1,2)" />
</workstage>
</workflow>
</workload>
workload name - 测试的时候显示的任务名称,可自行定义
description - 描述也是可自行定义
storage type - 类型就写s3
config - 对该类型的配置,要配置的就是accesskey、secretkey、endpoint和path_style_access,注意endpoint格式是host:port
workstage name - cosbench测试是分阶段按顺序执行,此处为init初始化阶段,主要是进行bucket的创建,workers表示执行该阶段的时候开启多少个工作线程,创建bucket通常不会计算为性能,所以单线程就可以;config处配置的是存储桶bucket的名称前缀,containers表示轮询数,上例中将会创建以cephs3cosbench为前缀,后缀分别为1和2的bucket
prepare阶段 - 配置为bucket写入的数据,除了要配置正确的bucket前缀,还要配置objects,表示一轮写入多少个对象,以及object的大小
main阶段 - 这里就是主要进行测试的阶段;runtime表示运行的时间;
operation type - 操作类型,可以是read、write、delete等,ratio表示该操作所占所有操作的比例,例如上例中仅测试写,因此read的比例为0,也可以直接删掉read操作;config中配置bucket的前缀后缀信息,值得注意的是write的sizes值适当修改
cleanup阶段 - 这个阶段是进行环境的清理,主要是删除bucket中的数据,保证测试后的数据不会保留在集群中
dispose阶段 - 这个阶段是删除bucket
2.启动测试
./cli.sh submit ~/my_s3_ceph.conf