A.3.2 OC4J の構成 の構成 の構成 の構成
A.3.2.2 独自のメトリック・コレクタの作成 独自のメトリック・コレクタの作成 独自のメトリック・コレクタの作成 独自のメトリック・コレクタの作成
インタフェースoracle.oc4j.api.MetricCollectorを実装すれば、mod_oc4jに独自のメトリック を送信することができます。メトリックは0~100の値であることが必要です。
メトリック・コレクタはすべて、インタフェースoracle.oc4j.api.MetricCollectorを 実装する必要があります。実際のメトリック・コレクタは、インスタンス化できるように、パ ラメータの指定されていないコンストラクタを必要とします。
この機能のスキーマ要素は、server.xmlに次のように定義されています。
<metric-collector classname="my.package.name.MyClassName">
<init-param>
<param-name>
mysetting </param-name>
<param-value>
12345 関連資料 関連資料 関連資料
関連資料: DMSメトリックの一覧は、『Oracle Application Serverパフォー マンス・ガイド』を参照してください。
メトリック・ベースのロード・バランシング
oracle.oc4j.api.MetricCollectorの実装後、メトリックをjarファイルにパッケージ し、次のコマンドを使用してserver.xmlのライブラリ・パスに追加します。
<library path="<path to>/mymetric.jar"/>
A.3.2.2.1 oracle.oc4j.api.MetricCollector 次に、oracle.oc4j.api.MetricCollectorインタ フェースを示します。
package oracle.oc4j.api;
import java.util.Map;
/**
* Defines an interface for gathering and obtaining a server-wide metric.
* The metric is used in iAS mode, by mod_oc4j, to load balance between * virtual oc4j instances.
* The metric value is relative, and should be between 0 and 100, both * inclusive.
* When configured for metric load balancing,
* Mod_oc4j will route preferably to an oc4j with the greater value.
* <p>Concrete instances of this class must have a public empty constructor in * order to be loaded and instantiated.
*/
public interface MetricCollector { /**
* Support for debugging: This is a property name to set to true in order * to display the metric that is sent from the server
*/
String OC4J_METRIC_DEBUG_PROPERTY = "oc4j.metric.debug";
/**
* Debugging flag that depends on @{link #OC4J_METRIC_DEBUG_PROPERTY}
*/
boolean DEBUG = Boolean.getBoolean( OC4J_METRIC_DEBUG_PROPERTY );
/**
* Initial metric to return when no measurement has been made (property key) */
String OC4J_INITIAL_METRIC_PROPERTY = "oc4j.metric.initial";
/**
* Initial metric to return when no measurement has been made.
* Default is 50 */
int INITIAL_METRIC = Integer.getInteger( OC4J_INITIAL_METRIC_PROPERTY, 50 ).intValue();
/**
* Enabled flag for the collector.
* @return true if the collector is collecting data */
boolean isEnabled();
/**
注意 注意 注意
注意: カスタム・メトリック・コレクタがスレッドを開始する場合、そのス レッドはデーモン・スレッドであることが必要です。デーモン・スレッドで ないと、サーバーを正常に停止できない可能性があります。
メトリック・ベースのロード・バランシング
/**
* The parameters the metric collector is configured with.
* This method will be called even when the set of parameters is null.
* @param params the key/value pairs the metric collector is configured with, * or <code>null</code> if none
*/
void setParameters( Map params );
/**
* @return a metric between 0 and 100, inclusive. 100 is better, 0 is worse */
int getMetric();
}
メトリック・ベースのロード・バランシング
B
構成ファイル 構成ファイル 構成ファイル 構成ファイル
この付録では、一般に使用されるOracle HTTP Server構成ファイルについて説明します。ファ イルには次のものがあります。
■ dms.conf
■ httpd.conf
■ iaspt.conf
■ mime.types
■ mod_oc4j.conf
■ mod_osso.conf
■ opmn.xml
■ oracle_apache.conf
■ php.ini
■ ssl.conf
dms.conf
B.1 dms.conf
OracleのDynamic Monitoring Service(DMS)を使用してサイト・コンポーネントのパフォー
マンスをモニターできます。
このファイルは次の場所にあります。
■ UNIXの場合: ORACLE_HOME/ohs/conf
■ Windowsの場合: ORACLE_HOME¥ohs¥conf
B.2 httpd.conf
これはサーバー構成ファイルであり、通常は、使用するユーザーIDとグループID、および他 のファイルの位置など、サーバーの実行方法に影響するディレクティブが含まれています。
サーバー構成ファイルはサーバーの起動に使用されるメイン・ファイルであるため、Oracle
HTTP Serverにはその位置を指定するディレクティブは含まれていません。位置は、サーバー
の起動時にコマンドラインで渡されます。
このファイルは次の場所にあります。
■ UNIXの場合: ORACLE_HOME/ohs/conf/httpd.conf
■ Windowsの場合: ORACLE_HOME¥ohs¥conf¥httpd.conf
単一の構成ファイルを管理する方が容易であるため、srm.confまたはaccess.confではな く、このファイルのみを使用する必要があります。
関連資料 関連資料 関連資料
関連資料: 『Oracle Application Serverパフォーマンス・ガイド』
注意注意
注意注意: /home/your_directory/orahomeにインストールしたOracle Application Serverが/private/your_directory/orahomeにリンクされ ている場合、インストール済のファイルには
/home/your_directory/orahomeと
/private/your_directory/orahomeのどちらからもアクセスできます。
インストール後、元のOracleホーム・パスを使用したdms.confファイルの エントリがhttpd.confファイルに作成されます。次に例を示します。
include /home/your_directory/orahome/Apache/Apache/conf/dms.conf
元のOracleホーム・パスを、リンク先のOracleホーム・パスに置き換えな
いでください。
iaspt.conf