DRBD/GettingStarted: Linux HA [対訳]

【原文】
http://linux-ha.org/DRBD/GettingStarted

誤訳がありましたらご指摘ください。

Active/Passive (hot standby)

This is usually the simplest configuration. Here, you have all your active services (e.g. Apache, MySQL, whatever…) all running on one node. The other node sits doing nothing. (See also A Basic Single IP Address Configuration)

通常、これは最もシンプルな構成です。ここに、あなたは、一つのノードで稼動している全てのアクティブなサービス(例えば、Apache、MySQL とか)があります。他のノードはなにもしていません。(A Basic Single IP Address Configuration も見てください)

A typical, simple DRBD config for this would look like:

典型的な、シンプルな DRBD コンフィグ:

TODO: typical active/passive DRBD config

You would configure Apache with all the websites having document roots under this share, e.g. you might have:

あなたは、この共有(例えばあなたが持っているかもしれない)下のドキュメントルートを持つ全てのウェブサイトを設定するでしょう:

|-/ha
|--- web
|----- client1
|----- client2

snippet from Apache config:

Apache config の一部:

<VirtualHost 192.168.0.1>
ServerName client1.example.com
DocumentRoot /ha/web/client1
...
</VirtualHost>
<VirtualHost 192.168.0.1>
ServerName client2.example.com
DocumentRoot /ha/web/client2
...
</VirtualHost>

Setting up heartbeat isn’t difficult but there are two steps you need to be aware of:

