1.rally简介

    OpenStack Rally 是一个自动化测试工具,社区希望通过 Rally 来解答 “How does OpenStack work at scale?(如何规模化运行 OpenStack)” 的问题。为了实现这一目的,Rally 被设计成集自动化部署、功能验证、性能测试和分析报告于一体,作为 OpenStack CI/CD 系统中的基础工具,帮助用户不断提高系统的 SLA(服务等级协议)、性能和稳定性。

    简而言之,Rally 能够帮助用户完成整个 OpenStack 平台或者某个单一组件功能的压力测试,帮助用户验证和评估稳定系统工作负载的规模。

2.应用场景

  1. 应用案例

    自动化测试、分析,评估新引入的代码如何影响云平台的性能;
    自动化测试、分析新引入的代码是否完美兼容云平台功能清单;
    评估不同的部署方式如何影响云平台的性能,以此得出性能峰值最高的云平台部署架构;
    评估不同硬件设备对云平台的性能影响,以此得出性能峰值最高的云平台硬件设施;

  2. rally架构

上图是 Rally 的总体架构,描述了 Rally 的组成结构、数据流和 OpenStack 的调用方式。

Deploy Engine:存储部署所需要的凭证(credentials)信息,以插件的形式集成第三方自动化部署工具(e.g. Devstack, Fuel, etc.),提供自动化部署能力。
Verification:通过调用 Tempest(基于 unittest 的功能测试框架)来验证云平台的功能清单。
Benchmark Engine/Task Engine:是一个通用的测试用例插件框架,允许用户编写参数化的 Plugin 实现以及对应的 Task
File(YAML/JSON)来满足自定义功能、性能测试需求,使用这种通用的方式来生成真实的用户负载。

    Rally 最初被设计成一种不需要 Daemon 的 CLI-Driver,这使 Rally 非常易于使用和开发。但通常 OpenStack Projects 总是以 “as-a-Service” 来实现的,所以现在社区也提出了 RaaS 的理念,并付诸于行动(work in progress)。

上图描述了 “Rally-as-a-Service” 和 “Rally-as-an-APP” 两种形式的实现架构,显然两者在实现上的区别主要在于是否具有 Daemon 以及相应的 HTTP、RPC Invoke,也就是所谓的是否实现了泛 “Service” 化。实际上,对于用户而言无需太过于关心上层的调用方式,用户只需关心 Rally Core 的 Benchmark Engine/Task Framework 的应用。所以本文采用的是更为成熟、简单以及常用的 “Rally-as-an-APP” 模式。

5.安装及使用
5.1 安装

在kolla环境中,直接在globals.yml中开启rally。

enable_rally: yes

如果是性能测试设计主机关闭等操作,建议rally安装在一台非测试节点的机器。

安装完优化一下参数,rally配置文件位置:/etc/rally/rally.conf

默认注释所有选项,测试中遇到如下问题:

获取实例状态超时
连接超时

做如下设置,避免超时影响测试结果,时间设置1800s:

[DEFAULT]
openstack_client_http_timeout = 1800.0
[benchmark]
cinder_volume_create_timeout = 1800.0
cinder_volume_delete_timeout = 1800.0
nova_server_boot_timeout = 1800.0
nova_server_boot_timeout = 1800.0

5.2.1 创建deployment

1.使用环境变量创建

安装rally客户端
yum install python-rally  openstack-rally  

