高可用性デプロイの管理

このページでは、高可用性(HA)ペアとしてコントローラを管理およびトラブルシューティングする方法について説明します。

Set Up Monitoring for the HA Pair

You can set up monitoring for your HA pair by installing another Controller to act as the monitoring Controller.

  1. If you do not already have an HA pair, set one up.
  2. Install the monitoring Controller on the Enterprise Console host in a new platform by selecting Custom Install:
    1. Create a platform (such as, Controller Monitor Platform).
      警告: This platform should not be used for installing any other services.
    2. Install a Controller.
    3. Make sure to deselect the Install Events Service option before clicking Install.
  3. Complete the monitoring setup by installing and configuring the App Agents and Machine Agents on your HA pair:

モニタリング用のアプリケーションエージェントの設定

アプリケーション エージェントは、Enterprise Console によってコントローラホストに自動的にインストールされます。HA ペアの両方のコントローラに設定することで、モニタリングコントローラに報告できます。これは、HA ペアプラットフォームの JVM オプションを更新することで実行できます。Enterprise Console を使用してアプリケーション エージェントを設定するには、次の手順を実行します。
  1. 次のコマンドを実行してプライマリ コントローラ ボックスに SSH で接続し、プライマリ コントローラ アプリケーション エージェントの controller-info.xml を更新します。
    cd <controller-install-dir>/appserver/jetty/appagent
    cp conf/controller-info.xml ver<version#>/conf/
  2. セカンダリコントローラでも手順 1 を実行します。
  3. Enterprise Console UI で HA ペアのプラットフォームを選択し、[Configurations > Controller Settings] > [Appserver Configurations] の順に選択して [JVM Options] セクションに移動します。
  4. 次の手順に従ってJVMのオプションを更新します。
    1. appdynamics.controller.hostName をモニタリングコントローラの IP に更新します。
    2. モニタリングに必要な以下の jvm-optionsjvm config ブロックに追加します。
      -Dappdynamics.agent.applicationName=<app_name>, -Dappdynamics.agent.tierName=<tier_name>,
      -Dappdynamics.agent.nodeName=<node_name>, -Dappdynamics.agent.accountName=<account_name>,
      -Dappdynamics.agent.accountAccessKey=<access_key>
      注: コントローラ UI からアクセスキーを取得するには、[Settings] > [License] > [Account] に移動します。コントローラにログインするときには、appdynamics.agent.accountName で指定されたアカウントを使用します。
  5. [Save] をクリックします。ジョブに指定したプロパティが適用され、プライマリコントローラとセカンダリコントローラが再起動されます。
  6. Enterprise Console UIでコントローラ監視プラットフォームを選択し、Controllerページに移動します。
  7. ウィジェットの [External URL] をクリックして、モニタリングコントローラの UI を開きます。
  8. コントローラにログインします。プライマリコントローラとセカンダリコントローラ両方のモニタリングアプリケーションが表示されれば成功です。

Install and Set Up Machine Agents for Monitoring

You must install Machine Agents on both Controllers of an HA pair to report to the monitoring Controller. These agents are Java programs that collect hardware metrics. To install and set up your machine agents, perform the following steps:
  1. Install the Machine Agent on the primary Controller box. Do not start the agent.
  2. Repeat step 1 for the secondary Controller.
  3. Configure the Machine Agent properties for both Machine Agents by editing the controller-info-xml file located in the <machine_agent_home>/conf directory.
    1. Update the <controller-host> to the monitoring Controller's IP.
    2. Model the rest of your controller-info-xml file.
  4. Start both Machine Agents.
  5. In the Enterprise Console UI, select your Controller Monitor Platform, and navigate to the Controller page.
  6. Click on External URL on the widget to open the UI of the monitoring Controller.
  7. Log in to the Controller. You should be able to see the monitoring application for both the primary and secondary Controllers.

フェイルオーバーのトリガーなしでのプライマリコントローラのバウンス

Enterprise Consoleでは、フェイルオーバーを開始せずにプライマリコントローラを停止および起動することはできません。これを回避するには、次の手順を実行する必要があります。

  1. Enterprise Console にログインし、[Configurations]、[Controller Settings] の順に選択して [Appserver Configurations] ページに移動します。
  2. [Enable Auto Failover] を選択解除して、[Save] をクリックします。
  3. コントローラがインストールされているコントローラマシンにSSHで接続します。
  4. Enterprise Console ホストで、以下のコマンドを実行します。これにより、プライマリコントローラが HA モードで再起動されます。
    bin/platform-admin.sh stop-controller-appserver
    bin/platform-admin.sh start-controller-appserver
  5. Enterprise Console Appserver Configurations ページで、自動フェールオーバーを再有効化します。

コントローラの起動と停止

