rally 爲openstack社區的性能測試工具,爲大家所熟知。tempest爲集成功能測試,和rally結合發揮各長。如果要了解rally和tempest的原理和框架,大家到官網看,寫的很詳細。這裏只是記錄下,本人的部署和使用的過程。如果能幫到大家,那就更開心了~~~
準備服務器:
hostname A.local.test.net 10.10.0.2
B.local.test.net 10.10.0.3
openstack環境準備
這裏主要有rdo做的all in one,部署在A.local.test.net
1.環境準備
$ sudo yum install -y https://rdoproject.org/repos/rdo-release.rpm $ sudo yum install -y centos-release-openstack-mitaka $ sudo yum update -y
2.安裝packstack
$ sudo yum install -y openstack-packstack
3.運行packstack
$ packstack --allinone
4.驗證一下,openstack環境運行正常否,登陸url,創建虛機。能正常創建虛機,ok,那開始下一步吧
rally部署和使用
部署在B.local.test.net
1.部署
$ wget -q -O- https://raw.githubusercontent.com/openstack/rally/master/install_rally.sh | bash
2.數據庫初始化
$ rally-manage db recreate
3.註冊openstack環境
在rally 源碼裏找 existing.json(samples/deployments/existing.json)
修改文件,寫入我們已經部署好的openstack環境的keystone地址,user 和password
{ "type": "ExistingCloud", "auth_url": "http://A.local.test.net:5000/v2.0/", "region_name": "RegionOne", "endpoint_type": "public", "admin": { "username": "admin", "password": "password", "tenant_name": "admin" }, }
$ rally deployment create --file=existing.json --name=test-rally
4.deployment check 的命令可以讓您驗證當前的測試環境是否健康以及是否可以開始進行基準測試
$ rally deployment check
5.基準測試
rally/samples/tasks/scenarios 目錄下有很多的基準測試用例。支持yaml 和json格式
測試一下創建刪除虛機測試用例
$ rally task start samples/tasks/scenarios/nova/boot-and-delete.yaml
vim boot-and-delete.yaml {% set flavor_name = flavor_name or "m1.tiny" %} # flavor 默認值爲m1.tiny {% set image_name = image_name or "cirros" %} # image 默認值爲cirros --- NovaServers.boot_and_delete_server: - args: flavor: name: "`flavor_name`" #flavor做變量 image: name: "`image_name`" # image 做變量 force_delete: false runner: type: "constant" times: 10 # 共操作10次 concurrency: 2 # 併發2次 context: users: tenants: 1 # 創建1個tenant users_per_tenant: 1 # 每個tenant只創建一個user
測試完成會提示:
HINTS: * To plot HTML graphics with this data, run: rally task plot2html 6fd9a19f-5cf8-4f76-ab72-2e34bb1d4996 --out output.html * To get raw JSON output of task results, run: rally task results 6fd9a19f-5cf8-4f76-ab72-2e34bb1d4996 Using task: 6fd9a19f-5cf8-4f76-ab72-2e34bb1d4996
6.查看report
生成htmlreport
$ rally task plot2html 6fd9a19f-5cf8-4f76-ab72-2e34bb1d4996 --out output.html
在瀏覽器打開,看到詳細的性能測試報告,如下: