@toc
前言
什么是CloudKitty?
CloudKitty是OpenStack等云平台的评级即服务项目。其目的是提供云的退款和评级的通用解决方案。最初,CloudKitty仅能在OpenStack环境中运行,但现在它支持独立模式。
CloudKitty支持基于指标的评级:它会定期轮询终端节点,获取特定指标的度量值和元数据,并将评级规则应用于这些数据,最后将评级结果推送到其存储后端。
由于其高度模块化的设计,CloudKitty使得添加新功能变得简单。
架构
CloudKitty的架构分为四大块:
这些功能由两个进程处理:cloudkitty-api和cloudkitty-processor。其中,数据检索部分由cloudkitty-api处理,其他部分由cloudkitty-processor处理。
以下是 CloudKitty 架构的概述:

安装
安装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 <p>[oslo_messaging_rabbit] rabbit_userid = openstack rabbit_password = RABBIT_PASSWORD rabbit_hosts = RABBIT_HOST</p><p>[auth] username = cloudkitty password = CK_PASSWORD tenant = service region = RegionOne url = <a href="https://www.php.cn/link/65b5fc46fc82087ba24609b14f2dc4ff">https://www.php.cn/link/65b5fc46fc82087ba24609b14f2dc4ff</a></p><p>[keystone_authtoken] username = cloudkitty password = CK_PASSWORD project_name = service region = RegionOne auth_url = <a href="https://www.php.cn/link/65b5fc46fc82087ba24609b14f2dc4ff">https://www.php.cn/link/65b5fc46fc82087ba24609b14f2dc4ff</a> auth_plugin = password</p><p>[database] connection = mysql://cloudkitty:CK_DBPASS@localhost/cloudkitty</p><p>[keystone_fetcher] username = admin password = ADMIN_PASSWORD tenant = admin region = RegionOne url = <a href="https://www.php.cn/link/65b5fc46fc82087ba24609b14f2dc4ff">https://www.php.cn/link/65b5fc46fc82087ba24609b14f2dc4ff</a></p><p>[ceilometer_collector] username = cloudkitty password = CK_PASSWORD tenant = service region = RegionOne url = <a href="https://www.php.cn/link/6060d322713797e84f598ea25c812cab">https://www.php.cn/link/6060d322713797e84f598ea25c812cab</a>
设置数据库和存储后端
设置数据库和存储后端的命令如下:
[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.</p><p>MariaDB [(none)]> CREATE DATABASE cloudkitty; Query OK, 1 row affected (0.00 sec)</p><p>MariaDB [(none)]> GRANT ALL PRIVILEGES ON cloudkitty.* TO 'cloudkitty'@'localhost' IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.00 sec)</p><p>MariaDB [(none)]> GRANT ALL PRIVILEGES ON cloudkitty.* TO 'cloudkitty'@'%' IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.00 sec)
运行数据库同步脚本
DM建站系统律师事务所HTML5网站模板, DM企业建站系统。是由php+mysql开发的一套专门用于中小企业网站建设的开源cms。DM系统的理念就是组装,把模板和区块组装起来,产生不同的网站效果。可以用来快速建设一个响应式的企业网站( PC,手机,微信都可以访问)。后台操作简单,维护方便。DM企业建站系统安装步骤:第一步,先用phpmyadmin导入sql文件。 第二步:把文件放到你的本地服务器
0
运行数据库同步脚本的命令如下:
[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 <code>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.</code>
初始化存储后端
初始化存储后端的命令如下:
[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服务。
创建用户和角色
创建CloudKitty用户和分配角色的命令如下:
[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 |
+---------------------+----------------------------------+</p><p>[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 | +-------------+----------------------------------+</p><p>openstack endpoint create --region RegionOne rating public <a href="https://www.php.cn/link/37fd913e3ae9a65bc011675868062827">https://www.php.cn/link/37fd913e3ae9a65bc011675868062827</a> openstack endpoint create --region RegionOne rating internal <a href="https://www.php.cn/link/37fd913e3ae9a65bc011675868062827">https://www.php.cn/link/37fd913e3ae9a65bc011675868062827</a> openstack endpoint create --region RegionOne rating admin <a href="https://www.php.cn/link/37fd913e3ae9a65bc011675868062827">https://www.php.cn/link/37fd913e3ae9a65bc011675868062827</a>
具体的端点创建输出如下:
[root@controller ~]# openstack endpoint create --region RegionOne rating public <a href="https://www.php.cn/link/37fd913e3ae9a65bc011675868062827">https://www.php.cn/link/37fd913e3ae9a65bc011675868062827</a> +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 48b75b9d2d764b56a5bee00ff75b03b1 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 78f3d51cf74843cd8d325b790e0c2b1c | | service_name | cloudkitty | | service_type | rating | | url | <a href="https://www.php.cn/link/37fd913e3ae9a65bc011675868062827">https://www.php.cn/link/37fd913e3ae9a65bc011675868062827</a> | +--------------+----------------------------------+</p><p>[root@controller ~]# openstack endpoint create --region RegionOne rating internal <a href="https://www.php.cn/link/37fd913e3ae9a65bc011675868062827">https://www.php.cn/link/37fd913e3ae9a65bc011675868062827</a> +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | b4f7fffa539441a68506db90b3ae89ce | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 78f3d51cf74843cd8d325b790e0c2b1c | | service_name | cloudkitty | | service_type | rating | | url | <a href="https://www.php.cn/link/37fd913e3ae9a65bc011675868062827">https://www.php.cn/link/37fd913e3ae9a65bc011675868062827</a> | +--------------+----------------------------------+</p><p>[root@controller ~]# openstack endpoint create --region RegionOne rating admin <a href="https://www.php.cn/link/37fd913e3ae9a65bc011675868062827">https://www.php.cn/link/37fd913e3ae9a65bc011675868062827</a> +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | a607a077f119417d9e650c16dcd61f10 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 78f3d51cf74843cd8d325b790e0c2b1c | | service_name | cloudkitty | | service_type | rating | | url | <a href="https://www.php.cn/link/37fd913e3ae9a65bc011675868062827">https://www.php.cn/link/37fd913e3ae9a65bc011675868062827</a> | +--------------+----------------------------------+
启动服务
启动CloudKitty服务的命令如下:
[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/<strong>init</strong>.py:122: RuntimeWarning: <code>static_root is only used when <code>debug</code> is True, ignoring RuntimeWarning</p><hr /><p>STARTING test server cloudkitty.api.app.build_wsgi_app Available at <a href="https://www.php.cn/link/bc2ba6731122a2b539616c6929597d18">https://www.php.cn/link/bc2ba6731122a2b539616c6929597d18</a> DANGER! For testing only, do not use in production</p><hr /><p>192.168.200.1 - - [29/Apr/2022 15:06:41] "GET / HTTP/1.1" 200 209</code>
安装仪表板
检索并安装CloudKitty的仪表板的命令如下:
git clone <a href="https://www.php.cn/link/d7416380bea3deeffaa942591263d351">https://www.php.cn/link/d7416380bea3deeffaa942591263d351</a> python setup.py install yum install -y wget wget -O /etc/yum.repos.d/epel.repo <a href="https://www.php.cn/link/f03a550c53b59ef2cb9970d9672c78da">https://www.php.cn/link/f03a550c53b59ef2cb9970d9672c78da</a> yum -y install python-pip PY_PACKAGES_PATH=<code>pip --version | cut -d' ' -f4 ln -s $PY_PACKAGES<em>PATH/cloudkittydashboard/enabled/</em>[0-9]*.py /usr/share/openstack-dashboard/openstack_dashboard/enabled/</code>
最后,重新启动相关服务以应用更改:
[root@controller bin]# systemctl restart httpd.service memcached.service
以上就是【openstack】cloudkitty组件,入门级安装(快速)的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号