一、项目介绍
Shaker项目是由Mirantis发起,专门针对OpenStack网络性能的测试工具。通过模拟不同的网络场景和heat模板,创建虚拟机,并在虚拟机里运行iperf、iperf3、netperf等工具来对网络进行自动化性能测试,并且把测试的结果以网页的形式输出。
目前OpenStack的另外一个著名测试工具Rally, 也是由Mirantis发起,可以针对OpenStack进行整体测试,也可以对OpenStack的功能,存储的性能进行压力测试,以及测试磁盘的IOPS,并提供很好的Web展示。
Rally与Shaker各自的侧重点,两个工具结合起来,在OpenStack交付给用户的场景下,可以提供一份相对客观的验收报告。
二、环境说明
需要有一个可用的OpenStack环境,并配置好Heat服务,因为Shaker需要使用编排服务来启动各种场景下的虚拟机,本文环境如下:
controller/shaker | 172.20.5.15/24 |
compute01 | 172.20.5.16/24 |
compute02 | 172.20.5.17/24 |
三、安装配置
1、openstack安装配置
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1、基础配置 使用本次安装教程,会安装ceilometer+gnocchi集成、heat、FWAAS、VPNAAS、LBAASv1等 # 所有节点全部执行 mkdir /etc/yum.repos.d/bak mv /etc/yum.repos.d/*repo /etc/yum.repos.d/bak cat >> /etc/yum.repos.d/openstack-mitaka.repo << EOF [base] name=CentOS-$releasever - Base baseurl=http://172.20.2.44/base enabled=1 gpgcheck=0 [mitaka] name=mitaka baseurl=http://172.20.2.44/openstack-mitaka enabled=1 gpgcheck=0 [epel] name=epel baseurl=http://172.20.2.44/epel enabled=1 gpgcheck=0 EOF yum install python-cheetah python-gnocchi python-nova libvirt libvirt-devel libvirt-client -y 2、安装配置openstack环境 # 控制节点执行 yum install -y openstack-packstack packstack --gen-answer-file=openstack.txt /usr/bin/sleep 5 # 这里第一行修改compute节点对应的IP地址,这里测试compute节点IP地址是172.20.5.16,172.20.5.17,IP地址之间用逗号(,)隔开 sed -i \ -e 's@CONFIG_COMPUTE_HOSTS=.*@CONFIG_COMPUTE_HOSTS=172.20.5.16,172.20.5.17@g' \ -e 's@CONFIG_CEILOMETER_METERING_BACKEND=.*@CONFIG_CEILOMETER_METERING_BACKEND=gnocchi@g' \ -e 's@CONFIG_NAGIOS_INSTALL=.*@CONFIG_NAGIOS_INSTALL=n@g' \ -e 's@CONFIG_SWIFT_INSTALL=.*@CONFIG_SWIFT_INSTALL=n@g' \ -e 's@CONFIG_HEAT_INSTALL=.*@CONFIG_HEAT_INSTALL=y@g' \ -e 's@CONFIG_HEAT_CLOUDWATCH_INSTALL=.*@CONFIG_HEAT_CLOUDWATCH_INSTALL=y@g' \ -e 's@CONFIG_HEAT_CFN_INSTALL=.*@CONFIG_HEAT_CFN_INSTALL=y@g' \ -e 's@CONFIG_NEUTRON_FWAAS=.*@CONFIG_NEUTRON_FWAAS=y@g' \ -e 's@CONFIG_NEUTRON_VPNAAS=.*@CONFIG_NEUTRON_VPNAAS=y@g' \ -e 's@CONFIG_LBAAS_INSTALL=.*@CONFIG_LBAAS_INSTALL=y@g' \ -e 's@CONFIG_MARIADB_PW=.*@CONFIG_MARIADB_PW=root1234@g' \ -e 's@CONFIG_KEYSTONE_ADMIN_PW=.*@CONFIG_KEYSTONE_ADMIN_PW=admin@g' \ -e 's@CONFIG_KEYSTONE_API_VERSION=.*@CONFIG_KEYSTONE_API_VERSION=v3@g' openstack.txt 3、安装前后配置 # 控制节点执行 packstack --answer-file=openstack.txt # 安装过程会修改yum源。这里需要执行如下指令,修改过来 sed -i 's@enabled=.*@enabled=1@g' /etc/yum.repos.d/openstack-mitaka.repo # 漫长的等待之后,如果不报错,进行下面操作 sed -i \ -e 's@type_drivers =.*@type_drivers = flat,vxlan@g' \ -e 's@#flat_networks =.*@flat_networks = *@g' /etc/neutron/plugins/ml2/ml2_conf.ini # 对接gnocchi后期配置 openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT event_dispatchers gnocchi openstack-config --set /etc/ceilometer/ceilometer.conf api gnocchi_is_enabled true openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_gnocchi filter_project services openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_gnocchi archive_policy low openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_gnocchi resources_definition_file gnocchi_resources.yaml openstack-service restart ceilometer # 在计算节点1上执行ssh互信 sed -i \ -e 's@nova.*@nova:x:162:162:OpenStack Nova Daemons:/var/lib/nova:/bin/bash@g' /etc/passwd echo nova | passwd --stdin nova su - nova # 在计算节点2上执行ssh互信 sed -i \ -e 's@nova.*@nova:x:162:162:OpenStack Nova Daemons:/var/lib/nova:/bin/bash@g' /etc/passwd # 修改成自己的计算节点IP地址 echo nova | passwd --stdin nova su - nova # 修改成自己的计算节点IP地址 ssh-keygen -t rsa -f ~/.ssh/id_rsa -P '' ssh-copy-id -i .ssh/id_rsa.pub nova@172.20.5.17 ssh-keygen -t rsa -f ~/.ssh/id_rsa -P '' ssh-copy-id -i .ssh/id_rsa.pub nova@172.20.5.16 4、在控制节点上配置NFS共享存储 # 在公司openstack上创建一个cinder卷,挂载到controller节点上,作为共享存储盘使用。如果只是作为测试建议100G可用 # 分区,格式化 # 分区 fdisk /dev/vdc <<EOF n p 1 w EOF # 格式化 mkfs.xfs /dev/vdc1 # 挂载 mount /dev/vdc1 /opt/nova/instances/ # NFS共享 yum -y install nfs-utils rpcbind -y mkdir -p /opt/nova/instances echo "/opt/nova/instances 172.20.0.0/16(rw,no_root_squash,no_all_squash,sync)" > /etc/exports exportfs -r chmod -R 777 /opt/nova/instances/ systemctl enable rpcbind.service systemctl start rpcbind.service systemctl enable nfs-server.service systemctl start nfs-server.service 5、2个计算节点使用NFS showmount -e 172.20.5.15 mount -t nfs 172.20.5.15:/opt/nova/instances /var/lib/nova/instances/ chown -R nova.nova /var/lib/nova
2、shaker安装配置
yum install git gcc-c++ python-devel git clone http://git.trystack.cn/openstack/shaker cd shaker pip install . cd .. source keystonerc_admin export ELEMENTS_PATH=shaker/shaker/resources/image_elements disk-image-create -o shaker-image.qcow2 centos vm shaker
ubuntu16.04源
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties deb http://archive.canonical.com/ubuntu xenial partner deb-src http://archive.canonical.com/ubuntu xenial partner deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse