Ubuntu 24.04
Sponsored Link

OpenStack Caracal : CloudKitty कॉन्फ़िगर करें2024/05/23

 

OpenStack रेटिंग सेवा (CloudKitty) स्थापित करें।

यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है।

------------+--------------------------+--------------------------+------------
            |                          |                          |
        eth0|10.0.0.30             eth0|10.0.0.50             eth0|10.0.0.51
+-----------+-----------+  +-----------+-----------+  +-----------+-----------+
|   [ dlp.srv.world ]   |  | [ network.srv.world ] |  |  [ node01.srv.world ] |
|     (Control Node)    |  |     (Network Node)    |  |     (Compute Node)    |
|                       |  |                       |  |                       |
|  MariaDB    RabbitMQ  |  |  Neutron L2/L3 Agent  |  |        Libvirt        |
|  Memcached  Nginx     |  |   Neutron Metadata    |  |      Nova Compute     |
|  Keystone   httpd     |  |     Open vSwitch      |  |    Neutron L2 Agent   |
|  Glance     Nova API  |  |     iSCSI Target      |  |      Open vSwitch     |
|  Neutron Server       |  |     Cinder Volume     |  |   Ceilometer Compute  |
|  Neutron Metadata     |  |     httpd  Gnocchi    |  |                       |
|  Cinder API           |  |   Ceilometer Central  |  |                       |
|                       |  |     CloudKitty API    |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] Keystone में CloudKitty के लिए उपयोगकर्ताओं और अन्य लोगों को जोड़ें।
# [service] प्रोजेक्ट में [cloudkitty] उपयोगकर्ता बनाएं

root@dlp ~(keystone)#
openstack user create --domain default --project service --password servicepassword cloudkitty

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | ab9749e59bdb48e4807a18abb83c9f99 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 54af06078d23450d8769596ebcf3a4db |
| name                | cloudkitty                       |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# [cloudkitty] उपयोगकर्ता को [admin] भूमिका में जोड़ें

root@dlp ~(keystone)#
openstack role add --project service --user cloudkitty admin
# [rating] भूमिका बनाएं

root@dlp ~(keystone)#
openstack role create rating
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | None                             |
| domain_id   | None                             |
| id          | dfd2cd763d314eaf98a278bcdc06ad85 |
| name        | rating                           |
| options     | {}                               |
+-------------+----------------------------------+

# [cloudkitty] के लिए सेवा प्रविष्टि बनाएं

root@dlp ~(keystone)#
openstack service create --name cloudkitty --description "OpenStack Rating Service" rating

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Rating Service         |
| enabled     | True                             |
| id          | 2fada9255fb84fff8c06867b9956b464 |
| name        | cloudkitty                       |
| type        | rating                           |
+-------------+----------------------------------+

# CloudKitty API होस्ट को परिभाषित करें

root@dlp ~(keystone)#
export cloudkitty_api=network.srv.world
# [cloudkitty] के लिए समापन बिंदु बनाएं (public)

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne rating public https://$cloudkitty_api:8889

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | c5117da221ee42ec98f8c560f1bd7e99 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 2fada9255fb84fff8c06867b9956b464 |
| service_name | cloudkitty                       |
| service_type | rating                           |
| url          | https://network.srv.world:8889   |
+--------------+----------------------------------+

# [cloudkitty] के लिए समापन बिंदु बनाएं (internal)

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne rating internal https://$cloudkitty_api:8889

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0b4572fca02547c588f4774921d6f2fb |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 2fada9255fb84fff8c06867b9956b464 |
| service_name | cloudkitty                       |
| service_type | rating                           |
| url          | https://network.srv.world:8889   |
+--------------+----------------------------------+

# [cloudkitty] के लिए समापन बिंदु बनाएं (admin)

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne rating admin https://$cloudkitty_api:8889

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 4aa6068649a1420ca5a49f791ec5d953 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 2fada9255fb84fff8c06867b9956b464 |
| service_name | cloudkitty                       |
| service_type | rating                           |
| url          | https://network.srv.world:8889   |
+--------------+----------------------------------+
[2] CloudKitty के लिए MariaDB पर एक उपयोगकर्ता और डेटाबेस जोड़ें।
root@dlp ~(keystone)#
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 21202
Server version: 10.11.7-MariaDB-2ubuntu2 Ubuntu 24.04

Copyright (c) 2000, 2018, 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 'password'; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on cloudkitty.* to cloudkitty@'%' identified by 'password'; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit 
Bye
[3] नेटवर्क नोड पर CloudKitty इंस्टॉल करें. इंस्टालेशन के दौरान प्रश्नों के लिए, सभी के लिए [नहीं] ठीक है।
root@network:~#
apt -y install cloudkitty-api cloudkitty-processor python3-cloudkittyclient
[4] वैध SSL/TLS प्रमाणपत्र प्राप्त करें या नेटवर्कनोड के लिए स्व-हस्ताक्षरित प्रमाणपत्र बनाएं और कॉन्फ़िगर करें।
root@network:~#
mkdir -p /etc/cloudkitty/ssl/{public,private}

