コントローラーノードのインストールと設定

コントローラーノードのインストールと設定

このセクションは、Block Storage サービスをコントローラーノードにインストールして設定する方法を説明します。このサービスでは、ボリュームをインスタンスに提供するストレージノードが少なくとも 1 つ必要です。

前提条件

Block Storage サービスをインストールして設定する前に、データベース、サービスクレデンシャル、API エンドポイントを作成する必要があります。

  1. データベースを作成するには、これらの手順をすべて実行します。

    • データベースクライアントを使用して、データベースサーバーに root ユーザーとして接続します。

      $ mysql -u root -p
      
    • cinder データベースを作成します。

      CREATE DATABASE cinder;
      
    • cinder データベースに適切なアクセス権を付与します。

      GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
        IDENTIFIED BY 'CINDER_DBPASS';
      GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
        IDENTIFIED BY 'CINDER_DBPASS';
      

      CINDER_DBPASS を適切なパスワードに置き換えてください。

    • データベースクライアントを終了します。

  2. admin クレデンシャルを読み込み、管理者専用 CLI コマンドへのアクセス権を取得します。

    $ source admin-openrc.sh
    
  3. 以下の手順を実行して、サービスクレデンシャルを作成します。

    • cinder ユーザーを作成します。

      $ openstack user create --domain default --password-prompt cinder
      User Password:
      Repeat User Password:
      +-----------+----------------------------------+
      | Field     | Value                            |
      +-----------+----------------------------------+
      | domain_id | default                          |
      | enabled   | True                             |
      | id        | bb279f8ffc444637af38811a5e1f0562 |
      | name      | cinder                           |
      +-----------+----------------------------------+
      
    • admin ロールを cinder ユーザーに追加します。

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

      注釈

      このコマンドは何も出力しません。

    • cinder および cinderv2 サービスエンティティーを作成します。

      $ openstack service create --name cinder \
        --description "OpenStack Block Storage" volume
      +-------------+----------------------------------+
      | Field       | Value                            |
      +-------------+----------------------------------+
      | description | OpenStack Block Storage          |
      | enabled     | True                             |
      | id          | ab3bbbef780845a1a283490d281e7fda |
      | name        | cinder                           |
      | type        | volume                           |
      +-------------+----------------------------------+
      
      $ openstack service create --name cinderv2 \
        --description "OpenStack Block Storage" volumev2
      +-------------+----------------------------------+
      | Field       | Value                            |
      +-------------+----------------------------------+
      | description | OpenStack Block Storage          |
      | enabled     | True                             |
      | id          | eb9fd245bdbc414695952e93f29fe3ac |
      | name        | cinderv2                         |
      | type        | volumev2                         |
      +-------------+----------------------------------+
      

    注釈

    Block Storage サービスは 2 つのサービスエンティティーを必要とします。

  4. Block Storage サービスの API エンドポイントを作成します。

    $ openstack endpoint create --region RegionOne \
      volume public http://controller:8776/v1/%\(tenant_id\)s
      +--------------+-----------------------------------------+
      | Field        | Value                                   |
      +--------------+-----------------------------------------+
      | enabled      | True                                    |
      | id           | 03fa2c90153546c295bf30ca86b1344b        |
      | interface    | public                                  |
      | region       | RegionOne                               |
      | region_id    | RegionOne                               |
      | service_id   | ab3bbbef780845a1a283490d281e7fda        |
      | service_name | cinder                                  |
      | service_type | volume                                  |
      | url          | http://controller:8776/v1/%(tenant_id)s |
      +--------------+-----------------------------------------+
    
    $ openstack endpoint create --region RegionOne \
      volume internal http://controller:8776/v1/%\(tenant_id\)s
      +--------------+-----------------------------------------+
      | Field        | Value                                   |
      +--------------+-----------------------------------------+
      | enabled      | True                                    |
      | id           | 94f684395d1b41068c70e4ecb11364b2        |
      | interface    | internal                                |
      | region       | RegionOne                               |
      | region_id    | RegionOne                               |
      | service_id   | ab3bbbef780845a1a283490d281e7fda        |
      | service_name | cinder                                  |
      | service_type | volume                                  |
      | url          | http://controller:8776/v1/%(tenant_id)s |
      +--------------+-----------------------------------------+
    
    $ openstack endpoint create --region RegionOne \
      volume admin http://controller:8776/v1/%\(tenant_id\)s
      +--------------+-----------------------------------------+
      | Field        | Value                                   |
      +--------------+-----------------------------------------+
      | enabled      | True                                    |
      | id           | 4511c28a0f9840c78bacb25f10f62c98        |
      | interface    | admin                                   |
      | region       | RegionOne                               |
      | region_id    | RegionOne                               |
      | service_id   | ab3bbbef780845a1a283490d281e7fda        |
      | service_name | cinder                                  |
      | service_type | volume                                  |
      | url          | http://controller:8776/v1/%(tenant_id)s |
      +--------------+-----------------------------------------+
    
    $ openstack endpoint create --region RegionOne \
      volumev2 public http://controller:8776/v2/%\(tenant_id\)s
    +--------------+-----------------------------------------+
    | Field        | Value                                   |
    +--------------+-----------------------------------------+
    | enabled      | True                                    |
    | id           | 513e73819e14460fb904163f41ef3759        |
    | interface    | public                                  |
    | region       | RegionOne                               |
    | region_id    | RegionOne                               |
    | service_id   | eb9fd245bdbc414695952e93f29fe3ac        |
    | service_name | cinderv2                                |
    | service_type | volumev2                                |
    | url          | http://controller:8776/v2/%(tenant_id)s |
    +--------------+-----------------------------------------+
    
    $ openstack endpoint create --region RegionOne \
      volumev2 internal http://controller:8776/v2/%\(tenant_id\)s
    +--------------+-----------------------------------------+
    | Field        | Value                                   |
    +--------------+-----------------------------------------+
    | enabled      | True                                    |
    | id           | 6436a8a23d014cfdb69c586eff146a32        |
    | interface    | internal                                |
    | region       | RegionOne                               |
    | region_id    | RegionOne                               |
    | service_id   | eb9fd245bdbc414695952e93f29fe3ac        |
    | service_name | cinderv2                                |
    | service_type | volumev2                                |
    | url          | http://controller:8776/v2/%(tenant_id)s |
    +--------------+-----------------------------------------+
    
    $ openstack endpoint create --region RegionOne \
      volumev2 admin http://controller:8776/v2/%\(tenant_id\)s
    +--------------+-----------------------------------------+
    | Field        | Value                                   |
    +--------------+-----------------------------------------+
    | enabled      | True                                    |
    | id           | e652cf84dd334f359ae9b045a2c91d96        |
    | interface    | admin                                   |
    | region       | RegionOne                               |
    | region_id    | RegionOne                               |
    | service_id   | eb9fd245bdbc414695952e93f29fe3ac        |
    | service_name | cinderv2                                |
    | service_type | volumev2                                |
    | url          | http://controller:8776/v2/%(tenant_id)s |
    +--------------+-----------------------------------------+
    

    注釈

    Block Storage サービスはそれぞれのサービスエンティティーのエンドポイントを必要とします。

