Ubuntu 24.04
Sponsored Link

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

 

TDBaaS (एक सेवा के रूप में समय श्रृंखला डेटाबेस), Gnocchi स्थापित करें।

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

------------+--------------------------+--------------------------+------------
            |                          |                          |
        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     |  |                       |
|  Neutron Metadata     |  |     httpd  Gnocchi    |  |                       |
|  Cinder API           |  |                       |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

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

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

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | ab9749e59bdb48e4807a18abb83c9f99 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 6e87fe46652d4a1bb4fd76e415f03d32 |
| name                | gnocchi                          |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

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

root@dlp ~(keystone)#
openstack role add --project service --user gnocchi admin
# create service entry for [gnocchi]

root@dlp ~(keystone)#
openstack service create --name gnocchi --description "Metric Service" metric

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Metric Service                   |
| enabled     | True                             |
| id          | 2a8a529237c449d7b3572a91c33eb4bc |
| name        | gnocchi                          |
| type        | metric                           |
+-------------+----------------------------------+

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

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

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne metric public https://$controller:8041

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 13b05075647f44a7965f6119e90b9f19 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 2a8a529237c449d7b3572a91c33eb4bc |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | https://network.srv.world:8041   |
+--------------+----------------------------------+

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

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne metric internal https://$controller:8041

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | e7625d7e87bb4ce79048ed5ee76ae2d6 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 2a8a529237c449d7b3572a91c33eb4bc |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | https://network.srv.world:8041   |
+--------------+----------------------------------+

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

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne metric admin https://$controller:8041

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

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 108
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 gnocchi; 
Query OK, 1 row affected (0.00 sec)

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

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

MariaDB [(none)]> exit 
Bye
[3] नेटवर्क नोड पर Gnocchi स्थापित करें। इंस्टालेशन के दौरान प्रश्नों के लिए, सभी के लिए [नहीं] ठीक है।
root@network:~#
apt -y install gnocchi-api gnocchi-metricd python3-gnocchiclient apache2 libapache2-mod-wsgi-py3 nginx libnginx-mod-stream
[4] Gnocchi कॉन्फ़िगर करें।
root@network:~#
mv /etc/gnocchi/gnocchi.conf /etc/gnocchi/gnocchi.conf.org

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

[DEFAULT]
log_dir = /var/log/gnocchi

[api]
auth_mode = keystone

[database]
backend = sqlalchemy

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

[storage]
driver = file
file_basepath = /var/lib/gnocchi

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

[oslo_policy]
enforce_new_defaults = false

root@network:~#
vi /etc/apache2/sites-available/gnocchi-api.conf
# पंक्ति 1 : परिवर्तन

Listen
127.0.0.1:8041
root@network:~#
vi /etc/gnocchi/policy.json
# नीतियां जोड़ें

{
    "admin_or_creator": "role:admin or user:%(creator)s or project_id:%(created_by_project_id)s",
    "resource_owner": "project_id:%(project_id)s",
    "metric_owner": "project_id:%(resource.project_id)s",

    "get status": "role:admin",

    "create resource": "",
    "get resource": "rule:admin_or_creator or rule:resource_owner",
    "update resource": "rule:admin_or_creator",
    "delete resource": "rule:admin_or_creator",
    "delete resources": "rule:admin_or_creator",
    "list resource": "rule:admin_or_creator or rule:resource_owner",
    "search resource": "rule:admin_or_creator or rule:resource_owner",

    "create resource type": "role:admin",
    "delete resource type": "role:admin",
    "update resource type": "role:admin",
    "list resource type": "",
    "get resource type": "",

    "get archive policy": "",
    "list archive policy": "",
    "create archive policy": "role:admin",
    "update archive policy": "role:admin",
    "delete archive policy": "role:admin",

    "create archive policy rule": "role:admin",
    "get archive policy rule": "",
    "list archive policy rule": "",
    "update archive policy rule": "role:admin",
    "delete archive policy rule": "role:admin",

    "create metric": "",
    "delete metric": "rule:admin_or_creator",
    "get metric": "rule:admin_or_creator or rule:metric_owner",
    "search metric": "rule:admin_or_creator or rule:metric_owner",
    "list metric": "rule:admin_or_creator or rule:metric_owner",

    "get measures":  "rule:admin_or_creator or rule:metric_owner",
    "post measures":  "rule:admin_or_creator"
}

root@network:~#
chmod 640 /etc/gnocchi/gnocchi.conf

root@network:~#
chgrp gnocchi /etc/gnocchi/gnocchi.conf

[5] प्रॉक्सी सेटिंग्स के लिए Nginx कॉन्फ़िगर करें।
root@network:~#
vi /etc/nginx/nginx.conf
# [stream] अनुभाग में जोड़ें

stream {
    upstream neutron-api {
        server 127.0.0.1:9696;
    }
    server {
        listen 10.0.0.50:9696 ssl;
        proxy_pass neutron-api;
    }
    upstream gnocchi-api {
        server 127.0.0.1:8041;
    }
    server {
        listen 10.0.0.50:8041 ssl;
        proxy_pass gnocchi-api;
    }
    ssl_certificate "/etc/letsencrypt/live/network.srv.world/fullchain.pem";
    ssl_certificate_key "/etc/letsencrypt/live/network.srv.world/privkey.pem";
}
[6] डेटाबेस में डेटा जोड़ें और Gnocchi सेवाएँ प्रारंभ करें।
root@network:~#
su -s /bin/bash gnocchi -c "gnocchi-upgrade"

root@network:~#
a2enmod wsgi

root@network:~#
a2ensite gnocchi-api

root@network:~#
systemctl restart gnocchi-metricd apache2 nginx

root@network:~#
systemctl enable gnocchi-metricd

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

root@dlp ~(keystone)#
export OS_AUTH_TYPE=password

root@dlp ~(keystone)#
gnocchi resource list
# यदि कोई त्रुटि नहीं दिखाई देती है तो ठीक है

मिलान सामग्री