第4章 グローバル Data Grid クラスターの監視およびトラブルシューティング

Data Grid は、JMX または Data Grid Server の /metrics エンドポイント経由で、クロスサイトレプリケーション操作の統計を提供します。

クロスサイトレプリケーションの統計はキャッシュレベルで利用できるため、キャッシュの統計を明示的に有効にする必要があります。同様に、JMX を介して統計を収集する場合は、Data Grid を設定して MBean を登録する必要があります。

Data Grid には org.infinispan.XSITE ロギングカテゴリーも含まれるため、ネットワークおよび状態遷移操作に関する一般的な問題を監視し、トラブルシューティングすることができます。

4.1. Data Grid 統計の有効化

Cache Manager およびキャッシュの統計をエクスポートするように Data Grid を設定します。

手順

以下のいずれかの方法で、Data Grid 統計が有効化されるように設定を変更します。

  • 宣言型: statistics="true" 属性を追加します。
  • プログラマティック: .statistics() メソッドを呼び出します。

宣言型

<!-- Enables statistics for the Cache Manager. -->
<cache-container statistics="true">
  <!-- Enables statistics for the named cache. -->
  <local-cache name="mycache" statistics="true"/>
</cache-container>

プログラマティック

GlobalConfiguration globalConfig = new GlobalConfigurationBuilder()
  //Enables statistics for the Cache Manager.
  .cacheContainer().statistics(true)
  .build();

Configuration config = new ConfigurationBuilder()
  //Enables statistics for the named cache.
  .statistics().enable()
  .build();