root@network:~#
cp /etc/letsencrypt/live/network.srv.world/fullchain.pem /etc/cloudkitty/ssl/public/fullchain.crt

root@network:~#
cp /etc/letsencrypt/live/network.srv.world/privkey.pem /etc/cloudkitty/ssl/private/

root@network:~#
chown -R cloudkitty. /etc/cloudkitty/ssl
root@network:~#
mv /etc/cloudkitty/cloudkitty.conf /etc/cloudkitty/cloudkitty.conf.org

root@network:~#
vi /etc/cloudkitty/cloudkitty.conf
# नया निर्माण

[DEFAULT]
log_dir = /var/log/cloudkitty
transport_url = rabbit://openstack:password@dlp.srv.world:5672
auth_strategy = keystone

[collect]
collector = gnocchi
# रेटिंग के लिए अवधि निर्धारित करें
# डिफ़ॉल्ट 3600 (सेकंड) है
# * निम्नलिखित छोटी अवधि एक परीक्षण के लिए है
period = 600
metrics_conf = /etc/cloudkitty/metrics.yml

[collector_gnocchi]
auth_section = keystone_authtoken
region_name = RegionOne

# MariaDB कनेक्शन जानकारी
[database]
connection = mysql+pymysql://cloudkitty:password@dlp.srv.world:3306/cloudkitty

[fetcher]
backend = gnocchi

[fetcher_gnocchi]
auth_section = keystone_authtoken
region_name = RegionOne

[fetcher_keystone]
keystone_version = 3
auth_section = keystone_authtoken
region_name = RegionOne

# Keystone प्रामाणिक जानकारी
[keystone_authtoken]
www_authenticate_uri = https://dlp.srv.world:5000/v3
auth_url = https://dlp.srv.world:5000/v3
memcached_servers = dlp.srv.world:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = cloudkitty
password = servicepassword
region_name = RegionOne
service_token_roles_required = true
# यदि Apache2 Keystone पर स्व-हस्ताक्षरित प्रमाणपत्र का उपयोग कर रहे हैं, तो [true] पर जाएँ
insecure = false

[oslo_messaging_notifications]
driver = messagingv2
transport_url = rabbit://openstack:password@dlp.srv.world:5672

[storage]
backend = sqlalchemy
version = 1

# MariaDB कनेक्शन जानकारी
[orchestrator]
coordination_url = mysql://cloudkitty:password@dlp.srv.world:3306/cloudkitty

root@network:~#
mv /etc/cloudkitty/metrics.yml /etc/cloudkitty/metrics.yml.org

root@network:~#
vi /etc/cloudkitty/metrics.yml
# नया निर्माण

metrics:
  cpu:
    unit: instance
    alt_name: instance
    groupby:
      - id
      - user_id
      - project_id
    metadata:
      - flavor_name
      - flavor_id
      - vcpus
    mutate: NUMBOOL
    extra_args:
      aggregation_method: mean
      resource_type: instance
      force_granularity: 300

  volume.size:
    unit: GiB
    groupby:
      - id
      - user_id
      - project_id
    metadata:
      - volume_type
    extra_args:
      aggregation_method: mean
      resource_type: volume
      force_granularity: 300

root@network:~#
chmod 640 /etc/cloudkitty/{cloudkitty.conf,metrics.yml}

root@network:~#
chgrp cloudkitty /etc/cloudkitty/{cloudkitty.conf,metrics.yml}

root@network:~#
su -s /bin/bash cloudkitty -c "cloudkitty-dbsync upgrade"

root@network:~#
su -s /bin/bash cloudkitty -c "cloudkitty-storage-init"

root@network:~#
systemctl restart cloudkitty-api cloudkitty-processor

root@network:~#
systemctl enable cloudkitty-api cloudkitty-processor

[5] नियंत्रण नोड पर स्थिति सत्यापित करें।
root@dlp ~(keystone)#
apt -y install python3-cloudkittyclient

root@dlp ~(keystone)#
openstack rating summary get

+-----------------+---------------+------+-----------------+-----------------+
| Tenant ID       | Resource Type | Rate | Begin Time      | End Time        |
+-----------------+---------------+------+-----------------+-----------------+
| 9c5145f76fd8432 | ALL           | 0    | 2024-05-        | 2024-06-        |
| 4bdd2b1b61658a2 |               |      | 01T00:00:00     | 01T00:00:00     |
| 82              |               |      |                 |                 |
+-----------------+---------------+------+-----------------+-----------------+
मिलान सामग्री