XRegionサービスの構成

複数リージョンOracle NoSQL DatabaseでXRegionサービスを構成する方法について学習します

MR表を作成する前に、XRegionサービスをデプロイする必要があります。簡単に言うと、これはエージェントとも呼ばれます。XRegionサービスはローカル・データ・ストアと独立して実行されるため、ローカル・データ・ストアの近くにデプロイすることをお薦めします。エージェントおよびエージェント・グループの詳細は、概要マニュアルリージョン間サービスを参照してください。
エージェントのホスト・ノードのCPUとメモリー、およびアプリケーションのレイテンシとスループットの要件に基づいて、複数のXRegionサービス・エージェントにシャードを分割することで、水平方向のスケーラビリティを実現できます。データ・ストア・シャードのXRegionサービス・エージェントへのマッピングは、エージェントの負荷を分散するためにラウンドロビン方式で決定されます。

ノート:

各XRegionサービス・エージェントは、少なくとも1つのシャードにマップされます。ユーザーがシャード数より多くのエージェントを構成した場合は、XRegionサービス・エージェントを起動できません。

各XRegionサービス・グループは、独立したXRegionサービス・エージェントのグループで構成され、グループ内の各エージェントはホスト・ノードで実行され、データ・ストアの1つ以上のシャードを処理します。XRegionサービス・グループのエージェントは、相互に完全に独立しています。つまり、各エージェントはグループ内の他のエージェントと直接対話しません。どのエージェントも、他のエージェントに影響を与えずに停止および再起動できます。XRegionサービス・エージェントは、構成されたストレージ・ノードを含まない別個のホストに追加することをお薦めします。

ステップ:

XRegionサービスを構成するには、各リージョンで次のタスクを実行します。

  1. XRegionサービスのホーム・ディレクトリを作成します。
  2. ステップ1で作成したホーム・ディレクトリにJSON構成ファイルを作成します。json.configファイルの構造を次に示します。
    {
      "path" : "<entire path to the home directory for the XRegion Service>",
      "agentGroupSize" : <number of service agents>,
      "agentId" : <agent id using 0-based numbering>,
      "region" : "<local region name>",
      "store" : "<local store name>",
      "helpers" : [ 
        "<host1>:<port>",
        "<host2>:<port>",
        …
        "<hostn>:<port>"
      ],
      "security" : "<entire path to the security file of the local store>",
      "regions" : [ 
        {
            "name" : "<remote region name>",
            "store" : "<remote store name>",
            "security" : "<entire path to the security file of the remote store>",
            "helpers" : [
                "<host1>:<port>",
                "<host2>:<port>",
                …
                "<hostn>:<port>
             ]
        },
        {
            "name" : "<remote region name>",
            "store" : "<remote store name>",
            "security" : "<entire path to the security file of the remote store>",
            "helpers" : [ 
                "<host1>:<port>",
                "<host2>:<port>",
                …
                "<hostn>:<port>
            ]
        }, 
        ...
      ]
      "durability" : "<durability setting>"
    }

    ここで、json.configファイルの各属性の詳細は次のとおりです。

  3. XRegionサービス・エージェントに次の権限を付与します。
    • システム表に対する書込み権限
    • すべてのユーザー表に対する読取りおよび書込み権限
    • DELETE_ANY_TABLE

    ノート:

    データを(put操作を使用して)複数リージョン表に挿入するには、INSERT権限とDELETE権限の両方が必要です。
    — create role for the agent -- 
    CREATE ROLE <Agent Role>
    
    — grant privileges to the role --   
    GRANT WRITE_SYSTEM_TABLE to <Agent Role>
    GRANT READ_ANY_TABLE to <Agent Role>
    GRANT INSERT_ANY_TABLE to <Agent Role>
    GRANT DELETE_ANY_TABLE to <Agent Role>
    
    — grant role to the agent user -- 
    GRANT <Agent Role> to user <Agent User>

    ノート:

    このステップは、セキュアなデータ・ストアに対してのみ必要です。非セキュアなデータ・ストア設定では、このステップをスキップできます。

