高可用性 Block Storage API

高可用性 Block Storage API

Cinder は、データベースなどの性能を必要とするシナリオ、拡張可能なファイルシステム、ローブロックレベルストレージにアクセスするサーバーに適するサービスとして Block-Storage-as-a-Service を提供します。

永続ブロックストレージは、インスタンス終了後に残存して、任意の外部ストレージデバイスのようにインスタンスを越えて移動できます。Cinder は、ボリュームをバックアップするために、ボリュームスナップショット機能も持ちます。

Block Storage API サービスのアクティブ/パッシブモードでの高可用性は、以下が関係します。

理論的には、Block Storage サービスをアクティブ/アクティブとして実行できます。しかしながら、いくつかの課題のため、ボリュームコンポーネントをアクティブ/パッシブのみとして実行することが推奨されます。

これらの課題の詳細は Red Hat Bugzilla にあります。また、アップストリームにおいて解決するための psuedo roadmap があります。

Block Storage API リソースの Pacemaker への追加

RHEL 系のシステムでは、cinder の systemd エージェント向けリソースを作成して、起動と停止の順番を強制する制約を作成します。

pcs resource create openstack-cinder-api systemd:openstack-cinder-api --clone interleave=true
pcs resource create openstack-cinder-scheduler systemd:openstack-cinder-scheduler --clone interleave=true
pcs resource create openstack-cinder-volume systemd:openstack-cinder-volume

pcs constraint order start openstack-cinder-api-clone then openstack-cinder-scheduler-clone
pcs constraint colocation add openstack-cinder-scheduler-clone with openstack-cinder-api-clone
pcs constraint order start openstack-cinder-scheduler-clone then openstack-cinder-volume
pcs constraint colocation add openstack-cinder-volume with openstack-cinder-scheduler-clone

Block Storage サービスが他のサービスと同じノードで実行している場合、以下も含めることを推奨します。

pcs constraint order start openstack-keystone-clone then openstack-cinder-api-clone

または、systemd エージェントを使用する代わりに、OCF リソースエージェントをダウンロードしてインストールします。

# cd /usr/lib/ocf/resource.d/openstack
# wget https://git.openstack.org/cgit/openstack/openstack-resource-agents/plain/ocf/cinder-api
# chmod a+rx *

Block Storage API リソース用の Pacemaker 設定を追加できます。 crm configure を用いて Pacemaker クラスターに接続し、以下のクラスターリソースを追加します。

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

この設定は Block Storage API サービスを管理するためのリソース p_cinder-api を作成します。

crm configure コマンドはバッチ入力をサポートします。現在の Pacemaker 設定の中に上の行をコピー・ペーストし、適宜変更を反映できます。例えば、お好みの仮想 IP アドレスに一致させるために、crm configure メニューから edit  p_ip_cinder-api と入力し、リソースを編集できます。

これらの手順の完了後、crm configure メニューから commit と入力し、設定の変更をコミットします。Pacemaker は Block Storage API サービスおよび依存するリソースを同じノードに起動します。

Block Storage API サービスの設定

/etc/cinder/cinder.conf ファイルを編集します。たとえば、RHEL 系システムの場合:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[DEFAULT]
# This is the name which we should advertise ourselves as and for
# A/P installations it should be the same everywhere
host = cinder-cluster-1

# Listen on the Block Storage VIP
osapi_volume_listen = 10.0.0.11

auth_strategy = keystone
control_exchange = cinder

volume_driver = cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config = /etc/cinder/nfs_exports
nfs_sparsed_volumes = true
nfs_mount_options = v3

[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@10.0.0.11/cinder
max_retries = -1

[keystone_authtoken]
# 10.0.0.11 is the Keystone VIP
identity_uri = http://10.0.0.11:5000/
www_authenticate_uri = http://10.0.0.11:5000/
admin_tenant_name = service
admin_user = cinder
admin_password = CINDER_PASS

[oslo_messaging_rabbit]
# Explicitly list the rabbit hosts as it doesn't play well with HAProxy
rabbit_hosts = 10.0.0.12,10.0.0.13,10.0.0.14
# As a consequence, we also need HA queues
rabbit_ha_queues = True
heartbeat_timeout_threshold = 60
heartbeat_rate = 2

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

この例は、物理ストレージに NFS を使用していることを仮定します。これは、ほとんどの本番環境のインストールにおいて正しくありません。

Block Storage サービス OCF エージェントを使用している場合、いくつかの設定は入力されていて、設定ファイルを短くできます。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# We have to use MySQL connection to store data:
connection = mysql+pymysql://cinder:CINDER_DBPASS@10.0.0.11/cinder
# Alternatively, you can switch to pymysql,
# a new Python 3 compatible library and use
# connection = mysql+pymysql://cinder:CINDER_DBPASS@10.0.0.11/cinder
# and be ready when everything moves to Python 3.
# Ref: https://wiki.openstack.org/wiki/PyMySQL_evaluation

# We bind Block Storage API to the VIP:
osapi_volume_listen = 10.0.0.11

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

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

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

OpenStack サービスは、非 HA 環境と同じように Block Storage API サーバーの物理 IP アドレスを指定する代わりに、Block Storage API の設定が高可用性と仮想クラスター IP アドレスを指し示す必要があります。

この IP を用いて Block Storage API エンドポイントを作成します。

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

$ openstack endpoint create volume --region $KEYSTONE_REGION \
  --publicurl 'http://PUBLIC_VIP:8776/v1/%(tenant_id)s' \
  --adminurl 'http://10.0.0.11:8776/v1/%(tenant_id)s' \
  --internalurl 'http://10.0.0.11:8776/v1/%(tenant_id)s'
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.