当前位置: 首页 > Linux

【openstack】cloudkitty组件,入门级安装(快)

时间:2023-04-06 04:12:49 Linux

@TOCPreface什么是CloudKitty?CloudKitty是一个针对OpenStack等的评级即服务项目。该项目旨在成为云中退款和评级的通用解决方案。过去,它只能在OpenStack上下文中运行,但现在可以在独立模式下运行CloudKitty。CloudKitty允许基于指标的评级:它轮询端点以检索关于特定指标的指标和元数据,将评级规则应用于收集的数据,并将评级数据推送到其存储后端。CloudKitty是高度模块化的,这使得添加新功能变得容易。架构CloudKitty可以分为四个部分:数据检索(API)数据收集(cloudkitty-processor)数据收集数据评级数据评级数据存储数据存储这些部分由两个进程处理:和。数据检索部分由进程处理,另一部分由.cloudkitty-apicloudkitty-processorcloudkitty-apicloudkitty-processor以下是CloudKitty架构的概述:安装yuminstallopenstack-cloudkitty-apiopenstack-cloudkitty-processoropenstack-cloudkitty-ui配置编辑/etc/cloudkitty/cloudkitty.conf配置CloudKitty[DEFAULT]verbose=Truelog_dir=/var/log/cloudkitty[oslo_messaging_rabbit]rabbit_userid=openstackrabbit_password=RABBIT_PASSWORDrabbit_hosts=RABBIT_HOST[auth]username=cloudkittypassword=CK_PASSWORDtenant=serviceregion=RegionOneurl=http://localhost:5000/v2.0[keystone_authtoken]用户名=cloudkittypassword=CK_PASSWORDproject_name=serviceregion=RegionOneauth_url=http://localhost:5000/v2.0auth_plugin=password[database]connection=mysql://cloudkitty:CK_DBPASS@localhost/cloudkitty[keystone_fetcher]username=adminpassword=ADMIN_PASSWORDtenant=adminregion=RegionOneurl=http://localhost:5000/v2.0[ceilometer_collector]用户名=cloudkittypassword=CK_PASSWORDtenant=serviceregion=RegionOneurl=http://localhost:5000设置数据库和存储后端[root@controller~]#mysql-uroot-p000000欢迎使用MariaDB监视器。命令以;结尾或\g。您的MariaDB连接ID是374Server版本:10.1.20-MariaDBMariaDBServerCopyright(c)2000,2016,Oracle,MariaDBCorporationAbandothers.Type'help;'或'\h'寻求帮助。输入'\c'清除当前输入语句。MariaDB[(none)]>CREATEDATABASEcloudkitty;QueryOK,1rowaffected(0.00sec)MariaDB[(none)]>GRANTALLPRIVILEGESONcloudkitty.*TO'cloudkitty'@'localhost'IDENTIFIEDBY'000000';QueryOK,0rowsaffected(0.00sec)MariaDB[(none)]>GRANTALLPRIVILEGESONcloudkitty.*TO'cloudkitty'@'%'IDENTIFIEDBY'000000';查询好的,0行受影响(0.00秒)运行数据库同步脚本[root@controller~]#cloudkitty-dbsyncupgradeINFO[alembic.runtime.migration]上下文实现MySQLImpl.INFO[alembic.runtime.migration]将假设非事务DDL。INFO[alembic.runtime.migration]运行升级->464e951dc3b8,初始迁移信息[alembic.runtime.migration]运行升级464e951dc3b8->2ac2217dcbd9,添加了对metacollectorINFO[alembic.runtime.migration]运行升级的支持2ac2217dcbd9->385e33fef139,添加了modules_state.INFO[alembic.runtime.migration]ContextimplMySQLImpl.INFO[alembic.runtime.migration]Willassumenon-transactionalDDL.INFO[alembic.runtime.migration]Runningupgrade->3dd7e13527f3,InitialmigrationINFO[alembic.runtime.migration]运行升级3dd7e13527f3->4fa888fd7eda,添加了阈值支持。信息[alembic.runtime.migration]运行升级4fa888fd7eda->54cc17accf2c,固定约束名称。信息[alembic.runtime.migration]运行升级54cc17accf2c->10d2738b67df,将映射表重命名为hashmap_mappings.INFO[alembic.runtime.migration]Runningupgrade10d2738b67df->f8c799db4aa0,Fixunnamedconstraints.INFO[alembic.runtime.migration]运行宁升级f8c799db4aa0->c88a06b1cfce,清除哈希映射字段约束。/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py:507:警告:重复索引`uniq_field_per_service`。这已被弃用,在未来的版本中将被禁止。cursor.execute(statement,parameters)INFO[alembic.runtime.migration]Runningupgradec88a06b1cfce->4da82e1c11c8,AddpertenanthashmapsupportINFO[alembic.runtime.migration]ContextimplMySQLImpl.INFO[alembic.runtime.migration]将假定非-事务性DDL.INFO[alembic.runtime.migration]运行升级->4f9efa4601c0,初始迁移。初始存储后端[root@controller~]#cloudkitty-storage-initNohandlerscouldbefoundforlogger"cloudkitty.utils"INFO[alembic.runtime.migration]上下文实现MySQLImpl.INFO[alembic.runtime.migration]将假定非事务性DDL.INFO[alembic.runtime.migration]运行升级->17fd1b237aa3,初始migrationINFO[alembic.runtime.migration]运行升级17fd1b237aa3->792b438b663,添加了租户信息信息[alembic.runtime.migration]运行升级792b438b663->307430ab38bc,提高数量精度信息[alembic.runtime.migration]运行升级307430ab6qitty_digity_d13cloud->c7使用Keystone进行身份验证并提供评级服务[root@controller~]#openstackusercreate--domaindemo--password000000cloudkitty+--------------------+----------------------------------+|领域|值|+-------------------+----------------------------------+|域ID|d5db5c4ee4a14492b69408f63107d11f||已启用|真||编号|f1dea9309b834edba3aa4c1b8607dc16||姓名|云猫||选项|{}||password_expires_at|无|+--------------------+----------------------------------+[root@controller~]#openstackroleadd--projectservice--usercloudkittyadmin对于CloudKitty处理的每个租户,将评级角色分配给cloudkitty:[root@controller~]#openstackrolecreaterating+------------+------------------------------+|领域|值|+------------+----------------------------------+|域ID|无||编号|ee01d36a397b4b0ebcb579044c32a73c||姓名|评分|+------------+--------------------------------+创建评级服务及其端点:[root@controller~]#openstackservicecreate--namecloudkitty--description"OpenStackrating"rating+------------+----------------------------------+|领域|值|+------------+---------------------------------+|说明|OpenStack评级||已启用|真||编号|78f3d51cf74843cd8d325b790e0c2b1c||姓名|云猫||类型|评分|+------------+---------------------------------+openstack端点创建--regionRegionOne评级公共http://controller:9292openstack端点创建--regionRegionOne评级内部http://controller:9292openstackendpointcreate--regionRegionOneratingadminhttp://controller:9292[root@controller~]#openstackendpointcreate--regionRegionOneratingpublichttp://controller:9292+--------------+--------------------------------+|领域|值|+------------+----------------------------------+|已启用|真||编号|48b75b9d2d764b56a5bee00ff75b03b1||界面|公开||地区|地区一||区域编号|地区一||服务编号|78f3d51cf74843cd8d325b790e0c2b1c||服务名称|云猫||服务类型|评级||网址|http://controller:9292|+------------+------------------------------+[root@controller~]#openstackendpointcreate--regionRegionOneratinginternalhttp://controller:9292+--------------+--------------------------------+|领域|值|+------------+----------------------------------+|已启用|真||编号|b4f7fffa539441a68506db90b3ae89ce||界面|内部||地区|地区一||区域编号|地区一||服务编号|78f3d51cf74843cd8d325b790e0c2b1c||服务名称|云猫||服务类型|评级||网址|http://controller:9292|+------------+------------------------------+[root@controller~]#openstackendpointcreate--regionRegionOneratingadminhttp://controller:9292+----------------+--------------------------------+|领域|值|+------------+----------------------------------+|已启用|真||我d|a607a077f119417d9e650c16dcd61f10||界面|管理员||地区|地区一||区域编号|地区一||服务编号|78f3d51cf74843cd8d325b790e0c2b1c||服务名称|云猫||服务类型|评级||网址|http://controller:9292|+------------+------------------------------+启动[root@controller~]#systemctlstartcloudkitty-processor.service[root@controller~]#cloudkitty-api-p8889#临时启动APINohandlerscouldbefoundforlogger"cloudkitty.utils"/usr/lib/python2.7/site-packages/pecan/__init__.py:122:RuntimeWarning:`static_root`仅在`debug`为True时使用,忽略RuntimeWarning************************************************************************************STARTING测试服务器cloudkitty.api.app.build_wsgi_appAvailableathttp://controller:8889/DAN德国!仅供测试,请勿用于生产***********************************************************************************192.168.200.1--[2022年4月29日15:06:41]"GET/HTTP/1.1"200209检查并安装CloudKitty的仪表板gitclonehttps://opendev.org/openstack/cloudkitty-dashboard.gitpythonsetup.pyinstallyuminstall-ywgetwget-O/etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-7.repoyum-yinstallpython-pipPY_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@controllerbin]#systemctlrestarthttpd.servicememcached.service