高可用性デプロイの管理
このページでは、高可用性(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.
モニタリング用のアプリケーションエージェントの設定
Install and Set Up Machine Agents for Monitoring
- Install the Machine Agent on the primary Controller box. Do not start the agent.
- Repeat step 1 for the secondary Controller.
- Configure the Machine Agent properties for both Machine Agents by editing the
controller-info-xmlfile located in the<machine_agent_home>/confdirectory.- Update the
<controller-host>to the monitoring Controller's IP. - Model the rest of your
controller-info-xmlfile.
- Update the
- Start both Machine Agents.
- In the Enterprise Console UI, select your Controller Monitor Platform, and navigate to the Controller page.
- Click on External URL on the widget to open the UI of the monitoring Controller.
- Log in to the Controller. You should be able to see the monitoring application for both the primary and secondary Controllers.
フェイルオーバーのトリガーなしでのプライマリコントローラのバウンス
Enterprise Consoleでは、フェイルオーバーを開始せずにプライマリコントローラを停止および起動することはできません。これを回避するには、次の手順を実行する必要があります。
コントローラの起動と停止
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>
コントローラデータベース増分複製の開始
中断していた複製の再有効化
セカンダリコントローラにあるデータベース複製とプライマリコントローラの開きが3日以上ある場合、増分複製(プライマリデータベース稼働中のrsyncによる複製)を行う必要があります。この複製では、プライマリコントローラを稼働させたまま、ディスクの中身をセカンダリノードにコピーすることができます。
増分複製を開始するには:
-
Enterprise Console ホストで次のコマンドを実行します。これにより、継続的に実行されるバックグラウンドジョブが開始します。これによりバックグラウンドジョブが開始され、継続実行されます。
bin/platform-admin.sh submit-job --service controller --job incremental-replication
-
次のいずれかのコマンドを実行して、複製が 4 回以上行われるようにします。
-
CODE
cd <controller_home>/controller-ha ./ha_replicate.sh -r status -
CODE
cd <controller_home>/controller-ha/tmp cat replication.status
注: 複製に失敗した場合は、セカンダリホストで rsync プロセスとha-replicate.shプロセスをすべて停止してください。その後、もう一度増分複製ジョブを実行してください。 -
-
Enterprise Console ホストで次のコマンドを実行し、ジョブを完了します。これにより、増分複製ループが停止します。このコマンドによってプライマリコントローラが再起動され、ダウンタイムが発生します。これにより、増分複製のループが停止します。このコマンドによってプライマリコントローラが再起動され、ダウンタイムが発生します。
bin/platform-admin.sh submit-job --service controller --job finalize-replication
-
プライマリコントローラとセカンダリコントローラ間に大きなギャップがないことをチェックして、複製が行われていることを確認します。Enterprise Console ホストで次のコマンドを実行することで、複製のステータスを確認できます。セカンダリのステータスが表示されるまで数分かかることがあります。セカンダリのステータスを表示するまで数分かかることがあります。
bin/platform-admin.sh show-service-status --platform-name <platform_name> --service controller
増分複製によるセカンダリコントローラの追加
1つのコントローラに大量のデータがある場合、増分複製によりHAペアに変換することができます。これにより、セカンダリコントローラの追加にかかるダウンタイムを抑え、コントローラを実行したままそのデータの大部分について rsync を実行することができます。
増分複製を使用してセカンダリコントローラを追加するには:
-
ホストおよびrsyncのパラメータを指定して、増分複製を開始します。これによりバックグラウンドジョブが開始され、継続実行されます。
bin/platform-admin.sh submit-job --service controller --job incremental-replication --args controllerSecondaryHost=1.1.1.1 rsyncThrottle=40000 rsyncCompress=true
-
プライマリデータベース ホストにある
<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プロセスをすべて停止してください。その後、もう一度増分複製ジョブを実行してください。 -
セカンダリ追加ジョブを実行します。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 で、次の手順を実行します。
-
Enterprise Console にログインし、[Controller] ページにアクセスします。
-
[More] メニューから、実行している複製の種類に基づいて、[Incremental Replication] または [Finalize Replication] のいずれかを選択します。
-
[Number of parallel rsync threads ] フィールドに数値を入力し、[Submit] をクリックします。デフォルト値は 1 です。
-
-
CLI で、実行している複製の種類に基づいて、Enterprise Console ホストから次のいずれかのコマンドを実行し、
numberThreadForRsync引数を設定します。CODEbin/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 で、次の手順を実行します。
-
Enterprise Console にログインし、[Controller] ページにアクセスします。
-
More メニューから、Finalize Replication を選択します。
-
[Database parallel replication] チェックボックスをオンにして、MySQL データベースとのパラレル複製を有効にします。
-
[Submit] をクリックします。
-
-
CLI で、Enterprise Console ホストから次のコマンドを実行して MySQL パラレル複製を有効にします。デフォルト値は true です。
CODEbin/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 のフェールオーバーで、この手順を実行することもできます。
複製を再度有効化(コントローラデータベースを復旧)するには:
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:
- Identify which server is the primary.
-
Log in to one of the Controller databases by running the following command in the Controller installation directory:
bin/controller.sh login-db
-
Run the following command:
select * from global_configuration_local where name=‘ha.controller.type’;
-
- Ensure that
ha.controller.typeis set correctly in the database.-
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
-
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’;
-
-
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.
-
Verify the replication is healthy:
show slave status\G
Slave_IO_RunningandSlave_SQL_Runningshould showYes.
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:
If this does not enable failover, then it may be due to the second scenario.
bin/controller.sh start-db
- 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.