Data Grid での RESP プロトコルエンドポイントの使用


Red Hat Data Grid 8.5

Data Grid RESP エンドポイントを使用してリモートキャッシュと対話する

Red Hat Customer Content Services

概要

RESP エンドポイントを使用すると、Redis クライアントは、Data Grid でサポートされている 1 つ以上の RESP サーバーに接続し、キャッシュ操作を実行できます。

Red Hat Data Grid

Data Grid は、高性能の分散型インメモリーデータストアです。

スキーマレスデータ構造
さまざまなオブジェクトをキーと値のペアとして格納する柔軟性があります。
グリッドベースのデータストレージ
クラスター間でデータを分散および複製するように設計されています。
エラスティックスケーリング
サービスを中断することなく、ノードの数を動的に調整して要件を満たします。
データの相互運用性
さまざまなエンドポイントからグリッド内のデータを保存、取得、およびクエリーします。

Data Grid のドキュメント

Data Grid のドキュメントは、Red Hat カスタマーポータルで入手できます。

Data Grid のダウンロード

Red Hat カスタマーポータルで Data Grid Software Downloads にアクセスします。

注記

Data Grid ソフトウェアにアクセスしてダウンロードするには、Red Hat アカウントが必要です。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。まずは、マスター (master)、スレーブ (slave)、ブラックリスト (blacklist)、ホワイトリスト (whitelist) の 4 つの用語の置き換えから始めます。この取り組みは膨大な作業を要するため、用語の置き換えは、今後の複数のリリースにわたって段階的に実施されます。詳細は、Red Hat CTO である Chris Wright のメッセージ をご覧ください。

1. Data Grid RESP エンドポイント

シングルポートエンドポイントでは、RESP エンドポイントはデフォルトで有効になっています。Redis クライアント接続は自動的に検出され、内部コネクターにルーティングされます。RESP エンドポイントは以下で動作します。

  • スタンドアロンの Data Grid Server デプロイメントは、各サーバーインスタンスが独立して実行する構成であり、その動作はスタンドアロンの Redis と完全に同等です。
  • サーバーインスタンスが相互にデータを複製または分散する、クラスター化された Data Grid Server デプロイメント。クラスター化されたデプロイメントは、クライアントにフェイルオーバー機能を提供します。

前提条件

  • Data Grid Server をインストールします。

検証

Data Grid Server を起動するときに、次のログメッセージを確認します。

[org.infinispan.SERVER] ISPN080018: Started connector Resp (internal)

Redis クライアントを使用して RESP エンドポイントに接続できるようになりました。たとえば、Redis CLI を使用すると、次のようにしてエントリーをキャッシュに追加できます。

redis-cli -p 11222 --user username --pass password
127.0.0.1:11222> SET k v
OK
127.0.0.1:11222> GET k
"v"
127.0.0.1:11222> quit

1.1. RESP エンドポイントのキャッシュの設定

RESP エンドポイントは respCache キャッシュを自動的に設定して開始します。このキャッシュの設定は次のとおりです。

  • Data Grid Server のクラスタリングモードに応じて、local-cache または distributed-cache になります。
  • キーと値の両方に対して application/octet-stream エンコードを使用します。
  • RESPHashFunctionPartitioner ハッシュパーティショナー。Redis クライアントで使用される CRC16 ハッシュをサポートします。
キャッシュの明示的な設定

RESP コネクターの要件に違反しない限り、キャッシュのカスタム設定を指定できます。違反すると、サーバーが例外を出力し、起動しません。主な制約は次のとおりです。

  • ハッシュパーティショニング関数は、org.infinispan.distribution.ch.impl.RESPHashFunctionPartitioner にする必要があります。
  • キーエンコーディングは application/octet-stream にする必要があります。

明示的なキャッシュ設定の例を次に示します。

XML

<distributed-cache name="respCache" aliases="0" owners="2"
                   key-partitioner="org.infinispan.distribution.ch.impl.RESPHashFunctionPartitioner"
                   mode="SYNC" remote-timeout="17500" statistics="true">
	<encoding media-type="application/octet-stream"/>
</distributed-cache>

JSON

{
   "respCache": {
     "distributed-cache": {
       "aliases": ["0"],
       "owners": "2",
       "key-partitioner": "org.infinispan.distribution.ch.impl.RESPHashFunctionPartitioner",
       "mode": "SYNC",
       "statistics": true,
       "encoding": {
         "media-type": "application/octet-stream"
       }
     }
   }
 }

YAML

respCache:
  distributedCache:
    aliases:
      - "0"
    owners: "2"
    keyPartitioner: "org.infinispan.distribution.ch.impl.RESPHashFunctionPartitioner"
    mode: "SYNC"
    statistics: "true"
    encoding:
      mediaType: "application/octet-stream"

ヒント

Data Grid コンソールでキャッシュエントリーを表示する場合は、Protobuf エンコーディングを使用してキャッシュ値のエンコーディングを設定します (value media-type="application/x-protostream")。

明示的な RESP エンドポイント設定

シングルポートエンドポイントで使用される暗黙的な設定がニーズに合わない場合は、明示的な設定を利用できます。

XML

<endpoints>
  <endpoint socket-binding="default" security-realm="default">
    <resp-connector cache="mycache" />
    <hotrod-connector />
    <rest-connector/>
  </endpoint>
</endpoints>

JSON

{
  "server": {
    "endpoints": {
      "endpoint": {
        "socket-binding": "default",
        "security-realm": "default",
        "resp-connector": {
          "cache": "mycache"
        },
        "hotrod-connector": {},
        "rest-connector": {}
      }
    }
  }
}

YAML

server:
  endpoints:
    endpoint:
      socketBinding: "default"
      securityRealm: "default"
      respConnector:
        cache: "mycache"
      hotrodConnector: ~
      restConnector: ~

2. キャッシュの Redis 論理データベースへのマッピング

キャッシュ aliases 設定属性を使用して、キャッシュを Redis 論理データベースにマップします。デフォルトの respCache は論理データベース 0 にマップされます。

ヒント

Redis では Redis Cluster の使用時にデータベース 0 のみがサポートされるのに対し、Data Grid ではクラスターモードでも複数の論理データベースを使用できます。

3. Redis コマンド

Data Grid RESP エンドポイントは、次の Redis コマンドを実装します。

法律上の通知

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.