Enterprise Consoleでは、プライマリコントローラをシャットダウンできません。ただし、コントローラの起動および停止コマンドを使用してセカンダリコントローラを再起動することはできます。

コントローラを手動で起動または停止するには、以下のコマンドを使用します。

  • 開始するには:

    bin/platform-admin.sh start-controller-appserver --with-db
  • 停止するには:

    bin/platform-admin.sh stop-controller-appserver --with-db

自動フェールオーバー

Enterprise Console には、コントローラウォッチドッグを自動フェールオーバーに使用するウォッチドッグハイ アベイラビリティ(HA)モジュール が含まれています。自動フェールオーバーを有効または無効化するには、watchdog スクリプトをそれぞれ実行または停止する必要があります。

自動フェイルオーバーの有効/無効は CLI で切り替えることもできます。

CLI でコントローラウォッチドッグを無効または有効にするには、次のコマンドを使用します。

  • コントローラウォッチドッグを停止する場合:
./platform-admin.sh submit-job --job stop-controller-watchdog --service controller
  • コントローラウォッチドッグを開始するには、次の手順を実行します。
./platform-admin.sh submit-job --job start-controller-watchdog --service controller

手動フェイルオーバーとフェイルバックの実行

プライマリからセカンダリへ手動でフェールオーバーするには、Enterprise Console の [Controller] ページの [HA Failover] オプションをクリックするか、または Enterprise Console ホストで次のコマンドを実行します。

bin/platform-admin.sh submit-job --service controller --job ha-failover --platform-name <name_of_the_platform>

これにより、セカンダリのアプリサーバーがプライマリになり、セカンダリのデータベースが複製マスターになります。また、それまでのプライマリがセカンダリに変更されます。

古いプライマリへのフェイルバックを実行するプロセスは、セカンダリへのフェイルオーバーと同じです。Enterprise Console ホストで次のコマンドを実行できます。

bin/platform-admin.sh submit-job --service controller --job ha-failover --platform-name <name_of_the_platform>
注: データベースが 7 日以上ダウンしていた場合は、以下のセクションに従ってデータベースを復旧する必要があります。

コントローラデータベース増分複製の開始

中断していた複製の再有効化

セカンダリコントローラにあるデータベース複製とプライマリコントローラの開きが3日以上ある場合、増分複製(プライマリデータベース稼働中のrsyncによる複製)を行う必要があります。この複製では、プライマリコントローラを稼働させたまま、ディスクの中身をセカンダリノードにコピーすることができます。

増分複製を開始するには:

  1. Enterprise Console ホストで次のコマンドを実行します。これにより、継続的に実行されるバックグラウンドジョブが開始します。
    bin/platform-admin.sh submit-job --service controller --job incremental-replication
    これによりバックグラウンドジョブが開始され、継続実行されます。
  2. 次のいずれかのコマンドを実行して、複製が 4 回以上行われるようにします。

    1. CODE
      cd <controller_home>/controller-ha
      ./ha_replicate.sh -r status
    2. CODE
      cd <controller_home>/controller-ha/tmp
      cat replication.status
    注: 複製に失敗した場合は、セカンダリホストで rsync プロセスと ha-replicate.sh プロセスをすべて停止してください。その後、もう一度増分複製ジョブを実行してください。
  3. Enterprise Console ホストで次のコマンドを実行し、ジョブを完了します。これにより、増分複製ループが停止します。このコマンドによってプライマリコントローラが再起動され、ダウンタイムが発生します。
    bin/platform-admin.sh submit-job --service controller --job finalize-replication
    これにより、増分複製のループが停止します。このコマンドによってプライマリコントローラが再起動され、ダウンタイムが発生します。
  4. プライマリコントローラとセカンダリコントローラ間に大きなギャップがないことをチェックして、複製が行われていることを確認します。Enterprise Console ホストで次のコマンドを実行することで、複製のステータスを確認できます。セカンダリのステータスが表示されるまで数分かかることがあります。
    bin/platform-admin.sh show-service-status --platform-name <platform_name> --service controller
    セカンダリのステータスを表示するまで数分かかることがあります。

増分複製によるセカンダリコントローラの追加

1つのコントローラに大量のデータがある場合、増分複製によりHAペアに変換することができます。これにより、セカンダリコントローラの追加にかかるダウンタイムを抑え、コントローラを実行したままそのデータの大部分について rsync を実行することができます。