XRegionサービス・エージェントの追加

XRegionサービス・エージェントをグループに追加することで、水平方向のスケーラビリティを実現できます。

エージェントに水平方向のスケーラビリティを追加するには、次の手順を実行します。
  • エージェントのホスト・ノードを識別します。エージェントは、そのノードで実行されている唯一のプロセスにすることをお薦めします。
  • 前述のホスト・ノードでOracle NoSQL Databaseバンドルをダウンロードし、Oracle NoSQL Databaseパッケージ(kv-M.N.O.zipまたはkv-M.N.O.tar.gz)の内容を$KVHOMEに抽出します。パッケージを解凍すると、Oracle NoSQL Databaseがインストールされます。
    unzip kv-ee-24.1.11.zip
  • XRegionサービスのホーム・ディレクトリを作成します。
  • 前述のステップで作成したホーム・ディレクトリにJSON構成ファイルを作成します。

ノート:

構成ファイルを作成する手順は、前述のとおりです。agentId0で始まり、1ずつ増分されます。たとえば、"agentGroupSize" : 2を指定して、すでに1つのエージェントがあり、2番目のエージェントを追加する場合、agentIdの値は1になります。

次に例を示します。

提案されたリージョン(フランクフルトおよびロンドン)ごとにjson.configファイルを作成します。

# Contents of the configuration file in the host1 in 'fra' Region
{
  "path": "<path to the json config file>",
  "agentGroupSize": 2,
  "agentId": 0,
  "region": "fra",
  "store": "<storename at the fra region>",
  "security": "<path to the security file>",
  "helpers": [
    "host1:5000",
    "host2:5000",
    "host3:5000"
  ],
  "regions": [
    {
      "name": "lnd",
      "store": "<storename at the lnd region>",
      "security": "<path to the security file>",
      "helpers": [
        "host4:5000",
        "host5:5000",
        "host6:5000"
      ]
    }
  ]
}
# Contents of the configuration file in the host7 in 'fra' Region. 
# This host is used only to run an additional XRegion agent 
{
  "path": "<path to the json config file>",
  "agentGroupSize": 2,
  "agentId": 1,
  "region": "fra",
  "store": "<storename at the fra region>",
  "security": "<path to the security file>", 
  "helpers": [
    "host1:5000",
    "host2:5000",
    "host3:5000"
  ],
  "regions": [
    {
      "name": "lnd",
      "store": "<storename at the lnd region>",
      "security": "<path to the security file>",
      "helpers": [
        "host4:5000",
        "host5:5000",
        "host6:5000"
      ]
    }
  ]
}
# Contents of the configuration file in the 'lnd' Region
{
  "path": "<path to the json config file>",
  "agentGroupSize": 2,
  "agentId": 0,
  "region": "lnd",
  "store": "<storename at the lnd region>",
  "security": "<path to the security file>",
  "helpers": [
    "host4:5000",
    "host5:5000",
    "host6:5000"
  ],
  "regions": [
    {
      "name": "fra",
      "store": "<storename at the fra region>",
      "security": "<path to the security file>",
      "helpers": [
        "host1:5000",
        "host2:5000",
        "host3:5000"
      ]
    }
  ]
}
# Contents of the configuration file in host 8 in the 'lnd' Region, 
# This host is used only to run an additional XRegion agent
{
  "path": "<path to the json config file>",
  "agentGroupSize": 2,
  "agentId": 1,
  "region": "lnd",
  "store": "<storename at the lnd region>",
  "security": "<path to the security file>",
  "helpers": [
    "host4:5000",
    "host5:5000",
    "host6:5000"
  ],
  "regions": [
    {
      "name": "fra",
      "store": "<storename at the fra region>",
      "security": "<path to the security file>",
      "helpers": [
        "host1:5000",
        "host2:5000",
        "host3:5000"
      ]
    }
  ]
}