高可用性 Image API

高可用性 Image API

OpenStack Image サービスは、仮想マシンイメージを検索、登録、取得するためのサービスを提供します。OpenStack Image API サービスをアクティブ/パッシブモードで高可用性にするために、以下が必要になります。

前提条件

Before beginning, ensure that you are familiar with the documentation for installing the OpenStack Image API service. See the Image service section in the Installation Guides, depending on your distribution.

OpenStack Image API リソースの Pacemaker への追加

  1. まず、お使いのシステムにリソースエージェントをダウンロードします。

    # cd /usr/lib/ocf/resource.d/openstack
    # wget https://git.openstack.org/cgit/openstack/openstack-resource-agents/plain/ocf/glance-api
    # chmod a+rx *
    
  2. ここで OpenStack Image API リソース向けに Pacemaker の設定を追加します。以下のコマンドを使用して、Pacemaker クラスターに接続します。

    crm configure
    

    注釈

    crm configure はバッチ入力をサポートします。そのため、現在の pacemaker 設定の中に上の行をコピー・ペーストし、適宜変更を反映できます。

    例えば、お好みの仮想 IP アドレスに一致させるために、crm configure メニューから edit  p_ip_glance-api と入力し、リソースを編集できます。

  3. 以下のクラスターリソースを追加します。

    primitive p_glance-api ocf:openstack:glance-api \
      params config="/etc/glance/glance-api.conf" \
      os_password="secretsecret" \
      os_username="admin" os_tenant_name="admin" \
      os_auth_url="http://10.0.0.11:5000/v2.0/" \
      op monitor interval="30s" timeout="30s"
    

    この設定は p_glance-api を作成します。これは OpenStack Image API サービスを管理するリソースです。

  4. crm configure メニューから以下のコマンドを実行して、設定の変更を反映します。

    commit
    

Pacemaker は OpenStack Image API サービスおよび依存するリソースを同じノードに起動します。

OpenStack Image サービス API の設定

/etc/glance/glance-api.conf ファイルを編集して、OpenStack Image サービスを設定します。

# We have to use MySQL connection to store data:
sql_connection=mysql://glance:password@10.0.0.11/glance
# Alternatively, you can switch to pymysql,
# a new Python 3 compatible library and use
# sql_connection=mysql+pymysql://glance:password@10.0.0.11/glance
# and be ready when everything moves to Python 3.
# Ref: https://wiki.openstack.org/wiki/PyMySQL_evaluation

# We bind OpenStack Image API to the VIP:
bind_host = 10.0.0.11

# Connect to OpenStack Image registry service:
registry_host = 10.0.0.11

# We send notifications to High Available RabbitMQ:
notifier_strategy = rabbit
rabbit_host = 10.0.0.11

[TODO: need more discussion of these parameters]

高可用性 OpenStack Image Service API を使用するための OpenStack サービスの設定

OpenStack サービスが、非 HA クラスターであるような OpenStack Image API サーバーの物理 IP アドレスを指し示す代わりに、高可用性な仮想クラスター IP アドレスを指し示すように、それらの OpenStack Image API の設定を変更する必要があります。

例えば、OpenStack Image API サービスの IP アドレスが (ここで説明されている設定のように) 10.0.0.11 ならば、以下の設定を nova.conf ファイルに使用します。

[glance]
# ...
api_servers = 10.0.0.11
# ...

この IP アドレスを用いて OpenStack Image API エンドポイントを作成する必要があります。プライベート IP アドレスとパブリック IP アドレスを両方使用している場合、2 つの仮想 IP アドレスを作成して、次のようにエンドポイントを定義します。

$ openstack endpoint create --region $KEYSTONE_REGION \
  image public http://PUBLIC_VIP:9292

$ openstack endpoint create --region $KEYSTONE_REGION \
  image admin http://10.0.0.11:9292

$ openstack endpoint create --region $KEYSTONE_REGION \
  image internal http://10.0.0.11:9292
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.