XRegionサービスの起動

各リージョンのXregionサービスは、xrstartコマンドを使用して開始できます。xrstartコマンドは、データ・ストアごとに個別に実行する必要があります。xrstartコマンド実行のステータスは、正常に起動されたエージェントのプロセスIDを含むstatus.<number of agents>.<agentId>.txtファイルの内容を読み取ることで表示できます。xrstartコマンドと各種パラメータの詳細は、「xrstart」を参照してください。

コマンドxrstartは、次の2つの方法で使用できます。
  • フォアグラウンドでXregionサービスを起動するコマンドは次のとおりです。
    java -Xms1G -Xmx1G -jar <path to jar file> xrstart -config <path to config file>
  • バックグラウンドでXregionサービスを起動するコマンドは次のとおりです。
    java -Xms1G -Xmx1G -jar <path to jar file> xrstart -config <path to config file> -bg

次に例を示します。

フランクフルトとロンドンの両リージョンでXRegionサービスを起動します。

XRegionサービス・エージェントは、フランクフルトとロンドンの両方のリージョンにあります。フランクフルトでは、XRegionエージェントはhost1およびhost7にあり、ロンドンでは、XRegionエージェントはhost4およびhost8にあります。両方のXRegionエージェントを各リージョンで起動する必要があります。

# Start the first XRegion Service in host1 in the 'fra' Region
[oracle@host1 xrshome]$ java -Xms256m -Xmx2048m -jar $KVHOME/lib/kvstore.jar xrstart \
-config <path to the json config file> -bg

[1] 24356

# View the status of the xrstart command in host1 in the 'fra' Region
[oracle@host1 xrshome]$ cat status.<number of agents>.<agentId>.txt
Cross-region agent (region=fra,store=mrtstore, helpers=[host1:5000, host2:5000, host3:5000]) 
starts up from config file=/home/oracle/xrshome/ json.config at 2024-04-05 08:57:34 UTC
同様に、host7でXRegionエージェントを起動します。
# Start the second XRegion Service in host 7 in the 'fra' Region

[oracle@host7 xrshome]$ java -Xms256m -Xmx2048m -jar $KVHOME/lib/kvstore.jar xrstart \
-config <path to the json config file> -bg

[1] 24489

 # View the status of the xrstart command in host7 in the 'fra' Region
[oracle@host7 xrshome]$ cat status.<number of agents>.<agentId>.txt
Cross-region agent (region=fra,store=mrtstore, helpers=[host1:5000, host2:5000, host3:5000]) 
starts up from config file=/home/oracle/xrshome/ json.config at 2024-04-05 08:59:34 UTC
# Start the first XRegion Service in host4 in the 'lnd' Region
[oracle@host4 xrshome]$ java -Xms256m -Xmx2048m -jar $KVHOME/lib/kvstore.jar xrstart \ 
-config <path to the json config file> -bg 

[1] 17587

# View the status of the xrstart command in host4 in the 'lnd' Region
[oracle@host4 xrshome]$ cat status.<number of agents>.<agentId>.txt
Cross-region agent (region=lnd,store=mrtstore, helpers=[host4:5000, host5:5000, host6:5000]) 
starts up from config file=/home/oracle/xrshome/ json.config at 2024-04-05 08:57:34 UTC
同様に、host8でXRegionエージェントを起動します。
# Start the second XRegion Service in host8 in the 'lnd' Region

[oracle@host8 xrshome]$ java -Xms256m -Xmx2048m -jar $KVHOME/lib/kvstore.jar xrstart \ 
-config <path to the json config file> -bg 

[1] 17587

# View the status of the xrstart command in the 'lnd' Region
[oracle@host8 xrshome]$ cat status.<number of agents>.<agentId>.txt
Cross-region agent (region=lnd,store=mrtstore, helpers=[host4:5000, host5:5000, host6:5000]) 
starts up from config file=/home/oracle/xrshome/ json.config at 2024-04-05 09:09:34 UTC

XRegionエージェントのステータス

XRegionエージェントの現在のステータスを確認するには、コマンドxrstatusを使用します。このコマンドは、ステータスに関する情報と、エージェントが起動したか、すでに実行中であるか、または停止したかを示す終了コードを提供します(xrstatusを参照)

次のコマンドは、エージェントのステータスをチェックします。
java -Xms256m -Xmx2048m -jar $KVHOME/lib/kvstore.jar xrstatus -config <path to the json config file>
次のときにステータスを確認できます。
  • xrstartコマンドを使用してエージェントを起動した後。
  • エージェントがすでに実行中の場合に、接続に障害が発生していないかどうかを確認するため。
  • エージェントがxrstopコマンドを使用して停止した後。
終了コードの形式でエージェントのステータスを表示するには、次のコマンドを使用します。
echo $?
たとえば、エージェントを起動した後、エージェントのステータスを次のように確認します。
# Start the agent
bash-4.4$ java -Xms256m -Xmx2048m -jar ./lib/kvstore.jar xrstart -config <path to the jsonconfig file>

[1] 102148

# View the status of the agent
bash-4.4$ java -Xms256m -Xmx2048m -jar ./lib/kvstore.jar xrstatus -config <path to the json config file>
Agent running

# View the exit code
bash-4.4$ echo $?
0

xrstatusコマンドを実行するとエージェントのステータスが表示され、echo $?コマンドを使用するとエージェントのステータスに対応する終了コードが表示されます。さらに理解を深めるには表を参照してください。

終了コードと、および起動後、実行中、停止後のエージェントのステータスの説明を次に示します。
  1. エージェント起動後のエージェント・ステータス:
    終了コード 説明
    0 エージェントは正常に起動しました。
    1 エージェントの起動に失敗しました。
    2 エージェントはタイムアウトで起動できませんでした。つまり、正常に起動されましたが、プロセスIDを持つステータス・ファイルは生成されませんでした。
    3 エージェントは起動後にクラッシュしました。
    4 エージェントはすでに実行中であり、別のエージェントを起動できません。
  2. 実行中のエージェントのエージェント・ステータス:
    終了コード 説明
    0 エージェントは現在実行中です。
    1 エージェントは現在実行されていません。
    2 エージェントは数秒間実行された後にクラッシュしました。
  3. エージェント停止後のエージェント・ステータス:
    終了コード 説明
    0 エージェントは正常に停止しました。
    1 エージェントの停止に失敗しました。