heartbeat のセットアップは難しくありませんが、意識するべきのある2つのステップがあります:

  • running the ‘drbddisk’ script, which triggers DRBD to make the current node primary for the given resource

  • 与えられたリソースのために、現在のノードをプライマリにする DRBD トリガーである、’drbddisk’ スクリプトを動かすこと

  • actually mounting the filesystem

  • 実際にファイルシステムをマウントすること

    Here’s a typical, simple, snippet from haresources showing an active/passive configuration. In this case, node1 is the default primary, and there is a “floating” IP address 192.168.0.1:

    これは典型的な、シンプルな、 active/passive の haresources の 設定の一部です。この場合、ノード1はデフォルトでプライマリで、192.168.0.1 の IP アドレスがの空きがあります:

    node1 drbddisk::web Filesystem::/dev/drbd0::/mnt/ha::ext3 192.168.0.1 httpd
    

    Note the order in which the resources are started. drbddisk needs to go first, since it configures DRBD to be primary. Mounting the filesystem is next, and actually running Apache is last. Setting up the network IP obviously needs to happen at some point before Apache starts.

    リソースが開始される順番に注意してください。プライマリになるために、DRBD を設定してから、drbddisk は最初に実行する必要があります。次にファイルシステムをマウントします、そして実際に最後に Apache を実行します。ネットワーク IP をセットアップするのは、Apache が起動する前に何らかのポイントで発生する必要があります。

    <!> drbddisk was datadisk in drbd-0.6.x.

    drbddisk は drbd-0.6.x ではデータディスクでした。

    <!> web above (the parameter to datadisk or drbddisk) is the resource name you chose for the resource section in drbd.conf, not the device (unless you chose to give your resources device names…)

    上のウェブ(datadisk か drbddisk へのパラメタ)はあなたがデバイスではなく、drbd.conf の resource セクション に選んだリソース名です。(あなたが、与えられたリソースにデバイス名を選ばなかったなら)

    With several resources, it has to be written like

    いくつかのリソースで↓そのように書かれていなければなりません。

    castor 10.0.0.30 drbddisk::r0 drbddisk::r1  \
    Filesystem::/dev/drbd0::/crypt::xfs \
    Filesystem::/dev/drbd1::/data::xfs  \
    samba nfs-kernel-server
    

    Active/Active with different services on both nodes


    両ノード上での異なるサービスで Active/Active を構成する

    You might rightly think that the active/passive scenario is rather inefficient, because assuming your systems are generally reliable, you have a perfectly good server sitting doing nothing. Therefore, you might prefer to balance the load somewhat using an active/active configuration, where one node “normally” runs some services, and the other node “normally” runs some other (different) services. (See also A Two IP address Active/Active Configuration)

    あなたのシステムが一般に信頼性が高く、完璧に良いサーバが何もせず置いてあるなら、あなたは active/passive シナリオがかなり効率が悪いと思うかもしれない。それゆえに、いくつかのサービスを普通に動かしているノードや、他の(異なる)サービスを普通に動かしている他のノード active/active 構成にしてロードバランスすることを言いだかもしれない。(A Two IP address Active/Active Configuration を見てください)

    There are a couple of things you need to bear in mind before doing this:

    あなたがこれをする前に覚えておく必要がある2、3のことがあります:

  • If one node can comfortably cope with the load of running all the services, there isn’t necessarily much point in trying to split them. However:

  • もし一つのノードが負荷を快適に切り抜けることができるなら、それらを分ける意味があまりありません。しかしながら:

  • If one node can’t cope with the load, then consider what’s going to happen when you need to failover all services to one node

  • 一つのノードが負荷を切り抜けることができないなら、一つのノードに全てのサービスがフェイルオーバーすることを必要とするとき、何が起こるか考えてください。

    (these considerations are general to HA, not DRBD-specific)

    (それらの考え方は HA にとって一般的なことで、DRBD 特定のことではありません)

    However, assuming this is what you want to do, and that the services running on each node each require a shared filesystem (i.e. DRBD), then you need to take the following steps:

    しかしながら、これがあなたがしたいことで、お互いのノードで動くサービスが、お互いに共有ファイルシステムを必要とする(例えば DRBD)とき、あなたは以下のステップを踏む必要があります:

    1. Make sure you have separate DRBD resources (drbd0, drbd1…) set up. Since it’s not currently possible with DRBD to have a shared filesystem mounted on both primary and secondary nodes (unless you simulate it using cross-mounting with NFS or similar, which is way beyond the scope of this document), we need to separate the filesystem into groups according to which applications are going to be “grouped” together on the nodes when both nodes are up. For maximum flexibility in assigning nodes to applications, you might well want to have a DRBD share per application, assuming of course that no two applications need to access the same share.

    2. 別々のDRBD リソース(drbd0、drbd1…)必ずセットアップしてください。プライマリ、セカンダリの両方のノードでファイルシステムを共有することは、現在の DRBD では可能ではないので(あなたが NFS か似たようなものでクロスマウントを使用することでシミュレートしない限りは、このドキュメントの範囲内にあります。)、われわれは両方のノードがあがっているとき、アプリケーションはノード上で一緒にグルーピングされている、そのグループ内でファイルシステムを分ける必要があります。ノードをアプリケーションに割り当てることにおける最大の柔軟性のために、あなたはアプリケーションごとに DRBD 共有をしたいかもしれない、もちろん 二つのアプリケーションが同じ共有にアクセスする必要がないと仮定して。(???)

    3. If the DRBD devices are on the same disk spindle, use sync groups to ensure that DRBD sync happens at a reasonable speed

    4. もし同じディスクスピンドル上に DRBD デバイスがあるなら、DRBD がほどほどな速度で同期することが起こるのほ保証するために sync groups を使用してください

    5. Configure Heartbeat appropriately

    6. 適切に Heartbeat を設定してください

    Let’s run through these steps. We’ll assume by way of example that you want to run MySQL and Apache. You need one DRBD share for the MySQL data, and one for the Apache data. The nodes will be called ‘node1′ and ‘node2′. We decide to configure it as follows:

    これらのステップを実行しましょう。私たちは、あなたが MySQL と Apache を走らせたい例として考えるでしょう。あなたは MySQL のデータ、 Apache のデータのために DRBD 共有を必要とします。ノードは ‘node1′と’node2′ と呼ばれるでしょう。以下のように設定することに決めます。

    share DRBD resource DRBD device Physical device mountpoint
    Apache r0 /dev/drbd0 /dev/sda1 /ha/web
    MySQL r1 /dev/drbd1 /dev/sda2 /ha/mysql

    <!> /dev/drbdX have been /dev/nbX in drbd-0.6.x and older, see also DRBD/QuickStart07

    /dev/drbdX は drbd-0.6.x とそれ以前のバージョンでは /dev/nbX でした、DRBD/QuickStart07 も見てください

    Let’s assume, to complicate things, that you have a limited number of physical disks and therefore are forced to have drbd0 and drbd1 on the same spindle (i.e. same hard disk) as shown in the table above (both resources are on /dev/sda in this case). This isn’t ideal, but is OK thanks to the ’sync-groups’ option. This governs the order in which DRBD resources synchronise (normally, they would sync in parallel, which is going to kill performance if you have got two resources on one disk as the drive would be constantly seeking backwards and forwards reading/writing from/to the two resources). So we use sync-groups to make one resource sync first. It doesn’t really matter which goes first. Here’s a snippet of a possible drbd.conf. NOTE Only the relevant options are shown here for clarity; you need all your usual options such as disk-size, sync-max etc. in there too:

    複雑にするために、あなたは、限られた数の物理ディスクを持っていて、したがって、同じスピンドル(つまり同じハードディスク)上に、上の表に示されているように(両方のリソースはこの場合は /dev/sda 上にあります) drbd0 と drbd1 があると仮定します。これは理想的でありませんが、’sync-groups’ オプションのおかげで OK です。これは DRBD リソースの同期の順番を支配します(通常、それらは平行に同期するでしょう、1つのディスクで(ドライブが絶えず後方をシークして、前方は2つのリソースを reading/writing from/to しているような)2つのリソースを使うと、パフォーマンスを殺すことになります)。なのでわれわれは一つのリソースを最初に同期させるために sync-groups を使用します。どれが最初に同期するかは重要ではありません。ここに あり得る drbd.conf の一部があります。関連オプションがここに明快に示されますので注意してください;また、あなたはそこで、disk-size、sync-max などのような通常のオプションが必要です。

    <!> Syntax was different with drbd-0.6
    Just adopting the well commented example drbd.conf to your needs should be easy, though.

    構文は drbd-0.6 とは異なっていました
    分かりやすくするために、drbd.conf の例にコメントをつけています。

    # Our web share
    resource web {
    protocol C;
    incon-degr-cmd "echo '!DRBD! pri on incon-degr' | wall ; sleep 60 ; halt -f";
    startup { wfc-timeout 0; degr-wfc-timeout     120; }
    disk { on-io-error detach; } # or panic, ...
    syncer {
    group 0;
    rate 6M;
    }
    on node1 {
    device /dev/drbd0;
    disk /dev/sda1;
    address 192.168.99.1:7788;
    meta-disk /dev/sdb1[0];
    }
    on node2 {
    device /dev/drbd0;
    disk /dev/sda1;
    address 192.168.99.2:7788;
    meta-disk /dev/sdb1[0];
    }
    }
    # Our MySQL share
    resource db {
    protocol C;
    incon-degr-cmd "echo '!DRBD! pri on incon-degr' | wall ; sleep 60 ; halt -f";
    startup { wfc-timeout 0; degr-wfc-timeout     120; }
    disk { on-io-error detach; } # or panic, ...
    syncer {
    group 1;
    rate 6M;
    }
    on node1 {
    device /dev/drbd1;
    disk /dev/sda2;
    address 192.168.99.1:7789;
    meta-disk /dev/sdb1[1];
    }
    on node2 {
    device /dev/drbd1;
    disk /dev/sda2;
    address 192.168.99.2:7789;
    meta-disk /dev/sdb1[1];
    }
    }
    

    In the above example, drbd0 will sync first and drbd1 second.

    上記の例では、drbd0 は最初に同期して drbd1 は次に同期するでしょう。

    Now, for the heartbeat config. The resources section in haresources is going to look something like this: (you’re probably going to need other resources too, like for example IP addresses; this is a simple example)

    heartbeat 設定。haresources の リソースセクションはこのように見えます:(あなたは多分、IP アドレスのような他のリソースも必要とするでしょう;これは簡単な例です)

    node1 drbddisk::web Filesystem::/dev/drbd0::/ha/web::ext3 httpd
    node2 drbddisk::db Filesystem::/dev/drbd1::/ha/mysql::ext3 mysqld
    

    Note how node1 will “normally” run Apache using the drbd0 resource, and node2 will “normally” run MySQL with the drbd1 resource. If failover occurs, obviously one node will run both, and become DRBD primary for both resources (and have both shares mounted).

    ノード1が drbd0 リソースを使って「普通に」稼動する方法と、ノード2が drbd2 リソースを使って稼動する方法について注意してください。フェイルオーバが起こったら、明らかに、一つのノードで両方稼動します、そして両方のリソース(マウントされた両方の共有を持つ)のために DRBD はプライマリになります。

    Keeping config files in sync


    同期でコンフィグファイルを保つ

    An obvious question you might ask is “how do I keep config files in sync, e.g. for Apache”. The simple answer is that you should probably look at using rsync, scp or some other similar method to keep your configs in sync.

    “例えば Apache でどうやって同期でコンフィグファイルを保つのか” とたずねるかもしれない、明らかな疑問。簡単な答えは、rsync、scp や他の似たような方法を、コンフィグファイルを同期する方法として検討するべきと考えるでしょう。

    (!) If you have many config files (or “cluster files”) to keep in sync over arbitrary many hosts, have a look at csync2 by LinBit.

    あなたがもしたくさんのホストで同期を保つたくさんのコンフィグファイル(もしくは cluster files)があれば、LinBit で csync2 を見てください。

    2007年 9月 16日 | Posted in Linux
    タグ:
    コメントは終了しています。