1.下载

    1. wget https://github.com/intel-cloud/cosbench/releases/download/v0.4.2.c4/0.4.2.c4.zip

    2.解压下载依赖包

    1. [root@lab102 cosbench]# unzip 0.4.2.zip
    2. [root@lab102 cosbench]# yum install java-1.7.0-openjdk nmap-ncat

    3.运行cosbench

    1. [xxx@test-c117 ~]$ cd 0.4.2.c4
    2. [xxx@test-c117 ~]$ chmod +x *.sh
    3. [xxx@test-c117 ~]$ unset http_proxy
    4. [xxx@test-c117 ~]$ ./start-all.sh

    4.创建s3用户

    1. [root@s1 ~]# radosgw-admin user create --uid=test1 --display-name="test1" --access-key=test1 --secret-key=test1
    2. {
    3. "user_id": "test1",
    4. "display_name": "test1",
    5. "email": "",
    6. "suspended": 0,
    7. "max_buckets": 1000,
    8. "auid": 0,
    9. "subusers": [],
    10. "keys": [
    11. {
    12. "user": "test1",
    13. "access_key": "test1",
    14. "secret_key": "test1"
    15. }
    16. ],
    17. "swift_keys": [],
    18. "caps": [],
    19. "op_mask": "read, write, delete",
    20. "default_placement": "",
    21. "placement_tags": [],
    22. "bucket_quota": {
    23. "enabled": false,
    24. "max_size_kb": -1,
    25. "max_objects": -1
    26. },
    27. "user_quota": {
    28. "enabled": false,
    29. "max_size_kb": -1,
    30. "max_objects": -1
    31. },
    32. "temp_url_keys": []
    33. }
    1. 配置文件
      1.vi my_s3_ceph.conf 复制一下的内容
    1. <?xml version="1.0" encoding="UTF-8" ?>
    2. <workload name="my-s3-ceph" description="my s3 benchmark for s3">
    3. <storage type="s3" config="accesskey=AAA;secretkey=XoH;endpoint=http://1.1.1.1:7480;path_style_access=true" />
    4. <workflow>
    5. <workstage name="init">
    6. <work type="init" workers="1" config="cprefix=cephs3cosbench;containers=r(1,2)" />
    7. </workstage>
    8. <workstage name="prepare">
    9. <work type="prepare" workers="1" config="cprefix=cephs3cosbench;containers=r(1,2);objects=r(1,10);sizes=c(64)KB" />
    10. </workstage>
    11. <workstage name="main">
    12. <work name="main" workers="200" runtime="300">
    13. <operation type="read" ratio="0" config="cprefix=cephs3cosbench;containers=u(1,2);objects=u(1,10)" />
    14. <operation type="write" ratio="100" config="cprefix=cephs3cosbench;containers=u(1,2);objects=u(11,20);sizes=c(100)KB" />
    15. </work>
    16. </workstage>
    17. <workstage name="cleanup">
    18. <work type="cleanup" workers="1" config="cprefix=cephs3cosbench;containers=r(1,2);objects=r(1,20)" />
    19. </workstage>
    20. <workstage name="dispose">
    21. <work type="dispose" workers="1" config="cprefix=cephs3cosbench;containers=r(1,2)" />
    22. </workstage>
    23. </workflow>
    24. </workload>
    1. workload name - 测试的时候显示的任务名称,可自行定义
    2. description - 描述也是可自行定义
    3. storage type - 类型就写s3
    4. config - 对该类型的配置,要配置的就是accesskeysecretkeyendpointpath_style_access,注意endpoint格式是host:port
    5. workstage name - cosbench测试是分阶段按顺序执行,此处为init初始化阶段,主要是进行bucket的创建,workers表示执行该阶段的时候开启多少个工作线程,创建bucket通常不会计算为性能,所以单线程就可以;config处配置的是存储桶bucket的名称前缀,containers表示轮询数,上例中将会创建以cephs3cosbench为前缀,后缀分别为12bucket
    6. prepare阶段 - 配置为bucket写入的数据,除了要配置正确的bucket前缀,还要配置objects,表示一轮写入多少个对象,以及object的大小
    7. main阶段 - 这里就是主要进行测试的阶段;runtime表示运行的时间;
    8. operation type - 操作类型,可以是readwritedelete等,ratio表示该操作所占所有操作的比例,例如上例中仅测试写,因此read的比例为0,也可以直接删掉read操作;config中配置bucket的前缀后缀信息,值得注意的是writesizes值适当修改
    9. cleanup阶段 - 这个阶段是进行环境的清理,主要是删除bucket中的数据,保证测试后的数据不会保留在集群中
    10. dispose阶段 - 这个阶段是删除bucket

    2.启动测试

    1. ./cli.sh submit ~/my_s3_ceph.conf