Recovery Kit for MySQLでは、mysqld_multi を介して管理されるmysqldグループ機能を使用した my.cnf ファイルを使用できます。このMySQLの機能を使用すると、単一のmy.cnfファイル (通常 /etc に保存される) を介して、容易に複数のMySQLインスタンスを設定できるようになります。本キットはmysqldグループのフォーマットを利用しているmy.cnfファイルを検出し、管理者に対して保護対象とするmysqldグループの番号を選択することを要求します。管理者が選択できる選択リストは、my.cnfファイルで定義されているグループ番号から、すでに本キットにより保護されているグループ番号を差し引いたものから決定します。 

一般的には、mysqldグループ機能を使用して複数のMySQLインスタンスを設定および制御するほうが容易になります。SIOSは、アクティブ/アクティブもしくは複数インスタンスの設定時には、このアプローチを使用することを推奨します。

my.cnfファイル

mysqldグループ機能を使用する場合、以下が必須となります。

a. 単一のmy.cnfファイルが、データベースインスタンスのmysqldグループを定義するために使用される必要があります。

b. my.cnfファイルは共有ストレージ上に配置しないでください。

c. 各クラスターノードにmy.cnfファイルの完全なコピーが必要です( /etc/my.cnf が望ましい)。

d. my.cnfファイルに対して行ったすべての変更は、LifeKeperのすべてのクラスターノードに反映される必要があります。

Recovery Kitは、my.cnfファイルがmysqldグループを使用していることを検知するとmysqld_multi コマンドを使用します。これに基づいて、LifeKeeperの制御下に配置する前にmysqld_multiを使用してMySQLインスタンスをテストすることができます。  

以下は、mysqld_multiによって制御されている2つのデータベースインスタンスについてmysqldグループを使用した比較的複雑なmy.cnfファイルの解説です。mysqld_multiコマンド(およびRecovery Kit for MySQL)は、管理者にさまざまな設定を行うためのオプションを提供しています。下記の例、[mysqld1]では、さまざまなMySQLコマンドの大部分についてデフォルトのロケーションを使用する比較的単純なMySQLインスタンスを定義しています。その次の例、[mysqld55]では、より多くの変更を行っています。コメントは各セクションにおいてLifKeeperがどのようにMySQLと相互作用しているかについて説明しているので参考にしてください。

#The following client section defines which username/password combination will be used for
#LifeKeeper  connections. The username/password combination needs to be defined in each MySQL
# Database instance that will be described in this my.cnf file.
[client]
user     =  steeleye
password =  password
# This next section describes the default version of mysqld and mysqldadmin that mysqld_multi
# will use when processing mysqld_multi commands. The username/password combo defines the
# MySQL account that mysqld_multi will use when working with the database instances. This
# username and password combo needs to be defined in each MySQL Database instance that will be
# controlled by mysqld_multi. See how to set up the multi_admin account in the MySQL Reference
# Manual, by issuing "mysqld_multi --example".
[mysqld_multi]
mysqld     = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user       = multi_admin
password   = password
# The next section defines the first of two MySQL Database instances in this my.cnf file. Note
# that each section starts  with a [mysqldNN] where NN is the mysqld group number (or instance).
# Each group name must have a number. There are a  number of directives that the LifeKeeper MySQL
# Recovery Kit will be looking for in these sections.
[mysqld1]
datadir  = /s11/mysql-data5077       #Defines where the data files for the instance will live. For
                                     # LifeKeeper, this directory must be on LifeKeeper protected
                                     #   (shared or replicated) storage.
mysqld   = /usr/bin/mysqld_safe       # Defines specifically which mysqld command will be used for
                                      #   starting the instance. This one is using the
                                      #   default  mysqld_safe that came with the distribution.
socket=/s11/mysql-data5077/moe.socket # Defines the location of the socket for this instance.
                                      #   If the socket is not on LifeKeeper protected storage, it
                                      #   needs to be defined in exactly the same place on each
                                      #   node in the cluster and be owned by the "user" defined 
                                      #   below.
port     =  3307                      # Each instance needs its own, unique TCP/IP port.
pid-file = /var/run/mysqld/mysqld.pid # The pid-file can be on LifeKeeper protected or
                                     #   non-LifeKeeper protected storage.
log-error= /var/log/mysqld.log        # Location of the MySQL error log for this instance. Can be
                                     #   on LifeKeeper protected or non-LifeKeeper protected
                                     #   storage.
user     = mysql                      # The Linux user name that will run the MySQL processes.
#The next section defines the more complicated of the two MySQL instances. Instance "55" is not
#using the default MySQL that came with the Linux distribution as it is using the 5.5.12 version
#of MySQL that was installed from source. The binaries for this version were installed onto shared
#storage, and the binary directory is LifeKeeper protected.
[mysqld55]
datadir = /s11/mysql-data5512           # Same as above; this instance uses a different data
                                        #   directory, and  this directory is on LifeKeeper
                                        #   protected storage.
mysqld  =/s11/mysql5512/bin/mysqld_safe # For this instance, a different version of mysqld_safe
                                        #   is used; the  one that is included with 5.5.12.
socket=/s11/mysql-misc5512/larry.socket # This instance has the socket on LifeKeeper protected
                                        #   storage, but not  in the default location (datadir).
port     = 3308                         # This instance has a unique TCP/IP port as well.
pid-file = /var/run/mysqld/mysqld55.pid # This instance's pid-file is not on LifeKeeper protected
                                        #   storage.
log-error = /var/log/mysqld55.log       # This instance's log-error (error log) is not on
                                        #   LifeKeeper protected  storage.
log-bin   = /s11/mysql-log5512/larry    # The log-bin directive specifies where the binary
                                        #   transaction logs are  located for this instance.
                                        #   These logs must be on LifeKeeper  protected storage
                                        #   (the recovery kit will enforce this). By default,
                                        #   these logs are in the datadir.
user      = mysql                       # The Linux user name that will run the MySQL processes.
 

マルチインスタンス用 [mysqld<N>] の設定とシングルインスタンス用 [mysqld] の設定を併記する場合は、シングルインスタンス用の設定を最後に記載してください。

例:

[mysqld1]
(mysqld1の設定)

[mysqld2]
(mysqld2の設定)

[mysqld55]
(mysqld55の設定)

[mysqld]
(シングルインスタンス用mysqldの設定)

mysqld_multi コマンド

例としてmysqlコマンドを実行します。

# mysqld_multi start 1

my.cnfで[mysqld1]として定義したmysqldグループ1インスタンスを、依存するすべてのLifeKeeper保護リソースがLifeKeeperのいずれかのノードでIn Serviceであると仮定します。

以下のコマンドを実行します。

# mysqld_multi report 1

このインスタンスの状態がレポートされます(例:running (起動) または not running (停止))。このインスタンスが起動すると、LifeKeeperでのリソース作成が容易になります。

mysqld_multi形式のmy.cnfファイルの設定方法に関する情報については以下のコマンドを実行してください。

# mysqld_multi --example

フィードバック

お役に立ちましたか?

はい いいえ
お役に立ちましたか
理由をお聞かせください
フィードバックありがとうございました

このトピックへフィードバック

送信