Install and configure for Red Hat Enterprise Linux and CentOS

This section describes how to install and configure the Infrastructure Optimization service for Red Hat Enterprise Linux 7 and CentOS 7.

Prerequisites

Before you install and configure the Infrastructure Optimization service, you must create a database, service credentials, and API endpoints.

  1. Create the database, complete these steps:

    • Use the database access client to connect to the database server as the root user:

      # mysql
      
    • Create the watcher database:

      CREATE DATABASE watcher CHARACTER SET utf8;
      
    • Grant proper access to the watcher database:

      GRANT ALL PRIVILEGES ON watcher.* TO 'watcher'@'localhost' \
        IDENTIFIED BY 'WATCHER_DBPASS';
      GRANT ALL PRIVILEGES ON watcher.* TO 'watcher'@'%' \
        IDENTIFIED BY 'WATCHER_DBPASS';
      

      Replace WATCHER_DBPASS with a suitable password.

    • Exit the database access client.

      exit;
      
  2. Source the admin credentials to gain access to admin-only CLI commands:

    $ . admin-openrc
    
  3. To create the service credentials, complete these steps:

    • Create the watcher user:

      $ openstack user create --domain default --password-prompt watcher
        User Password:
        Repeat User Password:
        +---------------------+----------------------------------+
        | Field               | Value                            |
        +---------------------+----------------------------------+
        | domain_id           | default                          |
        | enabled             | True                             |
        | id                  | b18ee38e06034b748141beda8fc8bfad |
        | name                | watcher                          |
        | options             | {}                               |
        | password_expires_at | None                             |
        +---------------------+----------------------------------+
      
    • Add the admin role to the watcher user:

      $ openstack role add --project service --user watcher admin
      

      Note

      This command produces no output.

    • Create the watcher service entities:

      $ openstack service create --name watcher --description "Infrastructure Optimization" infra-optim
        +-------------+----------------------------------+
        | Field       | Value                            |
        +-------------+----------------------------------+
        | description | Infrastructure Optimization      |
        | enabled     | True                             |
        | id          | d854f6fff0a64f77bda8003c8dedfada |
        | name        | watcher                          |
        | type        | infra-optim                      |
        +-------------+----------------------------------+
      
  4. Create the Infrastructure Optimization service API endpoints:

    $ openstack endpoint create --region RegionOne \
      infra-optim public http://controller:9322
      +-------------+----------------------------------+
      | Field       | Value                            |
      +-------------+----------------------------------+
      | description | Infrastructure Optimization      |
      | enabled     | True                             |
      | id          | d854f6fff0a64f77bda8003c8dedfada |
      | name        | watcher                          |
      | type        | infra-optim                      |
      +-------------+----------------------------------+
    
    $ openstack endpoint create --region RegionOne \
      infra-optim internal http://controller:9322
      +--------------+----------------------------------+
      | Field        | Value                            |
      +--------------+----------------------------------+
      | enabled      | True                             |
      | id           | 225aef8465ef4df48a341aaaf2b0a390 |
      | interface    | internal                         |
      | region       | RegionOne                        |
      | region_id    | RegionOne                        |
      | service_id   | d854f6fff0a64f77bda8003c8dedfada |
      | service_name | watcher                          |
      | service_type | infra-optim                      |
      | url          | http://controller:9322           |
      +--------------+----------------------------------+
    
    $ openstack endpoint create --region RegionOne \
      infra-optim admin http://controller:9322
      +--------------+----------------------------------+
      | Field        | Value                            |
      +--------------+----------------------------------+
      | enabled      | True                             |
      | id           | 375eb5057fb546edbdf3ee4866179672 |
      | interface    | admin                            |
      | region       | RegionOne                        |
      | region_id    | RegionOne                        |
      | service_id   | d854f6fff0a64f77bda8003c8dedfada |
      | service_name | watcher                          |
      | service_type | infra-optim                      |
      | url          | http://controller:9322           |
      +--------------+----------------------------------+
    

Install and configure components

  1. Install the packages:

    # sudo yum install openstack-watcher-api openstack-watcher-applier \
      openstack-watcher-decision-engine
    
  1. Edit the /etc/watcher/watcher.conf file and complete the following actions:

    • In the [database] section, configure database access:

      [database]
      ...
      connection = mysql+pymysql://watcher:WATCHER_DBPASS@controller/watcher?charset=utf8
      
    • In the [DEFAULT] section, configure the transport url for RabbitMQ message broker.

      [DEFAULT]
      ...
      control_exchange = watcher
      transport_url = rabbit://openstack:RABBIT_PASS@controller
      

      Replace the RABBIT_PASS with the password you chose for OpenStack user in RabbitMQ.

    • In the [keystone_authtoken] section, configure Identity service access.

      [keystone_authtoken]
      ...
      www_authenticate_uri = http://controller:5000
      auth_url = http://controller:5000
      memcached_servers = controller:11211
      auth_type = password
      project_domain_name = default
      user_domain_name = default
      project_name = service
      username = watcher
      password = WATCHER_PASS
      

      Replace WATCHER_PASS with the password you chose for the watcher user in the Identity service.

    • Watcher interacts with other OpenStack projects via project clients, in order to instantiate these clients, Watcher requests new session from Identity service. In the [watcher_clients_auth] section, configure the identity service access to interact with other OpenStack project clients.

      [watcher_clients_auth]
      ...
      auth_type = password
      auth_url = http://controller:5000
      username = watcher
      password = WATCHER_PASS
      project_domain_name = default
      user_domain_name = default
      project_name = service
      

      Replace WATCHER_PASS with the password you chose for the watcher user in the Identity service.

    • In the [api] section, configure host option.

      [api]
      ...
      host = controller
      

      Replace controller with the IP address of the management network interface on your controller node, typically 10.0.0.11 for the first node in the example architecture.

    • In the [oslo_messaging_notifications] section, configure the messaging driver.

      [oslo_messaging_notifications]
      ...
      driver = messagingv2
      
  2. Populate watcher database:

    su -s /bin/sh -c "watcher-db-manage --config-file /etc/watcher/watcher.conf upgrade"
    

Finalize installation

Start the Infrastructure Optimization services and configure them to start when the system boots:

# systemctl enable openstack-watcher-api.service \
  openstack-watcher-decision-engine.service \
  openstack-watcher-applier.service

# systemctl start openstack-watcher-api.service \
  openstack-watcher-decision-engine.service \
  openstack-watcher-applier.service