増分複製を使用してセカンダリコントローラを追加するには:

  1. ホストおよびrsyncのパラメータを指定して、増分複製を開始します。
    bin/platform-admin.sh submit-job --service controller --job incremental-replication --args controllerSecondaryHost=1.1.1.1 rsyncThrottle=40000 rsyncCompress=true
    これによりバックグラウンドジョブが開始され、継続実行されます。
  2. プライマリデータベース ホストにある <controller_home>/controller-ha/tmp/replication.status をチェックして、複製が 4 回以上行われていることを確認します。rsync ステータスファイルのサンプル出力を次に示します。
    rsync started at Mon Mar  5 11:49:56 PST 2018
    rsync completed at Mon Mar  5 11:50:56 PST 2018
    rsync started at Mon Mar  5 11:51:01 PST 2018
    rsync completed at Mon Mar  5 11:51:11 PST 2018
    注: 複製に失敗した場合は、セカンダリホストで rsync プロセスと ha-replicate.sh プロセスをすべて停止してください。その後、もう一度増分複製ジョブを実行してください。
  3. セカンダリ追加ジョブを実行します。Enterprise Console で最終 rsync が実行され、セカンダリジョブが追加されます。
    bin/platform-admin.sh submit-job --service controller --job add-secondary --args controllerSecondaryHost=secondary mysqlRootPassword=‘password'
    このコマンドによってプライマリコントローラが再起動され、ダウンタイムが発生します。
    注: add-secondaryコマンドをトリガーするまで、セカンダリコントローラはEnterprise Consoleプラットフォームに追加されません。このため、Enterprise Consoleで、セカンダリコントローラに対してオペレーションを実行することはできません。

複製を停止する場合は、次のコマンドを実行します。

bin/platform-admin.sh submit-job --service controller --job stop-incremental-replication

Rsync スレッドのレプリケーションファクタの設定

Enterprise Console UI または CLI を使用して、増分または確定の複製を実行するときの並列 rsync スレッドの数をジョブパラメータとして設定できます。

  • Enterprise Console UI で、次の手順を実行します。
    1. Enterprise Console にログインし、[Controller] ページにアクセスします。

    2. [More] メニューから、実行している複製の種類に基づいて、[Incremental Replication] または [Finalize Replication] のいずれかを選択します。複製の増分または確定

    3. [Number of parallel rsync threads ] フィールドに数値を入力し、[Submit] をクリックします。デフォルト値は 1 です。並列 rsync スレッドの数

  • CLI で、実行している複製の種類に基づいて、Enterprise Console ホストから次のいずれかのコマンドを実行し、numberThreadForRsync 引数を設定します。

    CODE
    bin/platform-admin.sh submit-job --job incremental-replication --args numberThreadForRsync=<number> bin/platform-admin.sh submit-job --job finalize-replication --args numberThreadForRsync=<number>

MySQL パラレル複製の有効化

Enterprise Console UI または CLI を使用して、確定複製を実行するときに MySQL(MySQL 5.7 以降で使用可能)パラレル複製を有効にできます。

  • Enterprise Console UI で、次の手順を実行します。
    1. Enterprise Console にログインし、[Controller] ページにアクセスします。

    2. More メニューから、Finalize Replication を選択します。複製の確定

    3. [Database parallel replication] チェックボックスをオンにして、MySQL データベースとのパラレル複製を有効にします。データベースパラレル複製のチェックボックス

    4. [Submit] をクリックします。

  • CLI で、Enterprise Console ホストから次のコマンドを実行して MySQL パラレル複製を有効にします。デフォルト値は true です。

    CODE
    bin/platform-admin.sh submit-job --job finalize-replication --args dbParallelReplication=true

増分複製のステータスのトラブルシューティング

最初の増分複製の実行に通常より時間がかかる場合は、次のいずれかのコマンドを実行して、複製のステータスを確認できます。

  • CODE
    cd <controller_home>/controller-ha
    ./ha_replicate.sh -r status
  • CODE
    cd <controller_home>/controller-ha/tmp
    cat replication.status

コントローラデータベース複製の再有効化

コントローラデータベースが 7 日間以上同期されていない場合、複製スクリプトを使用して同期することができます。マスターより 7 日間以上遅れたデータベースを同期させることは、コントローラデータベースの復旧と見なされます。データベースを復旧させるには、新規のセカンダリコントローラを既存の本番コントローラに追加する場合と同じ手順が必要です(「セカンダリコントローラの設定と複製の開始」を参照)。複製に失敗した HA のフェールオーバーで、この手順を実行することもできます。

複製を再度有効化(コントローラデータベースを復旧)するには:

  1. [Controller] ページで [Remove Controller] をクリックするか、Enterprise Console ホストで次のコマンドを実行します。
    bin/platform-admin.sh submit-job --job remove --service controller
  2. データベースルート認証情報を入力します。
  3. [Remove Binaries] をオンにするか、Enterprise Console ホストで次のコマンドを実行します。
    bin/platform-admin.sh submit-job --job remove --service controller --args removeBinaries=true
  4. [Remove Controller Cluster] をオフにします。すでにチェックマークが外れている場合は、セカンダリサーバーを削除します。
  5. [Submit] をクリックします。
  6. このコマンドによってプライマリコントローラが再起動され、ダウンタイムが発生します。[Controller] ページからセカンダリコントローラを追加するか、Enterprise Console ホストで次のコマンドを実行します。
    bin/platform-admin.sh submit-job --service controller --job add-secondary --args controllerSecondaryHost=secondary mysqlRootPassword=‘password'
