20.9.4. 非 Java クライアントからの Red Hat Data Grid Memcached サーバーとの通信


本セクションでは、python スクリプトなど、java 以外のクライアントで Red Hat Data Grid memcached サーバーと通信する方法を説明します。

20.9.4.1. マルチクラスターサーバーのチュートリアル

この例では、元の memcached 実装では利用できない Red Hat Data Grid memcached severs のディストリビューション機能について取り上げます。

  • 2 つのクラスター化されたノードを起動します。この設定は、GUI デモに使用されるものと同じです。

    $ ./bin/standalone.sh -c clustered.xml -Djboss.node.name=nodeA
    $ ./bin/standalone.sh -c clustered.xml -Djboss.node.name=nodeB -Djboss.socket.binding.port-offset=100
    Copy to Clipboard Toggle word wrap

または、以下を使用します。

$ ./bin/domain.sh
Copy to Clipboard Toggle word wrap

2 つのノードを自動的に起動します。

  • ポート 11211 にバインドされている Red Hat Data Grid memcached サーバーに対して、基本的にいくつかの書き込み操作を実行する test_memcached_write.py スクリプトを実行します。スクリプトが正常に実行されると、以下のような出力が表示されます。

    Connecting to 127.0.0.1:11211
    Testing set ['Simple_Key': Simple value] ... OK
    Testing set ['Expiring_Key' : 999 : 3] ... OK
    Testing increment 3 times ['Incr_Key' : starting at 1 ]
    Initialise at 1 ... OK
    Increment by one ... OK
    Increment again ... OK
    Increment yet again ... OK
    Testing decrement 1 time ['Decr_Key' : starting at 4 ]
    Initialise at 4 ... OK
    Decrement by one ... OK
    Testing decrement 2 times in one call ['Multi_Decr_Key' : 3 ]
    Initialise at 3 ... OK
    Decrement by 2 ... OK
    Copy to Clipboard Toggle word wrap
  • 127.0.0.1:11311 にバインドされているサーバーに接続する test_memcached_read.py スクリプトを実行し、writer スクリプトが最初のサーバーに書き込まれたデータを読み取れることを確認します。スクリプトが正常に実行されると、以下のような出力が表示されます。
 Connecting to 127.0.0.1:11311
 Testing get ['Simple_Key'] should return Simple value ... OK
 Testing get ['Expiring_Key'] should return nothing... OK
 Testing get ['Incr_Key'] should return 4 ... OK
 Testing get ['Decr_Key'] should return 3 ... OK
 Testing get ['Multi_Decr_Key'] should return 1 ... OK
Copy to Clipboard Toggle word wrap
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

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

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

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

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

会社概要

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

Theme

© 2026 Red Hat
トップに戻る