OpenStack计费项目Cloudkitty安装
云计算是一种按需付费的服务模式,虽然OpenStack前期在计量方面走了些“弯路”,但现在的ceilometer、gnocchi、aodh、panko项目的稳步并进算是让其峰回路转。然而,目前来看OpenStack的计费项目Cloudkitty并未柳暗花明,为此,借助本文向大家介绍Cloudkitty的架构、用户使用指导、开发以及社区方面的最新动态,希望可以吸引更多方面的关注、使用和社区参与。
当前upstream版本Cloudkitty可以完成虚拟机实例(compute)、云硬盘(volume)、镜像(image)、网络进出流量(network.bw.in, network.bw.out)、浮动IP(network.floating)的计费。得益于Cloudkitty的巧妙而优秀的设计,软件插件化思想更是体现的淋漓尽致,使得添加新的计费源异常容易,版本升级也十分方便。同样也能方便将Cloudkitty用于cloudstack、VMWare等环境中。
以下是M版openstack在centos7系统下的安装步骤:
1.准备openstack mitaka源并安装相应的packages # Vi /etc/yum.repos.d/cloudkitty.repo [cloudkitty] name=CloudKitty repository (Mitaka) baseurl=http://archive.objectif-libre.com/cloudkitty/el7/mitaka/ gpgcheck=0 gpgkey=http://archive.objectif-libre.com/ol.asc
2.组件安装 # yum install openstack-cloudkitty-api openstack-cloudkitty-processor openstack-cloudkitty-dashboard python-cloudkittyclient
3.准备cloudkitty运行所依赖的环境创建cloudkitty数据库
MariaDB [(none)]> CREATE DATABASE cloudkitty; MariaDB [(none)]> GRANT ALL PRIVILEGES ON cloudkitty.* TO 'cloudkitty'@'localhost' IDENTIFIED BY 'password'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON cloudkitty.* TO 'cloudkitty'@'%' IDENTIFIED BY 'password';
4.在keystone中创建相应的用户和endpoint [root@zhangguoqing-dev ~(keystone_admin)]# keystone user-create --name cloudkitty --pass password --email cloudkitty@localhost [root@zhangguoqing-dev ~(keystone_admin)]# keystone user-role-add --user cloudkitty --role admin --tenant services [root@zhangguoqing-dev ~(keystone_admin)]# keystone endpoint-create --service-id %CLOUDKITTY_SERVICE_ID% \ --region RegionOne
5.新建rating角色,并对admin租户进行计费 [root@zhangguoqing-dev ~(keystone_admin)]# keystone role-create --name rating [root@zhangguoqing-dev ~(keystone_admin)]# keystone user-role-add --user cloudkitty --role rating --tenant admin
6.配置/etc/cloudkitty/cloudkitty.conf,参考如下 [DEFAULT] debug = Truelog_ dir = /var/log/cloudkitty [collect] period = 3600 Services=compute,image,volume,network.bw.in,network.bw.out,network.floating [database] connection=mysql+pymysql://cloudkitty:password@192.168.0.248/cloudkitty [keystone_authtoken] auth_uri=http://192.168.0.248:5000/v2.0 identity_uri=http://192.168.0.248:35357 admin_password=password admin_user=cloudkitty admin_tenant_name=services [auth] auth_type = password username = cloudkitty user_domain_id = default password = password project_domain_id = default project_name = services [keystone_fetcher] auth_section = auth [ceilometer_collector] auth_section = auth [oslo_messaging_rabbit] amqp_durable_queues=False rabbit_hosts=192.168.0.248:5672 rabbit_userid = guest rabbit_password = guest [storage] backend = sqlalchemy [tenant_fetcher] backend = keystone 7.初始化数据库 # cloudkitty-dbsync upgrade 8.初始化后端存储 # cloudkitty-storage-init 9.开启服务 systemctl enable cloudkitty-api.service cloudkitty-processor.service systemctl start cloudkitty-api.service cloudkitty-processor.service
10.重启httpd服务 service httpd restart
|