Enterprise Consoleにセカンダリコントローラがオンボードされ、複製が再び有効化されます。

HA ペアのコントローラデータのバックアップと復元

HA 展開では、セカンダリコントローラがプライマリ コントローラ サービスを中断することなくコールドバックアップを実行できる完全な本番データを提供するため、コントローラデータのバックアップが比較的簡単になります。

HA を設定した後、バックアップを実行するために、Enterprise Console でコントローラを停止し、Splunk AppDynamics ホームディレクトリのファイルレベルコピー(コールドバックアップなど)を実行します。完了したら、Enterprise Console からコントローラを再起動するだけです。セカンダリはその後プライマリのデータに同期化します。

HA 環境またはスタンドアロン環境でバックアップからデータベースを復元する場合、プライマリサーバー ha.type が active に、セカンダリサーバー ha.mode が passive に設定されていることを確認する必要があります。

Updating the Configuration in an HA Pair

The Enterprise Console will copy any file-level configuration customizations made on the primary controller to the secondary controller, such as changes in the Jetty XML files and db.cnf

Over time, if you need to make modifications to the Controller configuration, always do those changes in the Enterprise Console on the Controller Settings page under Configurations. These changes will be preserved during upgrades. Any changes made outside the Enterprise Console will not be preserved after upgrade.

Troubleshooting HA

Controller Diagnostic Data

The Enterprise Console writes log messages pertaining to HA to the platform-admin-server.log on the Enterprise Console host.

To diagnose the Controller, run the following command:

bin/platform-admin.sh submit-job --platform-name <name_of_the_platform> --job diagnosis --service controller

Refer to the Controller diagnostic data in the platform-admin-server.log.

Sample Controller diagnostic data

Linux

Controller diagnostic data:
123.45.0.1:
controller_database: running
controller_appserver: running
reports_service: running
operating_system: Linux
controller_version: 004-004-001-000
controller_performance_profile: small
controller_ha_type: primary
controller_appserver_mode: active
controller_metric_data_per_min: N/A
slave_io_state: Waiting for master to send event
seconds_behind_master: 0
master_server_id: 567.
master_host: controller-secondary
master_ssl_allowed: No
123.45.0.2:
controller_database: running
controller_appserver: not running
reports_service: running
operating_system: Linux
controller_version: 004-004-001-000
controller_performance_profile: small
controller_ha_type: secondary
controller_appserver_mode: passive

Invalid HA Controller Roles

If your HA Controller roles in the Controller databases are incorrect, the Enterprise Console will prevent discover and upgrade jobs. An invalid HA Controller state is when both of your Controller role types are identical, such as in a primary/primary or secondary/secondary case.

To fix this issue:

  1. Identify which server is the primary.
    1. Log in to one of the Controller databases by running the following command in the Controller installation directory:

      bin/controller.sh login-db
    2. Run the following command:

      select * from global_configuration_local where name=‘ha.controller.type’;
  2. Ensure that ha.controller.type is set correctly in the database.
    1. Log in to the Controller database you would like to change by running the following command in the Controller installation directory:

      bin/controller.sh login-db
    2. Run the following commands to set the database to the primary or secondary:
      Primary
      CODE
      use controller;
      update global_configuration_local set value=‘primary’ where name=‘ha.controller.type’;
      update global_configuration_local set value=‘active’ where name=‘appserver.mode’;
      Secondary
      CODE
      use controller:
      update global_configuration_local set value=‘secondary’ where name=‘ha.controller.type’;
      update global_configuration_local set value=‘passive’ where name=‘appserver.mode’;
  3. Restart the database for the change to take effect on the Appserver:

    bin/platform-admin.sh stop-controller-appserver --with-db
    bin/platform-admin.sh start-controller-appserver --with-db

    If the secondary Appserver is already in a shutdown state, then there is no need to restart the database.

  4. Verify the replication is healthy:

    show slave status\G

    Slave_IO_Running and Slave_SQL_Running should show Yes.

You may now retry the discover and upgrade job.

Failover Prevention

If failover is prevented on your Controller HA configuration, it may be due to one of two scenarios:

  • The secondary database is down. Failover cannot occur when the secondary database is not running.To fix this issue, restart the secondary database by running the following command on the secondary host:
    bin/controller.sh start-db
    If this does not enable failover, then it may be due to the second scenario.
  • Database replication is not healthy. Failover is not allowed when the database replication is not healthy.There are various reasons why this may be the case. Contact customer support to correct the issue.