コンポーネントのインストールと設定

  1. パッケージをインストールします。

    # apt-get install cinder-api cinder-scheduler python-cinderclient
    
  1. /etc/cinder/cinder.conf ファイルを編集し、以下の作業をすべて行います。

    • [database] セクションで、データベースのアクセス方法を設定します。

      [database]
      ...
      connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
      

      CINDER_DBPASS を Block Storage データベース用に選択したパスワードで置き換えます。

    • [DEFAULT][oslo_messaging_rabbit] セクションに、RabbitMQ メッセージキューのアクセス方法を設定します。

      [DEFAULT]
      ...
      rpc_backend = rabbit
      
      [oslo_messaging_rabbit]
      ...
      rabbit_host = controller
      rabbit_userid = openstack
      rabbit_password = RABBIT_PASS
      

      RABBIT_PASSRabbitMQopenstack アカウント用に選択したパスワードで置き換えます。

    • [DEFAULT] セクションと [keystone_authtoken] セクションに、Identity サービスへのアクセス方法を設定します。

      [DEFAULT]
      ...
      auth_strategy = keystone
      
      [keystone_authtoken]
      ...
      auth_uri = http://controller:5000
      auth_url = http://controller:35357
      auth_plugin = password
      project_domain_id = default
      user_domain_id = default
      project_name = service
      username = cinder
      password = CINDER_PASS
      

      CINDER_PASS を Identity サービスで cinder ユーザー用に選択したパスワードで置き換えます。

      注釈

      [keystone_authtoken] セクションにある他のオプションは、コメントアウトまたは削除します。

    • [DEFAULT] セクションで、コントローラーノードの管理インターフェースの IP アドレスを使用するように``my_ip`` オプションを設定します。

      [DEFAULT]
      ...
      my_ip = 10.0.0.11
      
    • [oslo_concurrency] セクションにロックパスを設定します。

      [oslo_concurrency]
      ...
      lock_path = /var/lib/cinder/tmp
      
    • (オプション) トラブルシューティングしやすくするために、冗長ロギングを [DEFAULT] セクションで有効にします。

      [DEFAULT]
      ...
      verbose = True
      
  2. Block Storage データベースを展開します。

    # su -s /bin/sh -c "cinder-manage db sync" cinder
    

Block Storage を使用するための Compute の設定

  • /etc/nova/nova.conf ファイルを編集し、以下を追加します。

    [cinder]
    os_region_name = RegionOne
    

インストールの最終作業

  1. Compute API サービスを再起動します。

    # service nova-api restart
    
  2. Block Storage サービスを再起動します。

    # service cinder-scheduler restart
    # service cinder-api restart
    
  3. デフォルトでは、Ubuntu パッケージは SQLite データベースを作成します。

    今回の設定では SQL データベースサーバーを使用するため、SQLite データベースファイルを削除できます。

    # rm -f /var/lib/cinder/cinder.sqlite
    
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.