rally deployment create --fromenv  --name=existing
[root@kolla ~]#  rally deployment  create --fromenv --name=existing
Database is missing. Create database by command `rally db create'

[root@kolla ~]# rally db create
Creating database: sqlite:////tmp/rally.sqlite
Database created successfully
[root@kolla ~]#  rally deployment  create --fromenv --name=existing
    Env manager got invalid spec:
["There is no Platform plugin with name: 'existing@openstack'"]

问题1:
    Env manager got invalid spec:
["There is no Platform plugin with name: 'existing@openstack'"]
解决办法:
pip  install rally-openstack  

问题2:
[root@kolla ~]# rally deployment create --fromenv --name=existing
2019-06-25 12:06:23.098 139478 WARNING rally.common.plugin.discover [-]      Failed to load plugins from module 'rally_openstack' (package: 'rally-openstack 1.5.0'): (Babel 2.3.4 (/usr/lib/python2.7/site-packages), Requirement.parse('Babel!=2.4.0,>=2.5.3'), set(['python-watcherclient'])): ContextualVersionConflict: (Babel 2.3.4 (/usr/lib/python2.7/site-packages), Requirement.parse('Babel!=2.4.0,>=2.5.3'), set(['python-watcherclient']))
Env manager got invalid spec:
["There is no Platform plugin with name: 'existing@openstack'"]
pip install Babel==2.6.0
问题3:
[root@kolla ~]# rally deployment create --fromenv --name=existing
2019-06-25 12:10:34.774 139579 WARNING rally.common.plugin.discover [-]      Failed to load plugins from module 'rally_openstack' (package: 'rally-openstack 1.5.0'): (urllib3 1.21.1 (/usr/lib/python2.7/site-packages), Requirement.parse('urllib3>=1.23'), set(['kubernetes'])): ContextualVersionConflict: (urllib3 1.21.1 (/usr/lib/python2.7/site-packages), Requirement.parse('urllib3>=1.23'), set(['kubernetes']))
Env manager got invalid spec:
["There is no Platform plugin with name: 'existing@openstack'"]

[root@kolla ~]# pip install urllib3==1.23
Collecting urllib3==1.23
  Downloading http://pypi.doubanio.com/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 1.5MB/s
Installing collected packages: urllib3
  Found existing installation: urllib3 1.21.1
    Uninstalling urllib3-1.21.1:
      Successfully uninstalled urllib3-1.21.1
Successfully installed urllib3-1.23
问题3:
[root@kolla ~]# rally deployment create --fromenv --name=existing
2019-06-25 12:11:29.250 139609 WARNING rally.common.plugin.discover [-]      Failed to load plugins from module 'rally_openstack' (package: 'rally-openstack 1.5.0'): (keystoneauth1 3.10.0 (/usr/lib/python2.7/site-packages), Requirement.parse('keystoneauth1>=3.13.0'), set(['openstacksdk'])): ContextualVersionConflict: (keystoneauth1 3.10.0 (/usr/lib/python2.7/site-packages), Requirement.parse('keystoneauth1>=3.13.0'), set(['openstacksdk']))
Env manager got invalid spec:
["There is no Platform plugin with name: 'existing@openstack'"]
[root@kolla ~]# pip install keystoneauth1>=3.13.0
You are using pip version 8.1.2, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@kolla ~]# pip install keystoneauth1==3.13.0
Collecting keystoneauth1==3.13.0
  Downloading http://pypi.doubanio.com/packages/70/30/9649e83a663c8d60925f3e043f2926fed8a30505eb7340eab4be510f8230/keystoneauth1-3.13.0-py2.py3-none-any.whl (302kB)
    100% |████████████████████████████████| 307kB 7.7MB/s 

[root@kolla ~]# rally deployment create --fromenv --name=existing
2019-06-25 12:12:09.576 139634 WARNING rally_openstack.platforms.existing [-] endpoint is deprecated and not used.
+--------------------------------------+----------------------------+----------+------------------+--------+
| uuid                                 | created_at                 | name     | status           | active |
+--------------------------------------+----------------------------+----------+------------------+--------+
| 2c09ef0f-b213-4b64-b056-14ccde426435 | 2019-06-25T04:12:09.490709 | existing | deploy->finished |        |
+--------------------------------------+----------------------------+----------+------------------+--------+
Using deployment: 2c09ef0f-b213-4b64-b056-14ccde426435
~/.rally/openrc was updated

HINTS:

* To use standard OpenStack clients, set up your env by running:
    source ~/.rally/openrc
  OpenStack clients are now configured, e.g run:
    openstack image list

2.使用json模板创建

vim /root/rally-openstack/samples/deployment/existing.json
{
    "openstack": {
        "auth_url": "http://10.0.1.200:5000/v3",
        "region_name": "RegionOne",
        "endpoint_type": "public",
        "admin": {
            "username": "admin",
            "password": "aSFGmOilNvWdfNViQfhMYBy5owf79hArIpfSXD8d",
            "tenant_name": "admin"
        },
        "https_insecure": false,
        "https_cacert": ""
    }
}

[root@kolla ~]# rally deployment create --filename=/root/rally-openstack/samples/deployments/existing.json --name=exsisting2
+--------------------------------------+----------------------------+------------+------------------+--------+
| uuid                                 | created_at                 | name       | status           | active |
+--------------------------------------+----------------------------+------------+------------------+--------+
| 22c66610-42f2-4ba3-994e-07a0ee0c7fc2 | 2019-06-25T06:11:36.379447 | exsisting2 | deploy->finished |        |
+--------------------------------------+----------------------------+------------+------------------+--------+
Using deployment: 22c66610-42f2-4ba3-994e-07a0ee0c7fc2
~/.rally/openrc was updated

HINTS:

* To use standard OpenStack clients, set up your env by running:
    source ~/.rally/openrc
  OpenStack clients are now configured, e.g run:
    openstack image list

rally deployment show
rally deployment list  

5.2.2 检查deployment

检查创建的deployment各项服务是否正常,以下是执行结果

[root@kolla ~]# rally deployment check
--------------------------------------------------------------------------------
Platform openstack:
--------------------------------------------------------------------------------

Available services:
+-------------+----------------+-----------+
| Service     | Service Type   | Status    |
+-------------+----------------+-----------+
| __unknown__ | alarming       | Available |
| __unknown__ | compute_legacy | Available |
| __unknown__ | event          | Available |
| __unknown__ | placement      | Available |
| __unknown__ | sharev2        | Available |
| barbican    | key-manager    | Available |
| cinder      | volume         | Available |
| cinder      | volumev2       | Available |
| cinder      | volumev3       | Available |
| cloud       | cloudformation | Available |
| glance      | image          | Available |
| gnocchi     | metric         | Available |
| heat        | orchestration  | Available |
| keystone    | identity       | Available |
| manila      | share          | Available |
| neutron     | network        | Available |
| nova        | compute        | Available |
+-------------+----------------+-----------+

5.3 执行task

Task是Rally执行的一个测试单元,执行Task时需要指定入口文件,可以是json文件或者yaml文件1

rally task start  /rally-openstack/samples/tasks/scenarios/nova/boot_ljy.yaml

5.4 应用场景
5.4.1 创建和删除虚拟机

vim boot-and-delete.json​
{% set flavor_name = flavor_name or "m1.tiny" %}
{
    "NovaServers.boot_and_delete_server": [
        {
            "args": {
                "flavor": {
                    "name": "{{flavor_name}}"
                },
                "image": {
                    "name": "^cirros.*-disk$"
                },
                "force_delete": false
            },
            "runner": {
                "type": "constant",
                "times": 10,
                "concurrency": 2
            },
            "context": {
                "users": {
                    "tenants": 3,
                    "users_per_tenant": 2
                }
            },
            "sla": {
                "failure_rate": {
                    "max": 0
                }
            }
        },
        {
            "args": {
                "flavor": {
                    "name": "{{flavor_name}}"
                },
                "image": {
                    "name": "^cirros.*-disk$"
                },
                "auto_assign_nic": true
            },
            "runner": {
                "type": "constant",
                "times": 10,
                "concurrency": 2
            },
            "context": {
                "users": {
                    "tenants": 3,
                    "users_per_tenant": 2
                },
                "network": {
                    "start_cidr": "10.2.0.0/24",
                    "networks_per_tenant": 2
                }
            },
            "sla": {
                "failure_rate": {
                    "max": 0
                }
            }
        }
    ]
}

5.4.2 创建云盘

[root@kolla cinder]# cat create-volume.json
{
    "CinderVolumes.create_volume": [
        {
            "args": {
                "size": 1
            },
            "runner": {
                "type": "constant",
                "times": 3,
                "concurrency": 2
            },
            "context": {
                "users": {
                    "tenants": 2,
                    "users_per_tenant": 2
                }
            },
            "sla": {
                "failure_rate": {
                    "max": 0
                }
            }
        },
        {
            "args": {
                "size": {
                    "min": 1,
                    "max": 5
                }
            },
            "runner": {
                "type": "constant",
                "times": 3,
                "concurrency": 2
            },
            "context": {
                "users": {
                    "tenants": 2,
                    "users_per_tenant": 2
                }
            },
            "sla": {
                "failure_rate": {
                    "max": 0
                }
            }
        }
    ]
}

5.4.3 创建和删除网络

rally)[root@control01 ljy]# more create-and-delete-networks.yaml
---
  NeutronNetworks.create_and_delete_networks:
    -
      args:
        network_create_args: {}
      runner:
        type: "constant"
        times: 10
        concurrency: 1
      context:
        users:
          tenants: 3
          users_per_tenant: 3
        quotas:
          neutron:
            network: -1
      sla:
        failure_rate:
          max: 0

5.5 查看task

可使用rally task list,来列出已经执行的task

rally task list
+--------------------------------------+-----------------+---------------------+---------------+----------+--------+
| UUID                                 | Deployment name | Created at          | Load duration | Status   | Tag(s) |
+--------------------------------------+-----------------+---------------------+---------------+----------+--------+
| 11d01654-4ba6-4adf-9d1e-2612eb9e0716 | existing        | 2019-06-25 06:20:27 | 3.244         | finished |        |
| 8303c5be-8e0b-435e-82d5-0548ca89553f | existing        | 2019-06-25 06:52:17 | 0.0           | crashed  |        |
| cff605dc-0870-4666-a57b-a7ccf9080a10 | existing        | 2019-06-25 06:53:09 | 0.0           | crashed  |        |
| a434647f-1f2a-4184-b392-65b9107dd5a7 | existing        | 2019-06-25 06:53:54 | 52.047        | running  |        |
+--------------------------------------+-----------------+---------------------+---------------+----------+--------+

5.6 生成web报告

使用rally task report [task_id] --out=[outfile.html]可以生成web格式的测试报告

[root@kolla nova]# rally task report a434647f-1f2a-4184-b392-65b9107dd5a7 --out boot-and-delete.output.html
2019-06-25 15:01:35.452 140808 INFO rally.api [-] Building 'html' report for the following task(s): 'a434647f-1f2a-4184-b392-65b9107dd5a7'.
2019-06-25 15:01:35.481 140808 INFO rally.api [-] The report has been successfully built.

参考文档:

https://www.cnblogs.com/jinyuanliu/p/10948292.html#_label2

https://blog.csdn.net/u013553406/article/details/52026883

rally task start /rally-openstack/samples/tasks/scenarios/nova/boot_ljy.yaml

Linux运维--实践-Rally的更多相关文章

  1. Linux运维入门到高级全套常用要点

    Linux运维入门到高级全套常用要点 目 录 1. Linux 入门篇................................................................. ...

  2. Linux运维之道(大量经典案例、问题分析,运维案头书,红帽推荐)

    Linux运维之道(大量经典案例.问题分析,运维案头书,红帽推荐) 丁明一 编   ISBN 978-7-121-21877-4 2014年1月出版 定价:69.00元 448页 16开 编辑推荐 1 ...

  3. Linux运维工程师成长必经之路

    本路线图是从0基础开始,全方位由浅入深,按照多年Linux培训经验和优秀教学方法制定的学习思路和学习方法,路线图包括初级入门.中级进阶.高级提升和资深冲刺四个阶段,每阶段对应着不同优秀的课程和学习方法 ...

  4. 如何掌握并提高linux运维技能

    初中级Linux运维人员们系统学习并迅速掌握Linux的运维实战技能.学习路线大纲如下: 入门基础篇 系统运维篇 Web运维篇 数据库运维篇 集群实战篇 运维监控篇 第一篇:Linux入门(安装.配置 ...

  5. linux 运维,代理,acl控制访问

    运维概述:运行 & 维护,Operation & MaintanceIT运维.业务运维.日常管理运维采用相关的方法.手段.技术.制度.流程和文档等,对IT运行环境.IT业务系统和IT运 ...

  6. linux运维架构师职业规划

    1.假如你从来未接触过Linux的话,首先要做的就找一本指导书来学习.现在公认的Linux的入门书籍是“鸟哥的私房菜”,讲的很全面,鸟哥的私房菜一共分为两部,一部是基础篇,一部是服务器篇.“鸟哥的私房 ...

  7. linux运维工程师面试题收集

    面试必考 mysql5和mysql6 有什么区别 mysql-server-5.5:默认引擎改为Innodb,提高了性能和扩展性,提高实用性(中继日志自动恢复) mysql-server-5.6:In ...

  8. [转] Linux运维常见故障排查和处理的技巧汇总

    作为linux运维,多多少少会碰见这样那样的问题或故障,从中总结经验,查找问题,汇总并分析故障的原因,这是一个Linux运维工程师良好的习惯.每一次技术的突破,都经历着苦闷,伴随着快乐,可我们还是执着 ...

  9. 一名网工对Linux运维的一次经历

    我是一名名副其实的网络工程师,驻场于某市数字化城乡管理指挥中心(简称数字城管),主要针对中大型网络系统,路由.交换机.存储.小型机等设备进行维护,主要工作职责主要分为两种: 对网络系统中的网络设备(路 ...

随机推荐

  1. 关于爬虫的日常复习(5)—— beautifulsoup库

  2. Activiti 规则任务(businessRuleTask)

    Activiti 规则任务(businessRuleTask) 作者:Jesai 目前国内研究Activiti规则任务businessRuleTask)的文章在网上应该不超出3篇 小觑夜漫酒作伴,破晓 ...

  3. .net core webapi搭建(2)跨域

    Core WebAPI中的跨域处理 在使用WebAPI项目的时候基本上都会用到跨域处理 Core WebAPI的项目中自带了跨域Cors的处理,不需要单独添加程序包 如图所示 修改 Configure ...

  4. [bzoj4567] [loj#2012] [SCOI2016] 背单词

    Description \(Lweb\) 面对如山的英语单词,陷入了深深的沉思,「我怎么样才能快点学完,然后去玩三国杀呢?」.这时候睿智的凤老师从远处飘来,他送给了 \(Lweb\) 一本计划册和一大 ...

  5. HUAWEI MateBook Fn 功能键/热键切换、设置方法

    原文地址:https://club.huawei.com/thread-13130964-1-1.html HUAWE MateBook E/X/D的F1.F2 等键默认是热键优先.在热键模式下,要想 ...

  6. JS基础——ATM机终端程序编写(2.0)

    在1.0版本上,利用数组进行用户的创建,通过调用数组下标,进行密码.余额的使用.新增了切换账户.修改密码的功能 以下为数组版代码. 创建模拟账户 个账户: let user = ["xiao ...

  7. STM8L15X 硬件I2C调试总结

    最近接到一个项目需要使用STM8L上硬件I2C与SN3731通信,用户方是个方案商,硬件设计人员也没留测试点,直接就把板子焊了拿来了.调试时除了swio口能用所有都不能用,硬件设计大概是为了显得自己焊 ...

  8. springBoot 整合 dubbo 遇到的坑

    一.注意springBoot 和 dubbo 之间版本的问题 <?xml version="1.0" encoding="UTF-8"?> < ...

  9. 互联网那些事 | MQ数据丢失

    本系列故事的所有案例和解决方案只是笔者以前在互联网工作期间的一些事例,仅供大家参考,实际操作应该根据业务和项目情况设计,欢迎大家留言提出宝贵的意见 背景 小王和小明分别维护分布式系统中A.b两个服务, ...

  10. HTML:一张思维导图搞懂HTML

    HTML常用标签及其用法