@

前言

什么是CloudKitty?

CloudKitty是OpenStack等的评级即服务项目。该项目旨在成为云的退款和评级的通用解决方案。从历史上看,它只能在OpenStack上下文中运行它,但现在可以在独立模式下运行CloudKitty。

CloudKitty允许进行基于指标的评级:它轮询终端节点以检索有关特定指标的度量值和元数据,将评级规则应用于收集的数据,并将评级数据推送到其存储后端。

CloudKitty是高度模块化的,这使得添加新功能变得容易。

架构

CloudKitty可以分为四大部分:

  • Data retrieval (API) 数据检索
  • Data collection (cloudkitty-processor) 数据收集
  • Data rating 数据评级
  • Data storage 数据存储

这些部分由两个进程处理:和 。数据检索部分由进程处理,其他部分由 处理。cloudkitty-apicloudkitty-processorcloudkitty-apicloudkitty-processor

以下是 CloudKitty 架构的概述:

安装

yum install openstack-cloudkitty-api openstack-cloudkitty-processor openstack-cloudkitty-ui

配置

编辑/etc/cloudkitty/cloudkitty.conf以配置 CloudKitty

[DEFAULT]
verbose = True
log_dir = /var/log/cloudkitty [oslo_messaging_rabbit]
rabbit_userid = openstack
rabbit_password = RABBIT_PASSWORD
rabbit_hosts = RABBIT_HOST [auth]
username = cloudkitty
password = CK_PASSWORD
tenant = service
region = RegionOne
url = http://localhost:5000/v2.0 [keystone_authtoken]
username = cloudkitty
password = CK_PASSWORD
project_name = service
region = RegionOne
auth_url = http://localhost:5000/v2.0
auth_plugin = password [database]
connection = mysql://cloudkitty:CK_DBPASS@localhost/cloudkitty [keystone_fetcher]
username = admin
password = ADMIN_PASSWORD
tenant = admin
region = RegionOne
url = http://localhost:5000/v2.0 [ceilometer_collector]
username = cloudkitty
password = CK_PASSWORD
tenant = service
region = RegionOne
url = http://localhost:5000

设置数据库和存储后端

[root@controller ~]# mysql -uroot -p000000
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 374
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE cloudkitty;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cloudkitty.* TO 'cloudkitty'@'localhost' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cloudkitty.* TO 'cloudkitty'@'%' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)

运行数据库同步脚本

[root@controller ~]# cloudkitty-dbsync upgrade
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> 464e951dc3b8, Initial migration
INFO [alembic.runtime.migration] Running upgrade 464e951dc3b8 -> 2ac2217dcbd9, Added support for meta collector
INFO [alembic.runtime.migration] Running upgrade 2ac2217dcbd9 -> 385e33fef139, Added priority to modules_state.
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> 3dd7e13527f3, Initial migration
INFO [alembic.runtime.migration] Running upgrade 3dd7e13527f3 -> 4fa888fd7eda, Added threshold support.
INFO [alembic.runtime.migration] Running upgrade 4fa888fd7eda -> 54cc17accf2c, Fixed constraint name.
INFO [alembic.runtime.migration] Running upgrade 54cc17accf2c -> 10d2738b67df, Rename mapping table to hashmap_mappings.
INFO [alembic.runtime.migration] Running upgrade 10d2738b67df -> f8c799db4aa0, Fix unnamed constraints.
INFO [alembic.runtime.migration] Running upgrade f8c799db4aa0 -> c88a06b1cfce, Clean hashmap fields constraints.
/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py:507: Warning: Duplicate index `uniq_field_per_service`. This is deprecated and will be disallowed in a future release.
cursor.execute(statement, parameters)
INFO [alembic.runtime.migration] Running upgrade c88a06b1cfce -> 4da82e1c11c8, Add per tenant hashmap support
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> 4f9efa4601c0, Initial migration.

初始化存储后端

[root@controller ~]# cloudkitty-storage-init
No handlers could be found for logger "cloudkitty.utils"
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> 17fd1b237aa3, Initial migration
INFO [alembic.runtime.migration] Running upgrade 17fd1b237aa3 -> 792b438b663, added tenant informations
INFO [alembic.runtime.migration] Running upgrade 792b438b663 -> 307430ab38bc, improve qty precision
INFO [alembic.runtime.migration] Running upgrade 307430ab38bc -> c703a1bad612, improve_qty_digit

CloudKitty 使用 Keystone 进行身份验证,并提供rating服务。

[root@controller ~]# openstack user create --domain demo --password 000000 cloudkitty
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | d5db5c4ee4a14492b69408f63107d11f |
| enabled | True |
| id | f1dea9309b834edba3aa4c1b8607dc16 |
| name | cloudkitty |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@controller ~]# openstack role add --project service --user cloudkitty admin

对于应由 CloudKitty处理的每个租户,将rating角色赋予 cloudkitty :

[root@controller ~]# openstack role create rating
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | None |
| id | ee01d36a397b4b0ebcb579044c32a73c |
| name | rating |
+-----------+----------------------------------+

创建rating服务及其端点:

[root@controller ~]# openstack service create --name cloudkitty --description "OpenStack rating" rating
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack rating |
| enabled | True |
| id | 78f3d51cf74843cd8d325b790e0c2b1c |
| name | cloudkitty |
| type | rating |
+-------------+----------------------------------+
openstack endpoint create --region RegionOne rating public http://controller:9292
openstack endpoint create --region RegionOne rating internal http://controller:9292
openstack endpoint create --region RegionOne rating admin http://controller:9292
[root@controller ~]# openstack endpoint create --region RegionOne rating public http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 48b75b9d2d764b56a5bee00ff75b03b1 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 78f3d51cf74843cd8d325b790e0c2b1c |
| service_name | cloudkitty |
| service_type | rating |
| url | http://controller:9292 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne rating internal http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | b4f7fffa539441a68506db90b3ae89ce |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 78f3d51cf74843cd8d325b790e0c2b1c |
| service_name | cloudkitty |
| service_type | rating |
| url | http://controller:9292 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne rating admin http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | a607a077f119417d9e650c16dcd61f10 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 78f3d51cf74843cd8d325b790e0c2b1c |
| service_name | cloudkitty |
| service_type | rating |
| url | http://controller:9292 |
+--------------+----------------------------------+

启动

[root@controller ~]# systemctl start cloudkitty-processor.service
[root@controller ~]# cloudkitty-api -p 8889 #临时启动API
No handlers could be found for logger "cloudkitty.utils"
/usr/lib/python2.7/site-packages/pecan/__init__.py:122: RuntimeWarning: `static_root` is only used when `debug` is True, ignoring
RuntimeWarning
********************************************************************************
STARTING test server cloudkitty.api.app.build_wsgi_app
Available at http://controller:8889/
DANGER! For testing only, do not use in production
********************************************************************************
192.168.200.1 - - [29/Apr/2022 15:06:41] "GET / HTTP/1.1" 200 209

检索并安装 CloudKitty 的仪表板

git clone https://opendev.org/openstack/cloudkitty-dashboard.git

python setup.py install
yum install -y wget
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install python-pip
PY_PACKAGES_PATH=`pip --version | cut -d' ' -f4`
ln -s $PY_PACKAGES_PATH/cloudkittydashboard/enabled/_[0-9]*.py /usr/share/openstack-dashboard/openstack_dashboard/enabled/
[root@controller bin]# systemctl restart httpd.service memcached.service

【openstack】cloudkitty组件,入门级安装(快速)的更多相关文章

  1. OpenStack基础组件安装keystone身份认证服务

    域名解析 vim /etc/hosts 192.168.245.172 controller01 192.168.245.171 controller02 192.168.245.173 contro ...

  2. 八、OpenStack—Cinder组件安装

    一.安装和配置控制器节点 1.先决条件 1)创建数据库 # mysql -u root -p 2)创建cinder数据库 MariaDB [(none)]> CREATE DATABASE ci ...

  3. 二、OpenStack—keystone组件介绍与安装

    一.Keystone介绍 keystone 是OpenStack的组件之一,用于为OpenStack家族中的其它组件成员提供统一的认证服务,包括身份验证.令牌的发放和校验.服务列表.用户权限的定义等等 ...

  4. Openstack Sahara组件和架构简介

    1.简介 Apache Hadoop是目前被广泛使用的主流大数据处理计算框架,Sahara项目旨在使用用户能够在Openstack平台上便于创建和管理Hadoop以及其他计算框架集群,实现类似AWS的 ...

  5. 学习OpenStack之 (1):安装devstack

    1. 系统准备 ubuntu 12.04 server 虚拟机. 2G内存. 依次运行以下命令来安装git: sudo apt-get update sudo apt-get upgrade sudo ...

  6. openstack pike 单机 一键安装 shell

    #openstack pike 单机  centos 一键安装 shell #openstack pike 集群高可用  安装部署 汇总 http://www.cnblogs.com/elvi/p/7 ...

  7. OpenStack共享组件

    一.云计算的前世今生 1.物理机架构,应用部署和运行在物理机上  2.虚拟化架构,物理机上运行若干虚拟机,应用系统直接部署到虚拟机上  3.云计算架构,虚拟化提高了单台物理机的资源使用率 二.Open ...

  8. openstack 之~openstack各组件关系

    认识openstack 第一:openstack是什么? OpenStack是一个由NASA(美国国家航空航天局)和Rackspace合作研发并发起的,以Apache许可证授权的自由软件和开放源代码项 ...

  9. OpenStack各组件逻辑关系、通信部署关系及工作流程

    一. OpenStack组件之间的逻辑关系 OpenStack 是一个不断发展的系统,所以 OpenStack 的架构是演进的,举个例子: E 版本有5个组件  Compute 是 Nova:Imag ...

  10. 4 云计算系列之Openstack简介与keystone安装

    preface KVM 是openstack虚拟化的基础, 再介绍了kvm虚拟化技术之后,我们介绍下openstack和如何搭建. Openstack组件 openstack架构图如下所示 那么我们就 ...

随机推荐

  1. Spring容器 从XML 文件中读取bean的定义,并实例化bean?

    解释Spring框架中bean的生命周期. Spring根据bean的定义填充所有的属性. 如果bean实现了BeanNameAware 接口,Spring 传递bean 的ID 到 setBeanN ...

  2. 哪一个 bash 内置命令能够进行数学运算?

    bash shell 的内置命令 let 可以进行整型数的数学运算. #! /bin/bash - - let c=a+b - -

  3. 为什么 Thread 类的 sleep()和 yield ()方法是静态的?

    Thread 类的 sleep()和 yield()方法将在当前正在执行的线程上运行.所以在其他处于等待状态的线程上调用这些方法是没有意义的.这就是为什么这些方法是静态的.它们可以在当前正在执行的线程 ...

  4. Centos6 编译安装Python3.6

    1. 安装依赖 yum install gcc openssl-devel bzip2-devel 2. 下载Python3.6 cd /usr/src wget https://www.python ...

  5. log4J——在Spring中的使用

    log4J简介 1.通过 log4j 可以看到程序运行过程中更详细的信息 (1)经常使用 log4j 查看日志 2.使用 (1)导入 log4j 的jar包 (2)复制 log4j 的配置文件,复制到 ...

  6. CPF 使用C#的Native AOT 发布程序

    微软已经将AOT的包移到Nuget了,之前是在实验测试服务器上的.并且由之前的alpha版本改成了preview版本. C#的开发效率,接近C++的运行效率,而且可以防止反编译,可以支持大部分反射功能 ...

  7. getch()函数的使用方法及其返回值问题

    getch()函数依赖于头文件 conio.h .会在windows平台下从控制台无回显地取一个字符,并且返回读取到的字符. 然而,我在实际用这个函数才发现getch()这个函数并不简单. getch ...

  8. 摩拜单车微信小程序开发技术总结

    前言 摩拜单车小程序已于微信小程序上线第一天正式发布,刷爆微博媒体朋友圈.本文主要讲讲技术方向的总结,在段时间的开发周期内内如何一步步从学习到进阶. 思维转变 微信小程序没有HTML的常用标签,而是类 ...

  9. [computer vision] Bag of Visual Word (BOW)

    Bag of Visual Word (BoW, BoF, 词袋) 简介 BoW 是传统的计算机视觉方法,用一些特征(一些向量)来表示一个图像.BoW的核心思想是利用一组较为通用的特征,将图像用这些特 ...

  10. Spark入门之环境搭建

    本教程是虚拟机搭建Spark环境和用idea编写脚本 一.前提准备 需要已经有搭建好的虚拟机环境,具体见教程大数据学习之路又之从小白到用sqoop导出数据 - 我试试这个昵称好使不 - 博客园 (cn ...