CentOS 7
Sponsored Link

OpenStack Train : Gnocchi 設定2019/10/29

 
時系列データベース [TDBaaS (Time Series Database as a Service)] Gnocchi をインストールします。
当例では以下のような環境を例に Gnocchi をインストールします。
------------+---------------------------+---------------------------+------------
            |                           |                           |
        eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
+-----------+-----------+   +-----------+-----------+   +-----------+-----------+
|    [ Control Node ]   |   |    [ Storage Node ]   |   |    [ Compute Node ]   |
|                       |   |                       |   |                       |
|  MariaDB    RabbitMQ  |   |      Open vSwitch     |   |        Libvirt        |
|  Memcached  httpd     |   |        L2 Agent       |   |     Nova Compute      |
|  Keystone   Glance    |   |        L3 Agent       |   |      Open vSwitch     |
|  Nova API  Cinder API |   |     Metadata Agent    |   |        L2 Agent       |
|  Neutron Server       |   |     Cinder Volume     |   |                       |
|  Metadata Agent       |   |        Heat API       |   |                       |
|  Gnocchi              |   |      Heat Engine      |   |                       |
+-----------------------+   +-----------------------+   +-----------------------+

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

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

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | 2b9c4eda462e40a4a3d03b0a38f12bf1 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 1a0635ae630a4ed4a247d9b80f624d75 |
| 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          | 1a3b94b69fe6472b82807a83fed4616c |
| name        | gnocchi                          |
| type        | metric                           |
+-------------+----------------------------------+

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

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

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | b2b15011e75347e69b3d7604f4b12abf |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1a3b94b69fe6472b82807a83fed4616c |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.30:8041            |
+--------------+----------------------------------+

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

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | f855dae888fd446a84caf651b4ffcd35 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1a3b94b69fe6472b82807a83fed4616c |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.30:8041            |
+--------------+----------------------------------+

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

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | f8d0b9071f6f4236bb312bc4c1f74fce |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1a3b94b69fe6472b82807a83fed4616c |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.30: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 324
Server version: 10.3.10-MariaDB MariaDB Server

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] Gnocchi サービスをインストールします。
# Train, EPEL からインストール

[root@dlp ~(keystone)]#
yum --enablerepo=centos-openstack-train,epel -y install openstack-gnocchi-api openstack-gnocchi-metricd python-gnocchiclient
[4] Gnocchi の基本設定です。
[root@dlp ~(keystone)]#
mv /etc/gnocchi/gnocchi.conf /etc/gnocchi/gnocchi.conf.org

[root@dlp ~(keystone)]#
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@dlp ~(keystone)]#
vi /etc/httpd/conf.d/10-gnocchi_wsgi.conf
# 新規作成

Listen 8041
<VirtualHost *:8041>
  <Directory /usr/bin>
    AllowOverride None
    Require all granted
  </Directory>

  CustomLog /var/log/httpd/gnocchi_wsgi_access.log combined
  ErrorLog /var/log/httpd/gnocchi_wsgi_error.log
  SetEnvIf X-Forwarded-Proto https HTTPS=1
  WSGIApplicationGroup %{GLOBAL}
  WSGIDaemonProcess gnocchi display-name=gnocchi_wsgi user=gnocchi group=gnocchi processes=6 threads=6
  WSGIProcessGroup gnocchi
  WSGIScriptAlias / /usr/bin/gnocchi-api
</VirtualHost>

[root@dlp ~(keystone)]#
chmod 640 /etc/gnocchi/gnocchi.conf

[root@dlp ~(keystone)]#
chgrp gnocchi /etc/gnocchi/gnocchi.conf

[root@dlp ~(keystone)]#
su -s /bin/bash gnocchi -c "gnocchi-upgrade"

[root@dlp ~(keystone)]#
systemctl start openstack-gnocchi-metricd

[root@dlp ~(keystone)]#
systemctl enable openstack-gnocchi-metricd

[root@dlp ~(keystone)]#
systemctl restart httpd

# 動作確認

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

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

[5] SELinux を有効にしている場合は、ポリシーの変更が必要です。
[root@dlp ~(keystone)]#
semanage port -a -t http_port_t -p tcp 8041

[6] Firewalld を有効にしている場合は、サービスポートの許可が必要です。
[root@dlp ~(keystone)]#
firewall-cmd --add-port=8041/tcp --permanent

success
[root@dlp ~(keystone)]#
firewall-cmd --reload

success
関連コンテンツ