Ubuntu 18.04
Sponsored Link

OpenStack Rocky : Gnocchi 設定2018/09/18

 
時系列データベース [TDBaaS (Time Series Database as a Service)] Gnocchi をインストールします。
当例では以下のような環境を例に Network ノードに Gnocchi をインストールします。
Ubuntu Openstack の Gnocchi では Python3 系の WSGI を使用するため、Keystone や Nova で Python2 系の WSGI を使用している場合は、同一ノードへインストール不可です。
------------+---------------------------+---------------------------+------------
            |                           |                           |
        eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
+-----------+-----------+   +-----------+-----------+   +-----------+-----------+
|    [ Control Node ]   |   |    [ Network Node ]   |   |    [ Compute Node ]   |
|                       |   |                       |   |                       |
|  MariaDB    RabbitMQ  |   |      Linux Bridge     |   |        Libvirt        |
|  Memcached  httpd     |   |        L2 Agent       |   |     Nova Compute      |
|  Keystone   Glance    |   |        L3 Agent       |   |      Linux Bridge     |
|  Nova_API  Cinder_API |   |     Metadata Agent    |   |        L2 Agent       |
|  Neutron Server       |   |     Cinder Volume     |   |                       |
|  Metadata Agent       |   |        Heat API       |   |                       |
|                       |   |      Heat Engine      |   |                       |
|                       |   |    Gnocchi  httpd     |   |                       |
+-----------------------+   +-----------------------+   +-----------------------+

[1] Control ノードの Keystone に Gnocchi 用のユーザー等々を登録しておきます。
# gnocchi ユーザー作成 (service プロジェクト所属)

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

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | aaeee626080841a491235fb06e77f10c |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | a9dde9d04a14416a9b4d277a57962758 |
| name                | gnocchi                          |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# gnocchi ユーザーを admin ロール に加える

root@dlp ~(keystone)#
openstack role add --project service --user gnocchi admin
# gnocchi 用サービスエントリ作成

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

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

# Gnocchi API ホストを定義しておく

root@dlp ~(keystone)#
export controller=10.0.0.50
# gnocchi 用エンドポイント作成 (public)

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 7b1b01918a204d49ab1c14bdd024cd1e |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ac7f1e9c0cce41c7902dc28ef8e2a065 |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.50:8041            |
+--------------+----------------------------------+

# gnocchi 用エンドポイント作成 (internal)

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | b11728e02cb749e7bc730c2940a9c08a |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ac7f1e9c0cce41c7902dc28ef8e2a065 |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.50:8041            |
+--------------+----------------------------------+

# gnocchi 用エンドポイント作成 (admin)

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 7d107094625541d1a43aa4545247924e |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ac7f1e9c0cce41c7902dc28ef8e2a065 |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.50:8041            |
+--------------+----------------------------------+
[2] Gnocchi 用のユーザーとデータベースを MariaDB に登録しておきます。
root@dlp ~(keystone)#
mysql -u root -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 131
Server version: 10.1.34-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.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)]>
flush privileges;

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
exit

Bye
[3] Network ノードで Gnocchi サービスをインストールします。インストール中の問いには全て [No] で OK です。
root@network:~#
apt -y install gnocchi-api gnocchi-metricd python-gnocchiclient
[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@10.0.0.30/gnocchi

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

# Keystone 認証情報
[keystone_authtoken]
www_authenticate_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:5000
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = gnocchi
password = servicepassword
service_token_roles_required = true

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

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

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

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

root@network:~#
systemctl enable gnocchi-metricd

# Control ノードで動作確認

root@dlp ~(keystone)#
apt -y install python-gnocchiclient

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

root@dlp ~(keystone)#
gnocchi resource list
# 何も表示されなければ問題なし

関連コンテンツ